X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/6e6d4a8b902639de18da98519a2141ea22432700..6f9272bdabcda81425ec1aaecf26a160535d4749:/lib/minilib.c?ds=sidebyside diff --git a/lib/minilib.c b/lib/minilib.c index c1d36b6..e90f7af 100644 --- a/lib/minilib.c +++ b/lib/minilib.c @@ -50,6 +50,16 @@ int strcmp (const char *a2, const char *a1) { } } +int strncmp (const char *a2, const char *a1, int n) { + while (n--) { + if (*a2 != *a1) return 1; + if (*a2 == 0) return 0; + a1++; + a2++; + } + return 0; +} + int strlen(const char *c) { int l = 0;