11984Swnj /* 221396Smckusick * Copyright (c) 1980 Regents of the University of California. 321396Smckusick * All rights reserved. The Berkeley software License Agreement 421396Smckusick * specifies the terms and conditions for redistribution. 521396Smckusick */ 621396Smckusick 7*26532Sdonn #if defined(LIBC_SCCS) && !defined(lint) 8*26532Sdonn static char sccsid[] = "@(#)strcmpn.c 4.3 (Berkeley) 03/09/86"; 9*26532Sdonn #endif LIBC_SCCS and not lint 1021396Smckusick 1121396Smckusick /* 121984Swnj * Compare strings (at most n bytes): s1>s2: >0 s1==s2: 0 s1<s2: <0 131984Swnj */ 141984Swnj strcmpn(s1,s2,n)151984Swnjstrcmpn(s1, s2, n) 161984Swnj register char *s1, *s2; 171984Swnj register n; 181984Swnj { 191984Swnj 201984Swnj while (--n >= 0 && *s1 == *s2++) 211984Swnj if (*s1++ == '\0') 221984Swnj return(0); 231984Swnj return(n<0 ? 0 : *s1 - *--s2); 241984Swnj } 25