Backout my libsa changes.
This commit is contained in:
parent
3ca3e51df8
commit
1e544cc5eb
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.40 1999/11/12 13:13:59 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.41 1999/11/13 21:06:46 thorpej Exp $
|
||||
|
||||
LIB= sa
|
||||
MKPIC= no
|
||||
|
@ -18,10 +18,9 @@ CPPFLAGS= -I${SADIR} ${SACPPFLAGS} ${SAMISCCPPFLAGS} \
|
|||
|
||||
# stand routines
|
||||
SRCS+= alloc.c bcmp.c bcopy.c bzero.c errno.c exit.c exec.c getfile.c gets.c \
|
||||
globals.c htonl.c htons.c inet_addr.c intoa.c memcmp.c memcpy.c \
|
||||
memset.c ntohs.c ntohl.c panic.c printf.c snprintf.c sprintf.c \
|
||||
strlen.c strcmp.c strncmp.c strcpy.c strncpy.c strcat.c strerror.c \
|
||||
subr_prf.c twiddle.c vsprintf.c checkpasswd.c
|
||||
globals.c memcmp.c memcpy.c memset.c panic.c printf.c \
|
||||
snprintf.c sprintf.c strerror.c subr_prf.c twiddle.c vsprintf.c \
|
||||
checkpasswd.c
|
||||
|
||||
# io routines
|
||||
SRCS+= closeall.c dev.c disklabel.c dkcksum.c ioctl.c nullfs.c stat.c fstat.c
|
||||
|
@ -46,12 +45,6 @@ SRCS+= nfs.c tftp.c
|
|||
.endif
|
||||
SRCS+= lfs.c ufs.c ufs_ls.c cd9660.c ustarfs.c
|
||||
|
||||
# quad routines
|
||||
SRCS+= ashrdi3.c
|
||||
|
||||
# work-around for gcc annoyance
|
||||
SRCS+= __main.c
|
||||
|
||||
# only needed during build
|
||||
libinstall::
|
||||
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
/* $NetBSD: ashrdi3.c,v 1.1 1999/11/11 20:20:35 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 "quad.h"
|
||||
|
||||
/*
|
||||
* Shift a (signed) quad value right (arithmetic shift right).
|
||||
*/
|
||||
quad_t
|
||||
__ashrdi3(a, shift)
|
||||
quad_t a;
|
||||
qshift_t shift;
|
||||
{
|
||||
union uu aa;
|
||||
|
||||
if (shift == 0)
|
||||
return(a);
|
||||
aa.q = a;
|
||||
if (shift >= LONG_BITS) {
|
||||
long s;
|
||||
|
||||
/*
|
||||
* Smear bits rightward using the machine's right-shift
|
||||
* method, whether that is sign extension or zero fill,
|
||||
* to get the `sign word' s. Note that shifting by
|
||||
* LONG_BITS is undefined, so we shift (LONG_BITS-1),
|
||||
* then 1 more, to get our answer.
|
||||
*/
|
||||
/* LINTED inherits machine dependency */
|
||||
s = (aa.sl[H] >> (LONG_BITS - 1)) >> 1;
|
||||
/* LINTED inherits machine dependency*/
|
||||
aa.ul[L] = aa.sl[H] >> (shift - LONG_BITS);
|
||||
aa.ul[H] = s;
|
||||
} else {
|
||||
aa.ul[L] = (aa.ul[L] >> shift) |
|
||||
(aa.ul[H] << (LONG_BITS - shift));
|
||||
/* LINTED inherits machine dependency */
|
||||
aa.sl[H] >>= shift;
|
||||
}
|
||||
return (aa.q);
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/* $NetBSD: htonl.c,v 1.1 1999/11/11 20:21:59 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
#undef htonl
|
||||
|
||||
u_int32_t
|
||||
htonl(x)
|
||||
u_int32_t x;
|
||||
{
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_char *s = (u_char *)&x;
|
||||
return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
|
||||
#else
|
||||
return x;
|
||||
#endif
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/* $NetBSD: htons.c,v 1.1 1999/11/11 20:21:59 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
#undef htons
|
||||
|
||||
u_int16_t
|
||||
htons(x)
|
||||
u_int16_t x;
|
||||
{
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_char *s = (u_char *) &x;
|
||||
return (u_int16_t)(s[0] << 8 | s[1]);
|
||||
#else
|
||||
return x;
|
||||
#endif
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
/* $NetBSD: inet_addr.c,v 1.1 1999/11/11 20:21:59 thorpej Exp $ */
|
||||
|
||||
/* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Derived from:
|
||||
* src/lib/libc/net/inet_pton.c
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
/*
|
||||
* Ascii internet address interpretation routine.
|
||||
* The value returned is in network order.
|
||||
*/
|
||||
u_int32_t
|
||||
inet_addr(src)
|
||||
const char *src;
|
||||
{
|
||||
u_int32_t val;
|
||||
int base, n;
|
||||
unsigned char c;
|
||||
u_int parts[4];
|
||||
register u_int *pp = parts;
|
||||
|
||||
c = *src;
|
||||
for (;;) {
|
||||
/*
|
||||
* Collect number up to ``.''.
|
||||
* Values are specified as for C:
|
||||
* 0x=hex, 0=octal, isdigit=decimal.
|
||||
*/
|
||||
if (!isdigit(c))
|
||||
return (0);
|
||||
val = 0; base = 10;
|
||||
if (c == '0') {
|
||||
c = *++src;
|
||||
if (toupper(c) == 'X')
|
||||
base = 16, c = *++src;
|
||||
else
|
||||
base = 8;
|
||||
}
|
||||
for (;;) {
|
||||
if (isdigit(c)) {
|
||||
val = (val * base) + (c - '0');
|
||||
c = *++src;
|
||||
} else if (base == 16 && isxdigit(toupper(c))) {
|
||||
val = (val << 4) |
|
||||
(toupper(c) + 10 - 'A');
|
||||
c = *++src;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
if (c == '.') {
|
||||
/*
|
||||
* Internet format:
|
||||
* a.b.c.d
|
||||
* a.b.c (with c treated as 16 bits)
|
||||
* a.b (with b treated as 24 bits)
|
||||
*/
|
||||
if (pp >= parts + 3)
|
||||
return (0);
|
||||
*pp++ = val;
|
||||
c = *++src;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Check for trailing characters.
|
||||
*/
|
||||
if (c != '\0' && !isspace(c))
|
||||
return (0);
|
||||
/*
|
||||
* Concoct the address according to
|
||||
* the number of parts specified.
|
||||
*/
|
||||
n = pp - parts + 1;
|
||||
switch (n) {
|
||||
|
||||
case 0:
|
||||
return (0); /* initial nondigit */
|
||||
|
||||
case 1: /* a -- 32 bits */
|
||||
break;
|
||||
|
||||
case 2: /* a.b -- 8.24 bits */
|
||||
if (val > 0xffffff)
|
||||
return (0);
|
||||
val |= parts[0] << 24;
|
||||
break;
|
||||
|
||||
case 3: /* a.b.c -- 8.8.16 bits */
|
||||
if (val > 0xffff)
|
||||
return (0);
|
||||
val |= (parts[0] << 24) | (parts[1] << 16);
|
||||
break;
|
||||
|
||||
case 4: /* a.b.c.d -- 8.8.8.8 bits */
|
||||
if (val > 0xff)
|
||||
return (0);
|
||||
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
|
||||
break;
|
||||
}
|
||||
|
||||
val = htonl(val);
|
||||
return (val);
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/* $NetBSD: intoa.c,v 1.1 1999/11/11 20:21:59 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* 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 the University of
|
||||
* California, Lawrence Berkeley Laboratory and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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.
|
||||
*
|
||||
* @(#) Header: net.c,v 1.9 93/08/06 19:32:15 leres Exp (LBL)
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
/* Similar to inet_ntoa() */
|
||||
const char *
|
||||
intoa(addr)
|
||||
u_int32_t addr;
|
||||
{
|
||||
char *cp;
|
||||
u_int byte;
|
||||
int n;
|
||||
static char buf[17]; /* strlen(".255.255.255.255") + 1 */
|
||||
|
||||
addr = ntohl(addr);
|
||||
cp = &buf[sizeof buf];
|
||||
*--cp = '\0';
|
||||
|
||||
n = 4;
|
||||
do {
|
||||
byte = addr & 0xff;
|
||||
*--cp = byte % 10 + '0';
|
||||
byte /= 10;
|
||||
if (byte > 0) {
|
||||
*--cp = byte % 10 + '0';
|
||||
byte /= 10;
|
||||
if (byte > 0)
|
||||
*--cp = byte + '0';
|
||||
}
|
||||
*--cp = '.';
|
||||
addr >>= 8;
|
||||
} while (--n > 0);
|
||||
|
||||
return (cp+1);
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/* $NetBSD: ntohl.c,v 1.1 1999/11/11 20:21:59 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
#undef ntohl
|
||||
|
||||
u_int32_t
|
||||
ntohl(x)
|
||||
u_int32_t x;
|
||||
{
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_char *s = (u_char *)&x;
|
||||
return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
|
||||
#else
|
||||
return x;
|
||||
#endif
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/* $NetBSD: ntohs.c,v 1.1 1999/11/11 20:22:00 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include "stand.h"
|
||||
|
||||
#undef ntohs
|
||||
|
||||
u_int16_t
|
||||
ntohs(x)
|
||||
u_int16_t x;
|
||||
{
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_char *s = (u_char *) &x;
|
||||
return (u_int16_t)(s[0] << 8 | s[1]);
|
||||
#else
|
||||
return x;
|
||||
#endif
|
||||
}
|
|
@ -1,144 +0,0 @@
|
|||
/* $NetBSD: quad.h,v 1.1 1999/11/11 20:20:35 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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.
|
||||
*
|
||||
* @(#)quad.h 8.1 (Berkeley) 6/4/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Quad arithmetic.
|
||||
*
|
||||
* This library makes the following assumptions:
|
||||
*
|
||||
* - The type long long (aka quad_t) exists.
|
||||
*
|
||||
* - A quad variable is exactly twice as long as `long'.
|
||||
*
|
||||
* - The machine's arithmetic is two's complement.
|
||||
*
|
||||
* This library can provide 128-bit arithmetic on a machine with 128-bit
|
||||
* quads and 64-bit longs, for instance, or 96-bit arithmetic on machines
|
||||
* with 48-bit longs.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
#include <limits.h>
|
||||
#else
|
||||
#include <machine/limits.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Depending on the desired operation, we view a `long long' (aka quad_t) in
|
||||
* one or more of the following formats.
|
||||
*/
|
||||
union uu {
|
||||
quad_t q; /* as a (signed) quad */
|
||||
u_quad_t uq; /* as an unsigned quad */
|
||||
long sl[2]; /* as two signed longs */
|
||||
u_long ul[2]; /* as two unsigned longs */
|
||||
};
|
||||
|
||||
/*
|
||||
* Define high and low longwords.
|
||||
*/
|
||||
#define H _QUAD_HIGHWORD
|
||||
#define L _QUAD_LOWWORD
|
||||
|
||||
/*
|
||||
* Total number of bits in a quad_t and in the pieces that make it up.
|
||||
* These are used for shifting, and also below for halfword extraction
|
||||
* and assembly.
|
||||
*/
|
||||
#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT)
|
||||
#define LONG_BITS (sizeof(long) * CHAR_BIT)
|
||||
#define HALF_BITS (sizeof(long) * CHAR_BIT / 2)
|
||||
|
||||
/*
|
||||
* Extract high and low shortwords from longword, and move low shortword of
|
||||
* longword to upper half of long, i.e., produce the upper longword of
|
||||
* ((quad_t)(x) << (number_of_bits_in_long/2)). (`x' must actually be u_long.)
|
||||
*
|
||||
* These are used in the multiply code, to split a longword into upper
|
||||
* and lower halves, and to reassemble a product as a quad_t, shifted left
|
||||
* (sizeof(long)*CHAR_BIT/2).
|
||||
*/
|
||||
#define HHALF(x) ((u_long)(x) >> HALF_BITS)
|
||||
#define LHALF(x) ((u_long)(x) & (((long)1 << HALF_BITS) - 1))
|
||||
#define LHUP(x) ((u_long)(x) << HALF_BITS)
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Compensate for gcc 1 vs gcc 2. Gcc 1 defines ?sh?di3's second argument
|
||||
* as u_quad_t, while gcc 2 correctly uses int. Unfortunately, we still use
|
||||
* both compilers.
|
||||
*/
|
||||
#if (__GNUC__ >= 2) || defined(lint)
|
||||
typedef unsigned int qshift_t;
|
||||
#else
|
||||
typedef u_quad_t qshift_t;
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
int __cmpdi2 __P((quad_t, quad_t));
|
||||
quad_t __adddi3 __P((quad_t, quad_t));
|
||||
quad_t __anddi3 __P((quad_t, quad_t));
|
||||
quad_t __ashldi3 __P((quad_t, qshift_t));
|
||||
quad_t __ashrdi3 __P((quad_t, qshift_t));
|
||||
int __cmpdi2 __P((quad_t, quad_t ));
|
||||
quad_t __divdi3 __P((quad_t, quad_t));
|
||||
quad_t __fixdfdi __P((double));
|
||||
quad_t __fixsfdi __P((float));
|
||||
u_quad_t __fixunsdfdi __P((double));
|
||||
u_quad_t __fixunssfdi __P((float));
|
||||
double __floatdidf __P((quad_t));
|
||||
float __floatdisf __P((quad_t));
|
||||
double __floatunsdidf __P((u_quad_t));
|
||||
quad_t __iordi3 __P((quad_t, quad_t));
|
||||
quad_t __lshldi3 __P((quad_t, qshift_t));
|
||||
quad_t __lshrdi3 __P((quad_t, qshift_t));
|
||||
quad_t __moddi3 __P((quad_t, quad_t));
|
||||
quad_t __muldi3 __P((quad_t, quad_t));
|
||||
quad_t __negdi2 __P((quad_t));
|
||||
quad_t __one_cmpldi2 __P((quad_t));
|
||||
u_quad_t __qdivrem __P((u_quad_t, u_quad_t, u_quad_t *));
|
||||
quad_t __subdi3 __P((quad_t, quad_t));
|
||||
int __ucmpdi2 __P((u_quad_t, u_quad_t));
|
||||
u_quad_t __udivdi3 __P((u_quad_t, u_quad_t ));
|
||||
u_quad_t __umoddi3 __P((u_quad_t, u_quad_t ));
|
||||
quad_t __xordi3 __P((quad_t, quad_t));
|
||||
__END_DECLS
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: stand.h,v 1.38 1999/11/12 12:24:42 simonb Exp $ */
|
||||
/* $NetBSD: stand.h,v 1.39 1999/11/13 21:08:32 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -201,10 +201,8 @@ extern struct open_file files[];
|
|||
|
||||
#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
|
||||
#define tolower(c) ((c) - 'A' + 'a')
|
||||
#define toupper(c) ((c) >= 'a' && (c) <= 'z' ? (c) - 'a' + 'A' : (c))
|
||||
#define isspace(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n'))
|
||||
#define isspace(c) ((c) == ' ' || (c) == '\t')
|
||||
#define isdigit(c) ((c) >= '0' && (c) <= '9')
|
||||
#define isxdigit(c) (((c) >= 'A') && ((c) <= 'F'))
|
||||
|
||||
int devopen __P((struct open_file *, const char *, char **));
|
||||
#ifdef HEAP_VARIABLE
|
||||
|
@ -228,12 +226,9 @@ int getfile __P((char *prompt, int mode));
|
|||
char *strerror __P((int));
|
||||
__dead void panic __P((const char *, ...)) __attribute__((noreturn));
|
||||
__dead void _rtt __P((void)) __attribute__((noreturn));
|
||||
int bcmp __P((const void *, const void *, size_t));
|
||||
void bcopy __P((const void *, void *, size_t));
|
||||
void bzero __P((void *, size_t));
|
||||
void *memcpy __P((void *, const void *, size_t));
|
||||
int memcmp __P((const void *, const void *, size_t));
|
||||
void *memset __P((void *, int, size_t));
|
||||
void exec __P((char *, char *, int));
|
||||
int open __P((const char *, int));
|
||||
int close __P((int));
|
||||
|
@ -243,23 +238,6 @@ ssize_t write __P((int, void *, size_t));
|
|||
off_t lseek __P((int, off_t, int));
|
||||
int ioctl __P((int, u_long, char *));
|
||||
|
||||
size_t strlen __P((const char *));
|
||||
int strcmp __P((const char *, const char *));
|
||||
int strncmp __P((const char *, const char *, size_t));
|
||||
char *strcpy __P((char *, const char *));
|
||||
char *strncpy __P((char *, const char *, size_t));
|
||||
char *strcat __P((char *, const char *));
|
||||
|
||||
u_int32_t inet_addr __P((const char *));
|
||||
const char *intoa __P((u_int32_t));
|
||||
#define inet_ntoa(a) intoa((a).s_addr)
|
||||
|
||||
u_int32_t htonl __P((u_int32_t));
|
||||
u_int16_t htons __P((u_int16_t));
|
||||
|
||||
u_int32_t ntohl __P((u_int32_t));
|
||||
u_int16_t ntohs __P((u_int16_t));
|
||||
|
||||
extern int opterr, optind, optopt, optreset;
|
||||
extern char *optarg;
|
||||
int getopt __P((int, char * const *, const char *));
|
||||
|
@ -291,13 +269,3 @@ int oclose __P((int));
|
|||
ssize_t oread __P((int, void *, size_t));
|
||||
off_t olseek __P((int, off_t, int));
|
||||
#endif
|
||||
|
||||
static __inline u_int max __P((u_int, u_int)) __attribute__((__unused__));
|
||||
|
||||
static __inline u_int
|
||||
max(a, b)
|
||||
u_int a, b;
|
||||
{
|
||||
|
||||
return (a > b ? a : b);
|
||||
}
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/* $NetBSD: strcmp.c,v 1.1 1999/11/11 18:11:25 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Chris Torek.
|
||||
*
|
||||
* 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 "stand.h"
|
||||
|
||||
/*
|
||||
* Compare strings.
|
||||
*/
|
||||
int
|
||||
strcmp(s1, s2)
|
||||
const char *s1, *s2;
|
||||
{
|
||||
while (*s1 == *s2++)
|
||||
if (*s1++ == 0)
|
||||
return (0);
|
||||
return (*(const unsigned char *)s1 - *(const unsigned char *)--s2);
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/* $NetBSD: strlen.c,v 1.1 1999/11/11 18:11:25 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 "stand.h"
|
||||
|
||||
size_t
|
||||
strlen(str)
|
||||
const char *str;
|
||||
{
|
||||
const char *s;
|
||||
|
||||
for (s = str; *s; ++s);
|
||||
return(s - str);
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/* $NetBSD: strncmp.c,v 1.1 1999/11/11 18:11:25 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. 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 the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 "stand.h"
|
||||
|
||||
int
|
||||
strncmp(s1, s2, n)
|
||||
const char *s1, *s2;
|
||||
size_t n;
|
||||
{
|
||||
|
||||
if (n == 0)
|
||||
return (0);
|
||||
do {
|
||||
if (*s1 != *s2++)
|
||||
return (*(const unsigned char *)s1 -
|
||||
*(const unsigned char *)--s2);
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
return (0);
|
||||
}
|
Loading…
Reference in New Issue