xref: /csrg-svn/lib/libc/string/strcmp.c (revision 61193)
142150Sbostic /*-
2*61193Sbostic  * Copyright (c) 1990, 1993
3*61193Sbostic  *	The Regents of the University of California.  All rights reserved.
435095Sbostic  *
542150Sbostic  * This code is derived from software contributed to Berkeley by
642150Sbostic  * Chris Torek.
742150Sbostic  *
842150Sbostic  * %sccs.include.redist.c%
91983Swnj  */
101983Swnj 
1135095Sbostic #if defined(LIBC_SCCS) && !defined(lint)
12*61193Sbostic static char sccsid[] = "@(#)strcmp.c	8.1 (Berkeley) 06/04/93";
1335095Sbostic #endif /* LIBC_SCCS and not lint */
1435095Sbostic 
1546144Sbostic #include <sys/cdefs.h>
1642150Sbostic #include <string.h>
1742150Sbostic 
1842150Sbostic /*
1942150Sbostic  * Compare strings.
2042150Sbostic  */
2142150Sbostic int
strcmp(s1,s2)221983Swnj strcmp(s1, s2)
2342150Sbostic 	register const char *s1, *s2;
241983Swnj {
2542150Sbostic 	while (*s1 == *s2++)
2642150Sbostic 		if (*s1++ == 0)
2742150Sbostic 			return (0);
2842150Sbostic 	return (*(unsigned char *)s1 - *(unsigned char *)--s2);
291983Swnj }
30