Note: this change is untested.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
return -1;
}
#endif
+
+#ifndef HAVE_STRCASESTR
+#include <ctype.h>
+
+char *openconnect__strcasestr(const char *haystack, const char *needle)
+{
+ int hlen = strlen(haystack);
+ int nlen = strlen(needle);
+ int i, j;
+
+ for (i = 0; i < hlen - nlen + 1; i++) {
+ for (j = 0; j < nlen; j++) {
+ if (tolower(haystack[i + j]) !=
+ tolower(needle[j]))
+ break;
+ }
+ if (j == nlen)
+ return (char *)haystack + i;
+ }
+ return NULL;
+}
+#endif
return 0;
}
-#ifndef HAVE_STRCASESTR
-static char *openconnect__strcasestr(const char *haystack, const char *needle)
-{
- int hlen = strlen(haystack);
- int nlen = strlen(needle);
- int i, j;
-
- for (i = 0; i < hlen - nlen + 1; i++) {
- for (j = 0; j < nlen; j++) {
- if (tolower(haystack[i + j]) !=
- tolower(needle[j]))
- break;
- }
- if (j == nlen)
- return (char *)haystack + i;
- }
- return NULL;
-}
-#define strcasestr openconnect__strcasestr
-#endif
-
-
int internal_parse_url(char *url, char **res_proto, char **res_host,
int *res_port, char **res_path, int default_port)
{
#define getline openconnect__getline
ssize_t openconnect__getline(char **lineptr, size_t *n, FILE *stream);
#endif
+#ifndef HAVE_STRCASESTR
+#define strcasestr openconnect__strcasestr
+char *openconnect__strcasestr(const char *haystack, const char *needle);
+#endif
/****************************************************************************/