1a9643ea8Slogwang /*- 2*22ce4affSfengbojiang * SPDX-License-Identifier: BSD-3-Clause 3*22ce4affSfengbojiang * 4a9643ea8Slogwang * Copyright (c) 1990, 1993 5a9643ea8Slogwang * The Regents of the University of California. All rights reserved. 6a9643ea8Slogwang * 7a9643ea8Slogwang * This code is derived from software contributed to Berkeley by 8a9643ea8Slogwang * Chris Torek. 9a9643ea8Slogwang * 10a9643ea8Slogwang * Redistribution and use in source and binary forms, with or without 11a9643ea8Slogwang * modification, are permitted provided that the following conditions 12a9643ea8Slogwang * are met: 13a9643ea8Slogwang * 1. Redistributions of source code must retain the above copyright 14a9643ea8Slogwang * notice, this list of conditions and the following disclaimer. 15a9643ea8Slogwang * 2. Redistributions in binary form must reproduce the above copyright 16a9643ea8Slogwang * notice, this list of conditions and the following disclaimer in the 17a9643ea8Slogwang * documentation and/or other materials provided with the distribution. 18*22ce4affSfengbojiang * 3. Neither the name of the University nor the names of its contributors 19a9643ea8Slogwang * may be used to endorse or promote products derived from this software 20a9643ea8Slogwang * without specific prior written permission. 21a9643ea8Slogwang * 22a9643ea8Slogwang * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23a9643ea8Slogwang * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24a9643ea8Slogwang * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25a9643ea8Slogwang * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26a9643ea8Slogwang * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27a9643ea8Slogwang * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28a9643ea8Slogwang * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29a9643ea8Slogwang * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30a9643ea8Slogwang * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31a9643ea8Slogwang * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32a9643ea8Slogwang * SUCH DAMAGE. 33a9643ea8Slogwang */ 34a9643ea8Slogwang 35a9643ea8Slogwang #include <sys/cdefs.h> 36a9643ea8Slogwang __FBSDID("$FreeBSD$"); 37a9643ea8Slogwang 38a9643ea8Slogwang #include <sys/libkern.h> 39a9643ea8Slogwang 40a9643ea8Slogwang /* 41a9643ea8Slogwang * Compare strings. 42a9643ea8Slogwang */ 43a9643ea8Slogwang int 44*22ce4affSfengbojiang (strcmp)(const char *s1, const char *s2) 45a9643ea8Slogwang { 46a9643ea8Slogwang while (*s1 == *s2++) 47*22ce4affSfengbojiang if (*s1++ == '\0') 48a9643ea8Slogwang return (0); 49a9643ea8Slogwang return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1)); 50a9643ea8Slogwang } 51