Home
strncmp.c - scc - simple c99 compiler HTML git clone git://git.simple-cc.org/scc DIR Log DIR Files DIR Refs DIR Submodules DIR README DIR LICENSE --- strncmp.c (226B) --- 1 #include <string.h> 2 3 #undef strncmp 4 5 int 6 strncmp(const char *s1, const char *s2, size_t n) 7 { 8 for ( ; n > 0 && *s1 == *s2; --n) 9 ++s1, ++s2; 10 11 if (n == 0) 12 return 0; 13 14 return *(unsigned char *) s1 - *(unsigned char *) s2; 15 }