aboutsummaryrefslogtreecommitdiffstats
path: root/missing/strcase.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:09:58 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:09:58 +0300
commitcae8bc6ced84c12590e3554a06a952283735363a (patch)
treeca4f38bfcb1312bfb62fc693564d68f3e9b3e973 /missing/strcase.c
parentdbd583bd2b8a6dd40c622875a4e197360cb5aba7 (diff)
downloadegawk-cae8bc6ced84c12590e3554a06a952283735363a.tar.gz
egawk-cae8bc6ced84c12590e3554a06a952283735363a.tar.bz2
egawk-cae8bc6ced84c12590e3554a06a952283735363a.zip
Move to 2.14.
Diffstat (limited to 'missing/strcase.c')
-rw-r--r--missing/strcase.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/missing/strcase.c b/missing/strcase.c
index 6834f27d..5d93911f 100644
--- a/missing/strcase.c
+++ b/missing/strcase.c
@@ -61,8 +61,9 @@ static u_char charmap[] = {
'\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
};
+int
strcasecmp(s1, s2)
- char *s1, *s2;
+ const char *s1, *s2;
{
register u_char *cm = charmap,
*us1 = (u_char *)s1,
@@ -74,16 +75,17 @@ strcasecmp(s1, s2)
return(cm[*us1] - cm[*--us2]);
}
+int
strncasecmp(s1, s2, n)
- char *s1, *s2;
- register int n;
+ const char *s1, *s2;
+ register size_t n;
{
register u_char *cm = charmap,
*us1 = (u_char *)s1,
*us2 = (u_char *)s2;
- while (--n >= 0 && cm[*us1] == cm[*us2++])
+ while ((long)(--n) >= 0 && cm[*us1] == cm[*us2++])
if (*us1++ == '\0')
return(0);
- return(n < 0 ? 0 : cm[*us1] - cm[*--us2]);
+ return((long)n < 0 ? 0 : cm[*us1] - cm[*--us2]);
}