missing_d/memcmp.c
raw| 1 | /* |
| 2 | * memcmp --- compare strings. |
| 3 | * |
| 4 | * We use our own routine since it has to act like strcmp() for return |
| 5 | * value, and the BSD manual says bcmp() only returns zero/non-zero. |
| 6 | */ |
| 7 | |
| 8 | int |
| 9 | memcmp (s1, s2, l) |
| 10 | char *s1, *s2; |
| 11 | int l; |
| 12 | { |
| 13 | for (; l-- > 0; s1++, s2++) { |
| 14 | if (*s1 != *s2) |
| 15 | return (*s1 - *s2); |
| 16 | } |
| 17 | return (0); |
| 18 | } |