provide stricmp
Subsystems (2)
PATCH 1/1 provide stricmp
While strnicmp existed in the set of string support routines, stricmp didn't, which this patch adjusts.
From: Jan Beulich <[email protected]>
(actual patch attached)
While strnicmp existed in the set of string support routines, stricmp didn't, which this patch adjusts.
From: Jan Beulich <[email protected]>
include/linux/string.h +3 -0
@@ -47,6 +47,9 @@ extern int strcmp(const char *,const cha#ifndef __HAVE_ARCH_STRNCMPextern int strncmp (const char *,const char *,__kernel_size_t );#endif +#ifndef __HAVE_ARCH_STRICMP +extern int stricmp (const char *,const char *); +#endif #ifndef __HAVE_ARCH_STRNICMPextern int strnicmp (const char *,const char *,__kernel_size_t );#endif
lib/string.c +25 -0
@@ -24,6 +24,31 @@#include <linux/ctype.h> #include <linux/module.h> +#ifndef __HAVE_ARCH_STRICMP +/** +* stricmp - Compare two strings case-insensitively +* @s1: One string +* @s2: Another string +*/ +int stricmp (const char *s1,const char *s2) +{ +unsigned char c1, c2; + +for (;;) { + c1 = *s1++; + c2 = *s2++; +if (!c1 || !c2) +break ; +if (c1 == c2) +continue ; +if ((c1 =tolower (c1)) != (c2 =tolower (c2))) +break ; + } +return (int )c1 - (int )c2; +} +#endif +EXPORT_SYMBOL (stricmp); +#ifndef __HAVE_ARCH_STRNICMP/** * strnicmp - Case insensitive, length-limited string comparison
Quoted 2 lines · Jan Beulich
While strnicmp existed in the set of string support routines, stricmp didn't, which this patch adjusts.
There's still no user. Please stop blindly resubmitting things that have been rejected.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Christoph Hellwig <[email protected]> 08.11.05 14:41:21 >>>
Quoted 1 line · Jan Beulich
While strnicmp existed in the set of string support routines,
stricmp
Quoted 4 lines
Quoted 1 line
didn't, which this patch adjusts.
There's still no user. Please stop blindly resubmitting things that have been rejected.
Consistency or anything similar doesn't count?
Jan