diff options
Diffstat (limited to 'lib/str_ncmp.c')
-rw-r--r-- | lib/str_ncmp.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/str_ncmp.c b/lib/str_ncmp.c new file mode 100644 index 0000000..56995fc --- /dev/null +++ b/lib/str_ncmp.c @@ -0,0 +1,26 @@ +int +str_ncmp(s1, s2, n) + char *s1, *s2; + int n; +{ + int c1, c2; + + while (n--) + { + c1 = *s1++; + if (c1 >= 'A' && c1 <= 'Z') + c1 |= 0x20; + + c2 = *s2++; + if (c2 >= 'A' && c2 <= 'Z') + c2 |= 0x20; + + if (c1 -= c2) + return (c1); + + if (!c2) + break; + } + + return 0; +} |