Commit | Line | Data |
---|---|---|
a9421054 KB |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
9d6965df KB |
3 | * All rights reserved. |
4 | * | |
a9421054 KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Chris Torek. | |
7 | * | |
8 | * %sccs.include.redist.c% | |
9c7cf302 BJ |
9 | */ |
10 | ||
9d6965df | 11 | #if defined(LIBC_SCCS) && !defined(lint) |
a9421054 | 12 | static char sccsid[] = "@(#)strcmp.c 5.4 (Berkeley) %G%"; |
9d6965df KB |
13 | #endif /* LIBC_SCCS and not lint */ |
14 | ||
a9421054 KB |
15 | #include <sys/stdc.h> |
16 | #include <string.h> | |
17 | ||
18 | /* | |
19 | * Compare strings. | |
20 | */ | |
21 | int | |
9c7cf302 | 22 | strcmp(s1, s2) |
a9421054 | 23 | register const char *s1, *s2; |
9c7cf302 | 24 | { |
a9421054 KB |
25 | while (*s1 == *s2++) |
26 | if (*s1++ == 0) | |
27 | return (0); | |
28 | return (*(unsigned char *)s1 - *(unsigned char *)--s2); | |
9c7cf302 | 29 | } |