source: bootcd/isolinux/syslinux-6.03/com32/lib/strncmp.c

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 355 bytes
Line 
1/*
2 * strncmp.c
3 */
4
5#include <string.h>
6
7int strncmp(const char *s1, const char *s2, size_t n)
8{
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;
13
14    while (n--) {
15        d = (int)(ch = *c1++) - (int)*c2++;
16        if (d || !ch)
17            break;
18    }
19
20    return d;
21}
Note: See TracBrowser for help on using the repository browser.