ifndef CONFIG_STRSEP
SOURCE += lib/strsep.c
endif
+ifndef CONFIG_STRCASESTR
+ SOURCE += lib/strcasestr.c
+endif
ifndef CONFIG_GETOPT_LONG_ONLY
SOURCE += lib/getopt_long.c
endif
fi
echo "strsep $strsep"
+##########################################
+# strcasestr() probe
+strcasestr="no"
+cat > $TMPC << EOF
+#include <string.h>
+int main(int argc, char **argv)
+{
+ strcasestr(NULL, NULL);
+ return 0;
+}
+EOF
+if compile_prog "" "" "strcasestr"; then
+ strcasestr="yes"
+fi
+echo "strcasestr $strcasestr"
+
##########################################
# getopt_long_only() probe
getopt_long_only="no"
if test "$strsep" = "yes" ; then
output_sym "CONFIG_STRSEP"
fi
+if test "$strcasestr" = "yes" ; then
+ output_sym "CONFIG_STRCASESTR"
+fi
if test "$getopt_long_only" = "yes" ; then
output_sym "CONFIG_GETOPT_LONG_ONLY"
fi
--- /dev/null
+#include <ctype.h>
+#include <stddef.h>
+
+char *strcasestr(const char *s1, const char *s2)
+{
+ const char *s = s1;
+ const char *p = s2;
+
+ do {
+ if (!*p)
+ return (char *) s1;
+ if ((*p == *s) ||
+ (tolower(*p) == tolower(*s))) {
+ ++p;
+ ++s;
+ } else {
+ p = s2;
+ if (!*s)
+ return NULL;
+ s = ++s1;
+ }
+ } while (1);
+
+ return *p ? NULL : (char *) s1;
+}
--- /dev/null
+#ifdef CONFIG_STRCASESTR
+
+#include <string.h>
+
+#else
+
+#ifndef FIO_STRCASESTR_H
+#define FIO_STRCASESTR_H
+
+char *strcasestr(const char *haystack, const char *needle);
+
+#endif
+#endif