svn commit: samba r15879 - in branches/SAMBA_4_0/source/lib/replace: .

tridge at samba.org tridge at samba.org
Thu May 25 02:09:01 GMT 2006


Author: tridge
Date: 2006-05-25 02:09:00 +0000 (Thu, 25 May 2006)
New Revision: 15879

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15879

Log:

strtok_r() replacement, for solaris

Modified:
   branches/SAMBA_4_0/source/lib/replace/config.m4
   branches/SAMBA_4_0/source/lib/replace/replace.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/config.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/config.m4	2006-05-24 23:09:29 UTC (rev 15878)
+++ branches/SAMBA_4_0/source/lib/replace/config.m4	2006-05-25 02:09:00 UTC (rev 15879)
@@ -48,7 +48,7 @@
 AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
 AC_CHECK_FUNCS(timegm setenv vsyslog setlinebuf mktime ftruncate chsize rename)
 AC_CHECK_FUNCS(waitpid strnlen strlcpy strlcat innetgr initgroups memmove strdup)
-AC_CHECK_FUNCS(pread pwrite strndup strcasestr)
+AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r)
 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
 AC_HAVE_DECL(errno, [#include <errno.h>])

Modified: branches/SAMBA_4_0/source/lib/replace/replace.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/replace.c	2006-05-24 23:09:29 UTC (rev 15878)
+++ branches/SAMBA_4_0/source/lib/replace/replace.c	2006-05-25 02:09:00 UTC (rev 15879)
@@ -549,3 +549,30 @@
 	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



More information about the samba-cvs mailing list