xref: /csrg-svn/lib/libc/string/strcmp.c (revision 35095)
11983Swnj /*
2*35095Sbostic  * Copyright (c) 1988 Regents of the University of California.
3*35095Sbostic  * All rights reserved.
4*35095Sbostic  *
5*35095Sbostic  * Redistribution and use in source and binary forms are permitted
6*35095Sbostic  * provided that the above copyright notice and this paragraph are
7*35095Sbostic  * duplicated in all such forms and that any documentation,
8*35095Sbostic  * advertising materials, and other materials related to such
9*35095Sbostic  * distribution and use acknowledge that the software was developed
10*35095Sbostic  * by the University of California, Berkeley.  The name of the
11*35095Sbostic  * University may not be used to endorse or promote products derived
12*35095Sbostic  * from this software without specific prior written permission.
13*35095Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*35095Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*35095Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
161983Swnj  */
171983Swnj 
18*35095Sbostic #if defined(LIBC_SCCS) && !defined(lint)
19*35095Sbostic static char sccsid[] = "@(#)strcmp.c	5.3 (Berkeley) 07/18/88";
20*35095Sbostic #endif /* LIBC_SCCS and not lint */
21*35095Sbostic 
221983Swnj strcmp(s1, s2)
23*35095Sbostic 	register char *s1, *s2;
241983Swnj {
25*35095Sbostic 	for (; *s1 == *s2; ++s1, ++s2)
26*35095Sbostic 		if (!*s1)
271983Swnj 			return(0);
28*35095Sbostic 	return(*s1 - *s2);
291983Swnj }
30