add memcmp, implemented as a wrapper around bcmp() (like memcpy() is

implemented as a wrapper around bcopy()).
This commit is contained in:
cgd 1997-01-16 04:06:15 +00:00
parent cfe73ab59b
commit b1f42c3a13
3 changed files with 52 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.13 1996/10/02 16:19:51 ws Exp $
# $NetBSD: Makefile,v 1.14 1997/01/16 04:06:17 cgd Exp $
LIB= sa
@ -15,7 +15,7 @@ CFLAGS+=$(EXTRACFLAGS)
# stand routines
SRCS+= alloc.c bcopy.c exit.c exec.c getfile.c gets.c globals.c \
memcpy.c printf.c strerror.c
memcmp.c memcpy.c printf.c strerror.c
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c ioctl.c \

48
sys/lib/libsa/memcmp.c Normal file
View File

@ -0,0 +1,48 @@
/* $NetBSD: memcmp.c,v 1.1 1997/01/16 04:06:15 cgd Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe.
* 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 for the NetBSD Project
* by Jason R. Thorpe.
* 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.
*/
#include <sys/types.h>
#include "stand.h"
/*
* Cheezy memcmp(), as a wrapper around bcmp()
*/
int
memcmp(b1, b2, len)
const void *b1, *b2;
size_t len;
{
return (bcmp(b1, b2, len));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */
/* $NetBSD: stand.h,v 1.19 1997/01/16 04:06:16 cgd Exp $ */
/*-
* Copyright (c) 1993
@ -123,6 +123,7 @@ __dead void panic __P((const char *, ...)) __attribute__((noreturn));
__dead void _rtt __P((void)) __attribute__((noreturn));
void bcopy __P((const void *, void *, size_t));
void *memcpy __P((void *, const void *, size_t));
int memcmp __P((const void *, const void *, size_t));
void exec __P((char *, char *, int));
int open __P((const char *, int));
int close __P((int));