date and time created 83/05/31 00:28:51 by sam
[unix-history] / usr / src / lib / libcompat / 4.1 / strcmpn.c
CommitLineData
8cae6e23
BJ
1/* @(#)strcmpn.c 4.1 (Berkeley) %G% */
2/*
3 * Compare strings (at most n bytes): s1>s2: >0 s1==s2: 0 s1<s2: <0
4 */
5
6strcmpn(s1, s2, n)
7register char *s1, *s2;
8register n;
9{
10
11 while (--n >= 0 && *s1 == *s2++)
12 if (*s1++ == '\0')
13 return(0);
14 return(n<0 ? 0 : *s1 - *--s2);
15}