diff options
author | Jeremy Allison <jra@samba.org> | 2015-07-15 10:43:56 -0700 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2015-08-04 07:27:23 +0200 |
commit | 466abc316218bcaa538d7feb8a353fc8284e87ba (patch) | |
tree | 69c93a88a8855e391eec0844a167873528dffda3 /lib/replace/replace.c | |
parent | eac2f538bf2b8d4f483232dcc0539d29a88b4529 (diff) | |
download | samba-466abc316218bcaa538d7feb8a353fc8284e87ba.tar.gz |
lib: replace: Add strsep function (missing on Solaris).
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11359
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@wakeful.net>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul 29 02:24:55 CEST 2015 on sn-devel-104
(cherry picked from commit f07b746ad3f3ee2fcbb65a0d452ed80f07c9e8f9)
Diffstat (limited to 'lib/replace/replace.c')
-rw-r--r-- | lib/replace/replace.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/replace/replace.c b/lib/replace/replace.c index dccf5142838..0806ce36fa9 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -475,6 +475,26 @@ char *rep_strcasestr(const char *haystack, const char *needle) } #endif +#ifndef HAVE_STRSEP +char *rep_strsep(char **pps, const char *delim) +{ + char *ret = *pps; + char *p = *pps; + + if (p == NULL) { + return NULL; + } + p += strcspn(p, delim); + if (*p == '\0') { + *pps = NULL; + } else { + *p = '\0'; + *pps = p + 1; + } + return ret; +} +#endif + #ifndef HAVE_STRTOK_R /* based on GLIBC version, copyright Free Software Foundation */ char *rep_strtok_r(char *s, const char *delim, char **save_ptr) |