diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-10-07 23:37:03 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-10-07 23:37:03 +0000 |
commit | fbb4007ac88656122f9319dea4563a3a4fd40e82 (patch) | |
tree | ca4265ac43d139b3fd02ba32bfe6d5e12cadb65c /libc/string/strncasecmp.c | |
parent | b8f03a94957c913fa0d8588c41b0332b49310ff0 (diff) |
Update and simplification.
Diffstat (limited to 'libc/string/strncasecmp.c')
-rw-r--r-- | libc/string/strncasecmp.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/libc/string/strncasecmp.c b/libc/string/strncasecmp.c index c55f259d4..ba73e6f09 100644 --- a/libc/string/strncasecmp.c +++ b/libc/string/strncasecmp.c @@ -6,23 +6,17 @@ #include <string.h> #include <ctype.h> -int -strncasecmp(s, d, l) -const char *s; -const char *d; -size_t l; +int strncasecmp( const char *s, const char *d, size_t l) { - while(l>0) - { - if( *s != *d ) - { - if( tolower(*s) != tolower(*d) ) - return *s - *d; - } - else - if( *s == '\0' ) return 0; - s++; d++; l--; - } - return 0; + while (l > 0) { + if (*s != *d) { + if (tolower(*s) != tolower(*d)) + return *s - *d; + } else if (*s == '\0') + return 0; + s++; + d++; + l--; + } + return 0; } - |