From 370528047c762be8c283b1f3596ca4714452f644 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 2 Apr 2016 18:19:15 -0500 Subject: [PATCH] wsockd: add win32 strcasestr() --- wsockd/wsockd.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/wsockd/wsockd.c b/wsockd/wsockd.c index 4ead19de..5e2feae9 100644 --- a/wsockd/wsockd.c +++ b/wsockd/wsockd.c @@ -95,6 +95,28 @@ typedef struct _conn char client_key[37]; /* maximum 36 bytes + nul */ } conn_t; +#ifdef _WIN32 +char * +strcasestr(const char *s, *find) +{ + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + c = tolower((unsigned char)c); + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while ((char)tolower((unsigned char)sc) != c); + } while (strnicmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} +#endif + static void close_conn(conn_t * conn, int wait_plain, const char *fmt, ...); static void conn_mod_read_cb(rb_fde_t *fd, void *data); static void conn_plain_read_cb(rb_fde_t *fd, void *data);