linux-2.1.119pre1's strnicmp is broken

Horst von Brand (vonbrand@inf.utfsm.cl)
Thu, 27 Aug 1998 16:37:07 -0400


The patch contains the following function for fs/isofs/inode.c, that IMHO
should read as patched here:

static int strnicmp(const char *s1, const char *s2, int len)
{
int n = 0;
while (*s1 && *s2 && (tolower(*s1) == tolower(*s2))) {
s1++; s2++; n++;
if (n == len) return 0;
}
if (*s1 == 0 && *s2 == 0) return 0;
if (*s1 && *s2) {
- if (*s1 > *s2) return 1;
+ if(tolower(*s1) > tolower(*s2) return 1;
return -1;
}
if (*s1) return 1;
return -1;
}

BTW, why not place this somewhere in the lib directory? It might make sense
elsewhere.

--
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html