freebsd-ports/ftp/wu-ftpd+ipv6/files/patch-af
Andrey A. Chernov 74cad0bec2 Fix broken strcasestr() implementation.
Use FreeBSD's strcasestr() if present.
2001-10-10 03:23:29 +00:00

29 lines
815 B
Text

--- support/strcasestr.c.orig Sat Jul 1 22:36:29 2000
+++ support/strcasestr.c Wed Oct 10 07:18:17 2001
@@ -24,22 +24,24 @@
$Id: strcasestr.c,v 1.5 2000/07/01 18:36:29 wuftpd Exp $
****************************************************************************/
+#include <ctype.h>
#include <string.h>
/*
* Find the first occurrence of find in s.
*/
-char *strcasestr(register char *s, register char *find)
+char *strcasestr(const char *s, const char *find)
{
register char c, sc;
register size_t len;
if ((c = *find++) != 0) {
+ c = tolower((unsigned char)c);
len = strlen(find);
do {
do {
if ((sc = *s++) == 0)
return (NULL);
- } while (sc != c);
+ } while ((char)tolower((unsigned char)sc) != c);
} while (strncasecmp(s, find, len) != 0);
s--;
}