From c210bb3815a99deb980a4a327b5e614d7fcde1d4 Mon Sep 17 00:00:00 2001 From: mickey Date: Thu, 6 Feb 1997 06:46:57 +0000 Subject: [PATCH] add strncmp use net/zlib.c do not compile some files w/ NO_NET --- sys/lib/libsa/Makefile | 30 ++++++++++++++++++++----- sys/lib/libsa/strncmp.c | 50 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 sys/lib/libsa/strncmp.c diff --git a/sys/lib/libsa/Makefile b/sys/lib/libsa/Makefile index 5ff86f98344..c80111a74ef 100644 --- a/sys/lib/libsa/Makefile +++ b/sys/lib/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 1997/02/06 02:56:44 downsj Exp $ +# $OpenBSD: Makefile,v 1.11 1997/02/06 06:46:57 mickey Exp $ # $NetBSD: Makefile,v 1.13 1996/10/02 16:19:51 ws Exp $ LIB= sa @@ -27,25 +27,45 @@ CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD # stand routines SRCS+= alloc.c memcpy.c exit.c exec.c getfile.c gets.c globals.c \ - printf.c strerror.c strcmp.c memset.c memcmp.c strncpy.c + printf.c strerror.c strcmp.c memset.c memcmp.c strncpy.c strncmp.c + +# math from libkern +SRCS+= divdi3.c qdivrem.c +.PATH: ${DIR}/../../lib/libkern # io routines SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c ioctl.c \ lseek.c open.c nullfs.c read.c stat.c fstat.c write.c + +# boot filesystems +SRCS+= ufs.c cd9660.c fat.c + .if defined(SA_ZLIB) SRCS+= cread.c +SRCS+= zlib.c +.PATH: ${DIR}/../../net +CFLAGS+=-DNO_DEFALTE .endif .if !defined(NO_NET) +SRCS+= nfs.c + # network routines SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c -.endif # network info services: SRCS+= bootp.c rarp.c bootparam.c -# boot filesystems -SRCS+= ufs.c nfs.c cd9660.c +.else +# C flags +CFLAGS+=-DNO_NET +.endif + +.if ${MACHINE_ARCH}=="i386" +CFLAGS+=-I${DIR}/../../arch/${MACHINE_ARCH}/stand/libsa +.PATH: ${DIR}/../../arch/${MACHINE_ARCH}/stand/libsa +.include "${DIR}/../../arch/${MACHINE_ARCH}/stand/libsa/Makefile.inc" +.endif NOPROFILE= NOPIC= diff --git a/sys/lib/libsa/strncmp.c b/sys/lib/libsa/strncmp.c new file mode 100644 index 00000000000..d55d73f9a3f --- /dev/null +++ b/sys/lib/libsa/strncmp.c @@ -0,0 +1,50 @@ +/* $OpenBSD: strncmp.c,v 1.1 1997/02/06 06:47:00 mickey Exp $ */ + +/*- + * Copyright (c) 1996 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +#include "stand.h" + +int +strncmp(s1, s2, len) + register const char *s1; + register const char *s2; + register size_t len; +{ + if (len-- == 0) + return 0; + + while(*s1 && *s2 && len-- && *s1 == *s2) + s1++, s2++; + return *s1 - *s2; +} -- 2.20.1