Adding upstream version 6.03~pre1+dfsg.
[syslinux-debian/hramrach.git] / com32 / lib / strncmp.c
blobe41b9e3624206a290f713e309385ea8208109ea5
1 /*
2 * strncmp.c
3 */
5 #include <string.h>
7 int strncmp(const char *s1, const char *s2, size_t n)
9 const unsigned char *c1 = (const unsigned char *)s1;
10 const unsigned char *c2 = (const unsigned char *)s2;
11 unsigned char ch;
12 int d = 0;
14 while (n--) {
15 d = (int)(ch = *c1++) - (int)*c2++;
16 if (d || !ch)
17 break;
20 return d;