From: H.G.Muller Date: Sat, 31 Dec 2016 19:37:53 +0000 (+0100) Subject: Fix strcasestr for Windows X-Git-Tag: v4.0~37 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=3ac3bb55a99f03831492829d8135e83f567d59b9;p=uci2wb.git Fix strcasestr for Windows The strcasestr definition, which we have to supply ourselves to make the Windows version compilable, was not upto the task of having a string constant as first argument, and a string that needs decapitalization as the second argument. --- diff --git a/UCI2WB.c b/UCI2WB.c index 4d3a4df..ebcd79c 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -55,7 +55,7 @@ FILE *toE, *fromE, *fromF; int pid; #ifdef WIN32 -char *strcasestr (char *p, char *q) { char *r = p; while(*r) *r = tolower(*r), r++; return strstr(p, q); } +char *strcasestr (char *p, char *q) { while(*p) { char *r=p++, *s=q; while(tolower(*r++) == tolower(*s) && *s) s++; if(!*s) return p-1; } return NULL; } WinPipe(HANDLE *hRd, HANDLE *hWr) {