diff options
author | 1996-02-29 13:27:47 +0000 | |
---|---|---|
committer | 1996-02-29 13:27:47 +0000 | |
commit | 9f13aad21f7da8bf5c44def9529bad403f028f74 (patch) | |
tree | 31799fb4b95bdd2d530f546a64468b142a3727eb /sys/lib/libkern | |
parent | Fix typo in comment (diff) | |
download | wireguard-openbsd-9f13aad21f7da8bf5c44def9529bad403f028f74.tar.xz wireguard-openbsd-9f13aad21f7da8bf5c44def9529bad403f028f74.zip |
From NetBSD: Merge with NetBSD 960217
Diffstat (limited to 'sys/lib/libkern')
-rw-r--r-- | sys/lib/libkern/Makefile | 10 | ||||
-rw-r--r-- | sys/lib/libkern/Makefile.inc | 33 | ||||
-rw-r--r-- | sys/lib/libkern/arch/m68k/Makefile.inc | 6 | ||||
-rw-r--r-- | sys/lib/libkern/libkern.h | 8 | ||||
-rw-r--r-- | sys/lib/libkern/strncasecmp.c | 66 |
5 files changed, 97 insertions, 26 deletions
diff --git a/sys/lib/libkern/Makefile b/sys/lib/libkern/Makefile index af57b69848e..7cc5389b7d3 100644 --- a/sys/lib/libkern/Makefile +++ b/sys/lib/libkern/Makefile @@ -1,13 +1,13 @@ -# $NetBSD: Makefile,v 1.24 1995/10/20 01:10:06 cgd Exp $ +# $OpenBSD: Makefile,v 1.3 1996/02/29 13:27:47 niklas Exp $ +# $NetBSD: Makefile,v 1.25 1996/02/02 20:34:38 mycroft Exp $ LIB= kern NOPIC= -DIR=${KERNREL}${KERNDIR} +DIR= ${KERNREL}${KERNDIR} -CC= ${KERNCC} -CFLAGS= -I${DIR}/arch/${MACHINE_ARCH} \ - ${KERNCFLAGS:S/-D_KERNEL//:S@-I.@-I${KERNREL}.@g} +CPPFLAGS= -I${DIR}/arch/${MACHINE_ARCH} \ + ${KERNCPPFLAGS:S/-D_KERNEL//:S@-I.@-I${KERNREL}.@g} .if exists (${DIR}/arch/${MACHINE_ARCH}/Makefile.inc) .PATH: ${DIR}/arch/${MACHINE_ARCH} diff --git a/sys/lib/libkern/Makefile.inc b/sys/lib/libkern/Makefile.inc index 1c0a003a913..1314ceb54fa 100644 --- a/sys/lib/libkern/Makefile.inc +++ b/sys/lib/libkern/Makefile.inc @@ -1,4 +1,5 @@ -# $NetBSD: Makefile.inc,v 1.12 1995/10/07 09:56:55 mycroft Exp $ +# $OpenBSD: Makefile.inc,v 1.2 1996/02/29 13:27:48 niklas Exp $ +# $NetBSD: Makefile.inc,v 1.13 1996/02/02 20:34:41 mycroft Exp $ # # NOTE: $S must correspond to the top of the 'sys' tree @@ -9,29 +10,27 @@ KERNREL?= ../../ KERNLIB?= ${KERNDST}/libkern.o KERNLIB_PROF= ${KERNDST}/libkern.po +KERNMAKE= \ + cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \ + CC="${CC}" CFLAGS="${CFLAGS}" \ + AS="${AS}" AFLAGS="${AFLAGS}" \ + LD="${LD}" \ + MACHINE="${MACHINE}" MACHINE_ARCH="${MACHINE_ARCH}" \ + KERNCPPFLAGS="${CPPFLAGS}" \ + KERNREL="${KERNREL}" \ + KERNDIR="${KERNDIR}" + ${KERNLIB}: .NOTMAIN __always_make_kernlib @echo making sure the kern library is up to date... - @(cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \ - KERNCC="${CC}" \ - KERNCFLAGS="${CFLAGS}" \ - KERNREL="${KERNREL}" \ - KERNDIR="${KERNDIR}" libkern.o) + @${KERNMAKE} libkern.o ${KERNLIB_PROF}: .NOTMAIN __always_make_kernlib @echo making sure the profiled kern library is up to date... - @(cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \ - KERNCC="${CC}" \ - KERNCFLAGS="${CFLAGS}" \ - KERNREL="${KERNREL}" \ - KERNDIR="${KERNDIR}" libkern.po) + @${KERNMAKE} libkern.po clean:: .NOTMAIN __always_make_kernlib @echo cleaning the kern library objects - @(cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \ - KERNCC="${CC}" \ - KERNCFLAGS="${CFLAGS}" \ - KERNREL="${KERNREL}" \ - KERNDIR="${KERNDIR}" clean) + @${KERNMAKE} clean __always_make_kernlib: .NOTMAIN - @([ -d ${KERNDST} ] || mkdir -p ${KERNDST}) + @mkdir -p ${KERNDST} diff --git a/sys/lib/libkern/arch/m68k/Makefile.inc b/sys/lib/libkern/arch/m68k/Makefile.inc index 1f8844f6f87..4a82786b2e9 100644 --- a/sys/lib/libkern/arch/m68k/Makefile.inc +++ b/sys/lib/libkern/arch/m68k/Makefile.inc @@ -1,5 +1,7 @@ -# $NetBSD: Makefile.inc,v 1.5 1994/10/26 06:39:22 cgd Exp $ +# $OpenBSD: Makefile.inc,v 1.2 1996/02/29 13:28:27 niklas Exp $ +# $NetBSD: Makefile.inc,v 1.6 1996/02/06 21:22:06 christos Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ bcmp.S bzero.S ffs.S strcat.c strcmp.S strcpy.S strlen.S strncmp.S \ - strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S + strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S \ + strncasecmp.c diff --git a/sys/lib/libkern/libkern.h b/sys/lib/libkern/libkern.h index 01169467c7e..e292a3ca8b1 100644 --- a/sys/lib/libkern/libkern.h +++ b/sys/lib/libkern/libkern.h @@ -1,4 +1,5 @@ -/* $NetBSD: libkern.h,v 1.5 1995/09/23 20:35:47 leo Exp $ */ +/* $OpenBSD: libkern.h,v 1.2 1996/02/29 13:27:49 niklas Exp $ */ +/* $NetBSD: libkern.h,v 1.6 1996/02/13 23:48:26 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -111,7 +112,10 @@ u_long random __P((void)); char *rindex __P((const char *, int)); int scanc __P((u_int, u_char *, u_char *, int)); int skpc __P((int, int, char *)); +size_t strlen __P((const char *)); char *strcat __P((char *, const char *)); char *strcpy __P((char *, const char *)); -size_t strlen __P((const char *)); char *strncpy __P((char *, const char *, size_t)); +int strcmp __P((const char *, const char *)); +int strncmp __P((const char *, const char *, size_t)); +int strncasecmp __P((const char *, const char *, size_t)); diff --git a/sys/lib/libkern/strncasecmp.c b/sys/lib/libkern/strncasecmp.c new file mode 100644 index 00000000000..a0c6633adeb --- /dev/null +++ b/sys/lib/libkern/strncasecmp.c @@ -0,0 +1,66 @@ +/* $OpenBSD: strncasecmp.c,v 1.1 1996/02/29 13:27:50 niklas Exp $ */ + +/* + * Copyright (c) 1994 Christian E. Hopps + * 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 Christian E. Hopps. + * 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 AUTHOR 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. + */ +#if defined(LIBC_SCCS) && !defined(lint) +static char *rcsid = "$Id: strncasecmp.c,v 1.1 1996/02/29 13:27:50 niklas Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <string.h> + +int +strncasecmp(s1, s2, n) + const char *s1; + const char *s2; + size_t n; +{ + if (n == 0) + return 0; + + do { + unsigned char c1 = (unsigned char) *s1++; + unsigned char c2 = (unsigned char) *s2++; + + if (c1 != c2) { + if (c1 >= 'A' && c1 <= 'Z' && + c2 >= 'a' && c2 <= 'z') + c1 += 'a' - 'A'; + else if (c1 >= 'a' && c1 <= 'z' && + c2 >= 'A' && c2 <= 'Z') + c2 += 'a' - 'A'; + if (c1 != c2) + return c1 - c2; + } + if (c1 == 0) + break; + } while (--n != 0); + + return 0; +} |