aboutsummaryrefslogtreecommitdiffstats
path: root/missing/memcmp.c
blob: e39c10ecb0b7e9ba414f0a1d83328fcaa607ce2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * memcmp --- compare strings.
 *
 * We use our own routine since it has to act like strcmp() for return
 * value, and the BSD manual says bcmp() only returns zero/non-zero.
 */

int
memcmp (s1, s2, l)
register char *s1, *s2;
register int l;
{
	for (; l--; s1++, s2++) {
		if (*s1 != *s2)
			return (*s1 - *s2);
	}
	return (*--s1 - *--s2);
}