diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-05-25 02:09:00 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:08:36 -0500 |
commit | 01b8c1913d75a9b74a1a4bf3e7d8a80f18db0b2d (patch) | |
tree | 10babe657e78ae06690b408b6e0f8514a9e9fbc8 /source4/lib/replace/replace.c | |
parent | 26875d59ba6d5d6fb9ac75f461953e0ebee6a8f3 (diff) | |
download | samba-01b8c1913d75a9b74a1a4bf3e7d8a80f18db0b2d.tar.gz samba-01b8c1913d75a9b74a1a4bf3e7d8a80f18db0b2d.tar.bz2 samba-01b8c1913d75a9b74a1a4bf3e7d8a80f18db0b2d.zip |
r15879: strtok_r() replacement, for solaris
(This used to be commit df5bd916db3cfbd6c145177fd8992261f03a5cbc)
Diffstat (limited to 'source4/lib/replace/replace.c')
-rw-r--r-- | source4/lib/replace/replace.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index f72394cb0f..38a3d517df 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -549,3 +549,30 @@ char *strcasestr(const char *haystack, const char *needle) return NULL; } #endif + +#ifndef HAVE_STRTOK_R +/* based on GLIBC version, copyright Free Software Foundation */ +char *strtok_r(char *s, const char *delim, char **save_ptr) +{ + char *token; + + if (s == NULL) s = *save_ptr; + + s += strspn(s, delim); + if (*s == '\0') { + *save_ptr = s; + return NULL; + } + + token = s; + s = strpbrk(token, delim); + if (s == NULL) { + *save_ptr = token + strlen(token); + } else { + *s = '\0'; + *save_ptr = s + 1; + } + + return token; +} +#endif |