From fbb4007ac88656122f9319dea4563a3a4fd40e82 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 7 Oct 2000 23:37:03 +0000 Subject: Update and simplification. --- libc/string/strncasecmp.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'libc/string/strncasecmp.c') 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 #include -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; } - -- cgit v1.2.3