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

tridge at samba.org tridge at samba.org
Tue Oct 11 12:30:36 GMT 2005


Author: tridge
Date: 2005-10-11 12:30:34 +0000 (Tue, 11 Oct 2005)
New Revision: 10896

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

Log:

added a strcasestr() replacement function

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


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/config.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/config.m4	2005-10-11 12:25:55 UTC (rev 10895)
+++ branches/SAMBA_4_0/source/lib/replace/config.m4	2005-10-11 12:30:34 UTC (rev 10896)
@@ -45,7 +45,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)
+AC_CHECK_FUNCS(pread pwrite strndup strcasestr)
 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	2005-10-11 12:25:55 UTC (rev 10895)
+++ branches/SAMBA_4_0/source/lib/replace/replace.c	2005-10-11 12:30:34 UTC (rev 10896)
@@ -22,6 +22,7 @@
 #include "system/wait.h"
 #include "system/time.h"
 #include "system/network.h"
+#include "system/iconv.h"
 
  void replace_dummy(void);
  void replace_dummy(void) {}
@@ -534,4 +535,17 @@
 }
 #endif
 
-
+#ifndef HAVE_STRCASESTR
+char *strcasestr(const char *haystack, const char *needle)
+{
+	const char *s;
+	size_t nlen = strlen(needle);
+	for (s=haystack;*s;s++) {
+		if (toupper(*needle) == toupper(*s) &&
+		    strncasecmp(s, needle, nlen) == 0) {
+			return discard_const_p(char, s);
+		}
+	}
+	return NULL;
+}
+#endif

Modified: branches/SAMBA_4_0/source/lib/replace/replace.h
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/replace.h	2005-10-11 12:25:55 UTC (rev 10895)
+++ branches/SAMBA_4_0/source/lib/replace/replace.h	2005-10-11 12:30:34 UTC (rev 10896)
@@ -84,6 +84,10 @@
 int rename(const char *zfrom, const char *zto);
 #endif
 
+#ifndef HAVE_STRCASESTR
+char *strcasestr(const char *haystack, const char *needle);
+#endif
+
 #ifndef HAVE_FTRUNCATE
 int ftruncate(int f,long l);
 #endif



More information about the samba-cvs mailing list