From: DJ Delorie Subject: Re: strcasecmp revisited 30 Nov 1998 19:02:04 -0500 Message-ID: <366331FC.16D0AA06@delorie.com> References: <19981130132257 DOT B15656 AT cygnus DOT com> <19981130152146 DOT A16484 DOT cygnus DOT cygwin32 DOT developers AT cygnus DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5 [en] (X11; I; Linux 2.1.126 i586) X-Accept-Language: en Christopher Faylor wrote: > That is almost what is happening now except for the tolower case. Hmm. > I just checked this behavior on Linux and it appears that I was just > misinterpreting what was going on here. Linux apparently does compare > a non-alpha character to the lowercased character. That's all it > does. So, my change was actually wrong. DJGPP compares the tolower()d characters (strcasecmp is a stub that chains to stricmp). Nobody has complained yet :-) /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include #include int stricmp(const char *s1, const char *s2) { while (tolower(*s1) == tolower(*s2)) { if (*s1 == 0) return 0; s1++; s2++; } return (int)tolower(*s1) - (int)tolower(*s2); }