diff options
Diffstat (limited to 'newlib/libc/string/strtok_r.c')
-rw-r--r-- | newlib/libc/string/strtok_r.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/newlib/libc/string/strtok_r.c b/newlib/libc/string/strtok_r.c index 02ad80b9b..ed323369e 100644 --- a/newlib/libc/string/strtok_r.c +++ b/newlib/libc/string/strtok_r.c @@ -10,7 +10,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -30,11 +34,10 @@ #include <string.h> char * -_DEFUN (__strtok_r, (s, delim, lasts, skip_leading_delim), +_DEFUN (strtok_r, (s, delim, lasts), register char *s _AND register const char *delim _AND - char **lasts _AND - int skip_leading_delim) + char **lasts) { register char *spanp; register int c, sc; @@ -50,16 +53,8 @@ _DEFUN (__strtok_r, (s, delim, lasts, skip_leading_delim), cont: c = *s++; for (spanp = (char *)delim; (sc = *spanp++) != 0;) { - if (c == sc) { - if (skip_leading_delim) { - goto cont; - } - else { - *lasts = s; - s[-1] = 0; - return (s - 1); - } - } + if (c == sc) + goto cont; } if (c == 0) { /* no non-delimiter characters */ @@ -88,12 +83,3 @@ cont: } /* NOTREACHED */ } - -char * -_DEFUN (strtok_r, (s, delim, lasts), - register char *s _AND - register const char *delim _AND - char **lasts) -{ - return __strtok_r (s, delim, lasts, 1); -} |