|
|
1.1 root 1: /*
2: * Coherent Library
3: * Compare up to n chars of strings
4: * Does UNSIGNED compare (which is both reasonable and portable)
5: */
6:
7: int
8: strncmp(p, q, n)
9: register unsigned char *p, *q;
10: register int n;
11: {
12: while (--n >= 0) {
13: if (*p != *q)
14: return (*p - *q);
15: else if (*p == '\0')
16: break;
17: p++;
18: q++;
19: }
20: return (0);
21: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.