chiark / gitweb /
volume_id: provide libvolume_id.a file
[elogind.git] / klibc / klibc / strncmp.c
1 /*
2  * strncmp.c
3  */
4
5 #include <string.h>
6
7 int strncmp(const char *s1, const char *s2, size_t n)
8 {
9   const unsigned char *c1 = s1, *c2 = s2;
10   unsigned char ch;
11   int d = 0;
12
13   while ( n-- ) {
14     d = (int)(ch = *c1++) - (int)*c2++;
15     if ( d || !ch )
16       break;
17   }
18
19   return d;
20 }