Add local.h for local prototypes.

Fix namespace issues for strtoq and strtouq
Fix gcc warnings.
Fix RCSID's
This commit is contained in:
christos 1997-07-13 20:16:31 +00:00
parent 0c339c443a
commit bd9067774f
41 changed files with 317 additions and 131 deletions

View File

@ -1,10 +1,11 @@
# $NetBSD: Makefile.inc,v 1.31 1997/04/23 01:17:59 mrg Exp $
# $NetBSD: Makefile.inc,v 1.32 1997/07/13 20:16:31 christos Exp $
# from: @(#)Makefile.inc 5.6 (Berkeley) 6/4/91
# stdlib sources
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/stdlib ${.CURDIR}/stdlib
SRCS+= a64l.c abort.c atexit.c atoi.c atof.c atol.c bsearch.c calloc.c \
SRCS+= _strtoq.c _strtouq.c a64l.c abort.c atexit.c atoi.c atof.c atol.c \
bsearch.c calloc.c \
exit.c getenv.c getopt.c heapsort.c l64a.c malloc.c merge.c \
multibyte.c putenv.c qsort.c radixsort.c rand.c rand_r.c random.c \
realpath.c \

40
lib/libc/stdlib/_strtoq.c Normal file
View File

@ -0,0 +1,40 @@
/* $NetBSD: _strtoq.c,v 1.1 1997/07/13 20:16:31 christos Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. 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 Christos Zoulas.
* 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/cdefs.h>
#ifdef __indr_reference
__indr_reference(_strtoq, strtoq);
#else
#define _strtoq strtoq
#include "strtoq.c"
#endif

View File

@ -0,0 +1,40 @@
/* $NetBSD: _strtouq.c,v 1.1 1997/07/13 20:16:32 christos Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. 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 Christos Zoulas.
* 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/cdefs.h>
#ifdef __indr_reference
__indr_reference(_strtouq, strtouq);
#else
#define _strtouq strtouq
#include "strtouq.c"
#endif

View File

@ -3,10 +3,13 @@
* Public domain.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$NetBSD: a64l.c,v 1.3 1995/05/11 23:03:44 jtc Exp $";
__RCSID("$NetBSD: a64l.c,v 1.4 1997/07/13 20:16:33 christos Exp $");
#endif
#include <stdlib.h>
long
a64l(s)
const char *s;

View File

@ -1,4 +1,4 @@
/* $NetBSD: abort.c,v 1.8 1997/05/19 02:18:14 kleink Exp $ */
/* $NetBSD: abort.c,v 1.9 1997/07/13 20:16:33 christos Exp $ */
/*
* Copyright (c) 1985 Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)abort.c 5.11 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: abort.c,v 1.8 1997/05/19 02:18:14 kleink Exp $";
__RCSID("$NetBSD: abort.c,v 1.9 1997/07/13 20:16:33 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -45,7 +46,7 @@ static char *rcsid = "$NetBSD: abort.c,v 1.8 1997/05/19 02:18:14 kleink Exp $";
#include <stdlib.h>
#include <unistd.h>
void (*__cleanup)();
extern void (*__cleanup) __P((void));
static int aborting = 0;
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: abs.c,v 1.4 1995/12/28 08:51:59 thorpej Exp $ */
/* $NetBSD: abs.c,v 1.5 1997/07/13 20:16:34 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)abs.c 5.2 (Berkeley) 5/17/90";
#else
static char *rcsid = "$NetBSD: abs.c,v 1.4 1995/12/28 08:51:59 thorpej Exp $";
__RCSID("$NetBSD: abs.c,v 1.5 1997/07/13 20:16:34 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: atexit.c,v 1.6 1995/12/28 08:52:02 thorpej Exp $ */
/* $NetBSD: atexit.c,v 1.7 1997/07/13 20:16:35 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)atexit.c 5.2 (Berkeley) 11/14/90";
#else
static char *rcsid = "$NetBSD: atexit.c,v 1.6 1995/12/28 08:52:02 thorpej Exp $";
__RCSID("$NetBSD: atexit.c,v 1.7 1997/07/13 20:16:35 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -54,7 +55,7 @@ struct atexit *__atexit;
*/
int
atexit(fn)
void (*fn)();
void (*fn) __P((void));
{
static struct atexit __atexit0; /* one guaranteed table */
register struct atexit *p;

View File

@ -1,4 +1,4 @@
/* $NetBSD: atexit.h,v 1.4 1995/12/28 08:52:03 thorpej Exp $ */
/* $NetBSD: atexit.h,v 1.5 1997/07/13 20:16:36 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -41,7 +41,7 @@
struct atexit {
struct atexit *next; /* next in list */
int ind; /* next index in this table */
void (*fns[ATEXIT_SIZE])(); /* the table itself */
void (*fns[ATEXIT_SIZE]) __P((void)); /* the table itself */
};
extern struct atexit *__atexit; /* points to head of LIFO stack */

View File

@ -1,4 +1,4 @@
/* $NetBSD: atof.c,v 1.7 1995/12/28 08:52:05 thorpej Exp $ */
/* $NetBSD: atof.c,v 1.8 1997/07/13 20:16:36 christos Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)atof.c 5.3 (Berkeley) 1/8/93";
#else
static char *rcsid = "$NetBSD: atof.c,v 1.7 1995/12/28 08:52:05 thorpej Exp $";
__RCSID("$NetBSD: atof.c,v 1.8 1997/07/13 20:16:36 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: atoi.c,v 1.6 1995/12/28 08:52:06 thorpej Exp $ */
/* $NetBSD: atoi.c,v 1.7 1997/07/13 20:16:37 christos Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)atoi.c 5.7 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: atoi.c,v 1.6 1995/12/28 08:52:06 thorpej Exp $";
__RCSID("$NetBSD: atoi.c,v 1.7 1997/07/13 20:16:37 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: atol.c,v 1.5 1995/12/28 08:52:08 thorpej Exp $ */
/* $NetBSD: atol.c,v 1.6 1997/07/13 20:16:38 christos Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)atol.c 5.7 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: atol.c,v 1.5 1995/12/28 08:52:08 thorpej Exp $";
__RCSID("$NetBSD: atol.c,v 1.6 1997/07/13 20:16:38 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: bsearch.c,v 1.5 1995/12/28 08:52:10 thorpej Exp $ */
/* $NetBSD: bsearch.c,v 1.6 1997/07/13 20:16:38 christos Exp $ */
/*
* Copyright (c) 1990 Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)bsearch.c 5.4 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: bsearch.c,v 1.5 1995/12/28 08:52:10 thorpej Exp $";
__RCSID("$NetBSD: bsearch.c,v 1.6 1997/07/13 20:16:38 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: calloc.c,v 1.6 1995/12/28 08:52:12 thorpej Exp $ */
/* $NetBSD: calloc.c,v 1.7 1997/07/13 20:16:39 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)calloc.c 5.6 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: calloc.c,v 1.6 1995/12/28 08:52:12 thorpej Exp $";
__RCSID("$NetBSD: calloc.c,v 1.7 1997/07/13 20:16:39 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -52,7 +53,7 @@ calloc(num, size)
register void *p;
size *= num;
if (p = malloc(size))
if ((p = malloc(size)) != NULL)
memset(p, '\0', size);
return(p);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: div.c,v 1.4 1995/12/28 08:52:13 thorpej Exp $ */
/* $NetBSD: div.c,v 1.5 1997/07/13 20:16:40 christos Exp $ */
/*
* Copyright (c) 1990 Regents of the University of California.
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)div.c 5.2 (Berkeley) 4/16/91";
#else
static char *rcsid = "$NetBSD: div.c,v 1.4 1995/12/28 08:52:13 thorpej Exp $";
__RCSID("$NetBSD: div.c,v 1.5 1997/07/13 20:16:40 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: exit.c,v 1.4 1995/12/28 08:52:15 thorpej Exp $ */
/* $NetBSD: exit.c,v 1.5 1997/07/13 20:16:41 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)exit.c 5.4 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: exit.c,v 1.4 1995/12/28 08:52:15 thorpej Exp $";
__RCSID("$NetBSD: exit.c,v 1.5 1997/07/13 20:16:41 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -45,7 +46,7 @@ static char *rcsid = "$NetBSD: exit.c,v 1.4 1995/12/28 08:52:15 thorpej Exp $";
#include <unistd.h>
#include "atexit.h"
void (*__cleanup)();
void (*__cleanup) __P((void));
/*
* Exit, flushing stdio buffers if necessary.

View File

@ -1,4 +1,4 @@
/* $NetBSD: getenv.c,v 1.7 1996/12/20 20:32:54 cgd Exp $ */
/* $NetBSD: getenv.c,v 1.8 1997/07/13 20:16:41 christos Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
@ -33,16 +33,18 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)getenv.c 5.8 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: getenv.c,v 1.7 1996/12/20 20:32:54 cgd Exp $";
__RCSID("$NetBSD: getenv.c,v 1.8 1997/07/13 20:16:41 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include <stdlib.h>
#include <string.h>
#include "local.h"
/*
* getenv --
@ -53,7 +55,6 @@ getenv(name)
const char *name;
{
int offset;
char *__findenv();
return(__findenv(name, &offset));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: getopt.c,v 1.8 1995/12/28 08:52:19 thorpej Exp $ */
/* $NetBSD: getopt.c,v 1.9 1997/07/13 20:16:42 christos Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "from: @(#)getopt.c 8.2 (Berkeley) 4/2/94";
#else
static char *rcsid = "$NetBSD: getopt.c,v 1.8 1995/12/28 08:52:19 thorpej Exp $";
__RCSID("$NetBSD: getopt.c,v 1.9 1997/07/13 20:16:42 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: heapsort.c,v 1.6 1995/12/28 08:52:20 thorpej Exp $ */
/* $NetBSD: heapsort.c,v 1.7 1997/07/13 20:16:43 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "from: @(#)heapsort.c 8.1 (Berkeley) 6/4/93";
#else
static char *rcsid = "$NetBSD: heapsort.c,v 1.6 1995/12/28 08:52:20 thorpej Exp $";
__RCSID("$NetBSD: heapsort.c,v 1.7 1997/07/13 20:16:43 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -3,8 +3,9 @@
* Public domain.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$NetBSD: l64a.c,v 1.4 1995/05/11 23:03:44 jtc Exp $";
__RCSID("$NetBSD: l64a.c,v 1.5 1997/07/13 20:16:44 christos Exp $");
#endif
#include <stdlib.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: labs.c,v 1.4 1995/12/28 08:52:23 thorpej Exp $ */
/* $NetBSD: labs.c,v 1.5 1997/07/13 20:16:44 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)labs.c 5.2 (Berkeley) 5/17/90";
#else
static char *rcsid = "$NetBSD: labs.c,v 1.4 1995/12/28 08:52:23 thorpej Exp $";
__RCSID("$NetBSD: labs.c,v 1.5 1997/07/13 20:16:44 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ldiv.c,v 1.4 1995/12/28 08:52:24 thorpej Exp $ */
/* $NetBSD: ldiv.c,v 1.5 1997/07/13 20:16:45 christos Exp $ */
/*
* Copyright (c) 1990 Regents of the University of California.
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)ldiv.c 5.2 (Berkeley) 4/16/91";
#else
static char *rcsid = "$NetBSD: ldiv.c,v 1.4 1995/12/28 08:52:24 thorpej Exp $";
__RCSID("$NetBSD: ldiv.c,v 1.5 1997/07/13 20:16:45 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

32
lib/libc/stdlib/local.h Normal file
View File

@ -0,0 +1,32 @@
/* $NetBSD: local.h,v 1.1 1997/07/13 20:16:46 christos Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. 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 Christos Zoulas.
* 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.
*/
char *__findenv __P((const char *, int *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: malloc.c,v 1.8 1997/04/07 03:12:14 christos Exp $ */
/* $NetBSD: malloc.c,v 1.9 1997/07/13 20:16:47 christos Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)malloc.c 5.11 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: malloc.c,v 1.8 1997/04/07 03:12:14 christos Exp $";
__RCSID("$NetBSD: malloc.c,v 1.9 1997/07/13 20:16:47 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -52,6 +53,9 @@ static char *rcsid = "$NetBSD: malloc.c,v 1.8 1997/04/07 03:12:14 christos Exp $
* This is designed for use in a virtual memory environment.
*/
#if defined(DEBUG) || defined(RCHECK) || defined(MSTATS)
#include <stdio.h>
#endif
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
@ -59,8 +63,6 @@ static char *rcsid = "$NetBSD: malloc.c,v 1.8 1997/04/07 03:12:14 christos Exp $
#define NULL 0
static void morecore();
static int findbucket();
/*
* The overhead on a block is at least 4 bytes. When free, this space
@ -104,7 +106,6 @@ union overhead {
*/
#define NBUCKETS 30
static union overhead *nextf[NBUCKETS];
extern char *sbrk();
static int pagesz; /* page size */
static int pagebucket; /* page size bucket */
@ -118,9 +119,17 @@ static u_int nmalloc[NBUCKETS];
#include <stdio.h>
#endif
static void morecore __P((int));
static int findbucket __P((union overhead *, int));
#ifdef MSTATS
void mstats __P((char *));
#endif
#if defined(DEBUG) || defined(RCHECK)
#define ASSERT(p) if (!(p)) botch(__STRING(p))
#include <stdio.h>
static botch __P((char *));
static
botch(s)
char *s;
@ -378,7 +387,7 @@ realloc(cp, nbytes)
* header starts at ``freep''. If srchlen is -1 search the whole list.
* Return bucket number, or -1 if not found.
*/
static
static int
findbucket(freep, srchlen)
union overhead *freep;
int srchlen;
@ -405,6 +414,7 @@ findbucket(freep, srchlen)
* for each size category, the second showing the number of mallocs -
* frees for each size category.
*/
void
mstats(s)
char *s;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: merge.c,v 1.3 1995/12/28 08:52:28 thorpej Exp $ */
/* $NetBSD: merge.c,v 1.4 1997/07/13 20:16:47 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "from: @(#)merge.c 8.2 (Berkeley) 2/14/94";
#else
static char *rcsid = "$NetBSD: merge.c,v 1.3 1995/12/28 08:52:28 thorpej Exp $";
__RCSID("$NetBSD: merge.c,v 1.4 1997/07/13 20:16:47 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -64,8 +65,10 @@ static char *rcsid = "$NetBSD: merge.c,v 1.3 1995/12/28 08:52:28 thorpej Exp $";
#include <stdlib.h>
#include <string.h>
static void setup __P((u_char *, u_char *, size_t, size_t, int (*)()));
static void insertionsort __P((u_char *, size_t, size_t, int (*)()));
static void setup __P((u_char *, u_char *, size_t, size_t,
int (*)(const void *, const void *)));
static void insertionsort __P((u_char *, size_t, size_t,
int (*)(const void *, const void *)));
#define ISIZE sizeof(int)
#define PSIZE sizeof(u_char *)
@ -153,7 +156,10 @@ mergesort(base, nmemb, size, cmp)
sense = 0;
}
if (!big) { /* here i = 0 */
LINEAR: while ((b += size) < t && cmp(q, b) >sense)
#if 0
LINEAR:
#endif
while ((b += size) < t && cmp(q, b) >sense)
if (++i == 6) {
big = 1;
goto EXPONENTIAL;
@ -174,7 +180,10 @@ EXPONENTIAL: for (i = size; ; i <<= 1)
goto FASTCASE;
} else
b = p;
SLOWCASE: while (t > b+size) {
#if 0
SLOWCASE:
#endif
while (t > b+size) {
i = (((t - b) / size) >> 1) * size;
if ((*cmp)(q, p = b + i) <= sense)
t = p;

View File

@ -1,4 +1,4 @@
/* $NetBSD: multibyte.c,v 1.5 1995/12/28 08:52:30 thorpej Exp $ */
/* $NetBSD: multibyte.c,v 1.6 1997/07/13 20:16:48 christos Exp $ */
/*
* Copyright (c) 1991 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)multibyte.c 5.1 (Berkeley) 2/18/91";
#else
static char *rcsid = "$NetBSD: multibyte.c,v 1.5 1995/12/28 08:52:30 thorpej Exp $";
__RCSID("$NetBSD: multibyte.c,v 1.6 1997/07/13 20:16:48 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: putenv.c,v 1.5 1995/12/28 08:52:31 thorpej Exp $ */
/* $NetBSD: putenv.c,v 1.6 1997/07/13 20:16:49 christos Exp $ */
/*-
* Copyright (c) 1988 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)putenv.c 5.4 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: putenv.c,v 1.5 1995/12/28 08:52:31 thorpej Exp $";
__RCSID("$NetBSD: putenv.c,v 1.6 1997/07/13 20:16:49 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: qabs.c,v 1.2 1995/12/28 08:52:32 thorpej Exp $ */
/* $NetBSD: qabs.c,v 1.3 1997/07/13 20:16:50 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)labs.c 5.2 (Berkeley) 5/17/90";
#else
static char *rcsid = "$NetBSD: qabs.c,v 1.2 1995/12/28 08:52:32 thorpej Exp $";
__RCSID("$NetBSD: qabs.c,v 1.3 1997/07/13 20:16:50 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: qdiv.c,v 1.2 1995/12/28 08:52:34 thorpej Exp $ */
/* $NetBSD: qdiv.c,v 1.3 1997/07/13 20:16:51 christos Exp $ */
/*
* Copyright (c) 1990 Regents of the University of California.
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)ldiv.c 5.2 (Berkeley) 4/16/91";
#else
static char *rcsid = "$NetBSD: qdiv.c,v 1.2 1995/12/28 08:52:34 thorpej Exp $";
__RCSID("$NetBSD: qdiv.c,v 1.3 1997/07/13 20:16:51 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: qsort.c,v 1.7 1997/06/19 07:41:33 mikel Exp $ */
/* $NetBSD: qsort.c,v 1.8 1997/07/13 20:16:51 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -33,18 +33,20 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
#else
static char *rcsid = "$NetBSD: qsort.c,v 1.7 1997/06/19 07:41:33 mikel Exp $";
__RCSID("$NetBSD: qsort.c,v 1.8 1997/07/13 20:16:51 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <stdlib.h>
static __inline char *med3 __P((char *, char *, char *, int (*)()));
static __inline char *med3 __P((char *, char *, char *,
int (*)(const void *, const void *)));
static __inline void swapfunc __P((char *, char *, int, int));
#define min(a, b) (a) < (b) ? a : b
@ -90,7 +92,7 @@ swapfunc(a, b, n, swaptype)
static __inline char *
med3(a, b, c, cmp)
char *a, *b, *c;
int (*cmp)();
int (*cmp) __P((const void *, const void *));
{
return cmp(a, b) < 0 ?
(cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a ))
@ -101,7 +103,7 @@ void
qsort(a, n, es, cmp)
void *a;
size_t n, es;
int (*cmp)();
int (*cmp) __P((const void *, const void *));
{
char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
int d, r, swaptype, swap_cnt;

View File

@ -1,4 +1,4 @@
/* $NetBSD: radixsort.c,v 1.7 1996/12/19 07:56:34 cgd Exp $ */
/* $NetBSD: radixsort.c,v 1.8 1997/07/13 20:16:52 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "from: @(#)radixsort.c 8.1 (Berkeley) 6/4/93";
#else
static char *rcsid = "$NetBSD: radixsort.c,v 1.7 1996/12/19 07:56:34 cgd Exp $";
__RCSID("$NetBSD: radixsort.c,v 1.8 1997/07/13 20:16:52 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rand.c,v 1.5 1995/12/28 08:52:40 thorpej Exp $ */
/* $NetBSD: rand.c,v 1.6 1997/07/13 20:16:53 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)rand.c 5.6 (Berkeley) 6/24/91";
#else
static char *rcsid = "$NetBSD: rand.c,v 1.5 1995/12/28 08:52:40 thorpej Exp $";
__RCSID("$NetBSD: rand.c,v 1.6 1997/07/13 20:16:53 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rand_r.c,v 1.1 1996/11/19 02:56:38 jtc Exp $ */
/* $NetBSD: rand_r.c,v 1.2 1997/07/13 20:16:54 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)rand.c 5.6 (Berkeley) 6/24/91";
#else
static char *rcsid = "$NetBSD: rand_r.c,v 1.1 1996/11/19 02:56:38 jtc Exp $";
__RCSID("$NetBSD: rand_r.c,v 1.2 1997/07/13 20:16:54 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: random.c,v 1.4 1995/12/28 08:52:43 thorpej Exp $ */
/* $NetBSD: random.c,v 1.5 1997/07/13 20:16:54 christos Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)random.c 5.9 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: random.c,v 1.4 1995/12/28 08:52:43 thorpej Exp $";
__RCSID("$NetBSD: random.c,v 1.5 1997/07/13 20:16:54 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: realpath.c,v 1.3 1997/01/23 14:02:19 mrg Exp $ */
/* $NetBSD: realpath.c,v 1.4 1997/07/13 20:16:55 christos Exp $ */
/*
* Copyright (c) 1994
@ -36,11 +36,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "from: @(#)realpath.c 8.1 (Berkeley) 2/16/94";
#else
static char *rcsid = "$NetBSD: realpath.c,v 1.3 1997/01/23 14:02:19 mrg Exp $";
__RCSID("$NetBSD: realpath.c,v 1.4 1997/07/13 20:16:55 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */

View File

@ -1,4 +1,4 @@
/* $NetBSD: setenv.c,v 1.8 1995/12/28 08:52:49 thorpej Exp $ */
/* $NetBSD: setenv.c,v 1.9 1997/07/13 20:16:56 christos Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
@ -33,16 +33,18 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)setenv.c 5.6 (Berkeley) 6/4/91";
#else
static char *rcsid = "$NetBSD: setenv.c,v 1.8 1995/12/28 08:52:49 thorpej Exp $";
__RCSID("$NetBSD: setenv.c,v 1.9 1997/07/13 20:16:56 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include <stdlib.h>
#include <string.h>
#include "local.h"
/*
* setenv --
@ -59,7 +61,6 @@ setenv(name, value, rewrite)
static int alloced; /* if allocated space before */
register char *C;
int l_value, offset;
char *__findenv();
if (*value == '=') /* no `=' in value */
++value;
@ -68,7 +69,7 @@ setenv(name, value, rewrite)
if (!rewrite)
return (0);
if (strlen(C) >= l_value) { /* old larger; copy over */
while (*C++ = *value++);
while ((*C++ = *value++) != '\0');
return (0);
}
} else { /* create new slot */
@ -100,7 +101,7 @@ setenv(name, value, rewrite)
return (-1);
for (C = environ[offset]; (*C = *name++) && *C != '='; ++C)
;
for (*C++ = '='; *C++ = *value++; )
for (*C++ = '='; (*C++ = *value++) != '\0'; )
;
return (0);
}
@ -116,7 +117,6 @@ unsetenv(name)
extern char **environ;
register char **P;
int offset;
char *__findenv();
while (__findenv(name, &offset)) /* if set multiple times */
for (P = &environ[offset];; ++P)

View File

@ -1,4 +1,4 @@
/* $NetBSD: strtod.c,v 1.24 1997/03/29 21:05:22 thorpej Exp $ */
/* $NetBSD: strtod.c,v 1.25 1997/07/13 20:16:58 christos Exp $ */
/****************************************************************
*
@ -91,8 +91,9 @@
* directly -- and assumed always to succeed.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$NetBSD: strtod.c,v 1.24 1997/03/29 21:05:22 thorpej Exp $";
__RCSID("$NetBSD: strtod.c,v 1.25 1997/07/13 20:16:58 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \
@ -140,6 +141,7 @@ static char *rcsid = "$NetBSD: strtod.c,v 1.24 1997/03/29 21:05:22 thorpej Exp $
#include "memory.h"
#endif
#endif
#include "extern.h"
#ifdef MALLOC
#ifdef KR_headers
@ -392,7 +394,7 @@ Balloc
int x;
Bigint *rv;
if (rv = freelist[k]) {
if ((rv = freelist[k]) != NULL) {
freelist[k] = rv->next;
}
else {
@ -640,7 +642,7 @@ mult
xc0 = c->x;
#ifdef Pack_32
for(; xb < xbe; xb++, xc0++) {
if (y = *xb & 0xffff) {
if ((y = *xb & 0xffff) != 0) {
x = xa;
xc = xc0;
carry = 0;
@ -654,7 +656,7 @@ mult
while(x < xae);
*xc = carry;
}
if (y = *xb >> 16) {
if ((y = *xb >> 16) != 0) {
x = xa;
xc = xc0;
carry = 0;
@ -705,7 +707,7 @@ pow5mult
int i;
static int p05[3] = { 5, 25, 125 };
if (i = k & 3)
if ((i = k & 3) != 0)
b = multadd(b, p05[i-1], 0);
if (!(k >>= 2))
@ -768,7 +770,7 @@ lshift
z = *x++ >> k1;
}
while(x < xe);
if (*x1 = z)
if ((*x1 = z) != 0)
++n1;
}
#else
@ -939,7 +941,7 @@ ulp
else {
word0(a) = 0;
L -= Exp_shift;
word1(a) = L >= 31 ? 1 : 1 << 31 - L;
word1(a) = L >= 31 ? 1 : 1 << (31 - L);
}
}
#endif
@ -974,16 +976,16 @@ b2d
*e = 32 - k;
#ifdef Pack_32
if (k < Ebits) {
d0 = Exp_1 | y >> Ebits - k;
d0 = Exp_1 | y >> (Ebits - k);
w = xa > xa0 ? *--xa : 0;
d1 = y << (32-Ebits) + k | w >> Ebits - k;
d1 = y << ((32-Ebits) + k) | w >> (Ebits - k);
goto ret_d;
}
z = xa > xa0 ? *--xa : 0;
if (k -= Ebits) {
d0 = Exp_1 | y << k | z >> 32 - k;
d0 = Exp_1 | y << k | z >> (32 - k);
y = xa > xa0 ? *--xa : 0;
d1 = z << k | y >> 32 - k;
d1 = z << k | y >> (32 - k);
}
else {
d0 = Exp_1 | y;
@ -1051,13 +1053,13 @@ d2b
z |= Exp_msk11;
#endif
#else
if (de = (int)(d0 >> Exp_shift))
if ((de = (int)(d0 >> Exp_shift)) != 0)
z |= Exp_msk1;
#endif
#ifdef Pack_32
if (y = d1) {
if (k = lo0bits(&y)) {
x[0] = y | z << 32 - k;
if ((y = d1) != 0) {
if ((k = lo0bits(&y)) != 0) {
x[0] = y | z << (32 - k);
z >>= k;
}
else
@ -1226,7 +1228,8 @@ strtod
double aadj, aadj1, adj, rv, rv0;
Long L;
ULong y, z;
Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
Bigint *bb1, *bd0;
Bigint *bb = NULL, *bd = NULL, *bs = NULL, *delta = NULL;/* pacify gcc */
#ifndef KR_headers
CONST char decimal_point = localeconv()->decimal_point[0];
@ -1408,7 +1411,7 @@ strtod
/* Get starting approximation = rv * 10**e1 */
if (e1 > 0) {
if (i = e1 & 15)
if ((i = e1 & 15) != 0)
rv *= tens[i];
if (e1 &= ~15) {
if (e1 > DBL_MAX_10_EXP) {
@ -1454,7 +1457,7 @@ strtod
}
else if (e1 < 0) {
e1 = -e1;
if (i = e1 & 15)
if ((i = e1 & 15) != 0)
rv /= tens[i];
if (e1 &= ~15) {
e1 >>= 4;
@ -1936,15 +1939,17 @@ __dtoa
to hold the suppressed trailing zeros.
*/
int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
int bbits, b2, b5, be, dig, i, ieps, ilim0,
j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
spec_case, try_quick;
try_quick;
int ilim = 0, ilim1 = 0, spec_case = 0; /* pacify gcc */
Long L;
#ifndef Sudden_Underflow
int denorm;
ULong x;
#endif
Bigint *b, *b1, *delta, *mlo, *mhi, *S;
Bigint *b, *b1, *delta, *mhi, *S;
Bigint *mlo = NULL; /* pacify gcc */
double d2, ds, eps;
char *s, *s0;
static Bigint *result;
@ -2003,7 +2008,7 @@ __dtoa
#ifdef Sudden_Underflow
i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
#else
if (i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) {
if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) != 0) {
#endif
d2 = d;
word0(d2) &= Frac_mask1;
@ -2047,8 +2052,8 @@ __dtoa
/* d is denormalized */
i = bbits + be + (Bias + (P-1) - 1);
x = i > 32 ? word0(d) << 64 - i | word1(d) >> i - 32
: word1(d) << 32 - i;
x = i > 32 ? word0(d) << (64 - i) | word1(d) >> (i - 32)
: word1(d) << (32 - i);
d2 = x;
word0(d2) -= 31*Exp_msk1; /* adjust exponent */
i -= (Bias + (P-1) - 1) + 1;
@ -2148,7 +2153,7 @@ __dtoa
}
d /= ds;
}
else if (j1 = -k) {
else if ((j1 = -k) != 0) {
d *= tens[j1 & 0xf];
for(j = j1 >> 4; j; j >>= 1, i++)
if (j & 1) {
@ -2248,7 +2253,7 @@ __dtoa
*s++ = '0' + (int)L;
if (i == ilim) {
d += d;
if (d > ds || d == ds && L & 1) {
if (d > ds || (d == ds && L & 1)) {
bump_up:
while(*--s == '9')
if (s == s0) {
@ -2313,7 +2318,7 @@ __dtoa
Bfree(b);
b = b1;
}
if (j = b5 - m5)
if ((j = b5 - m5) != 0)
b = pow5mult(b, j);
}
else
@ -2348,7 +2353,7 @@ __dtoa
* can do shifts and ors to compute the numerator for q.
*/
#ifdef Pack_32
if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f)
if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) != 0)
i = 32 - i;
#else
if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf)
@ -2425,15 +2430,15 @@ __dtoa
goto ret;
}
#endif
if (j < 0 || j == 0 && !mode
if (j < 0 || (j == 0 && !mode
#ifndef ROUND_BIASED
&& !(word1(d) & 1)
#endif
) {
)) {
if (j1 > 0) {
b = lshift(b, 1);
j1 = cmp(b, S);
if ((j1 > 0 || j1 == 0 && dig & 1)
if ((j1 > 0 || (j1 == 0 && dig & 1))
&& dig++ == '9')
goto round_9_up;
}
@ -2473,7 +2478,7 @@ __dtoa
b = lshift(b, 1);
j = cmp(b, S);
if (j > 0 || j == 0 && dig & 1) {
if (j > 0 || (j == 0 && dig & 1)) {
roundoff:
while(*--s == '9')
if (s == s0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: strtol.c,v 1.9 1996/07/20 01:00:55 jtc Exp $ */
/* $NetBSD: strtol.c,v 1.10 1997/07/13 20:16:59 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)strtol.c 5.4 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: strtol.c,v 1.9 1996/07/20 01:00:55 jtc Exp $";
__RCSID("$NetBSD: strtol.c,v 1.10 1997/07/13 20:16:59 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -129,7 +130,7 @@ strtol(nptr, endptr, base)
if (any < 0)
continue;
if (neg) {
if (acc < cutoff || acc == cutoff && c > cutlim) {
if (acc < cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = LONG_MIN;
errno = ERANGE;
@ -139,7 +140,7 @@ strtol(nptr, endptr, base)
acc -= c;
}
} else {
if (acc > cutoff || acc == cutoff && c > cutlim) {
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = LONG_MAX;
errno = ERANGE;

View File

@ -1,3 +1,5 @@
/* $NetBSD: strtoq.c,v 1.7 1997/07/13 20:17:01 christos Exp $ */
/*-
* Copyright (c) 1992 The Regents of the University of California.
* All rights reserved.
@ -31,10 +33,16 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)strtoq.c 5.1 (Berkeley) 6/26/92";
#else
__RCSID("$NetBSD: strtoq.c,v 1.7 1997/07/13 20:17:01 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <ctype.h>
@ -49,7 +57,7 @@ static char sccsid[] = "@(#)strtoq.c 5.1 (Berkeley) 6/26/92";
* alphabets and digits are each contiguous.
*/
quad_t
strtoq(nptr, endptr, base)
_strtoq(nptr, endptr, base)
const char *nptr;
char **endptr;
register int base;
@ -125,7 +133,7 @@ strtoq(nptr, endptr, base)
if (any < 0)
continue;
if (neg) {
if (acc < cutoff || acc == cutoff && c > cutlim) {
if (acc < cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = QUAD_MIN;
errno = ERANGE;
@ -135,7 +143,7 @@ strtoq(nptr, endptr, base)
acc -= c;
}
} else {
if (acc > cutoff || acc == cutoff && c > cutlim) {
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = QUAD_MAX;
errno = ERANGE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: strtoul.c,v 1.9 1996/07/20 01:00:57 jtc Exp $ */
/* $NetBSD: strtoul.c,v 1.10 1997/07/13 20:17:02 christos Exp $ */
/*
* Copyright (c) 1990 Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)strtoul.c 5.3 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: strtoul.c,v 1.9 1996/07/20 01:00:57 jtc Exp $";
__RCSID("$NetBSD: strtoul.c,v 1.10 1997/07/13 20:17:02 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -100,7 +101,7 @@ strtoul(nptr, endptr, base)
break;
if (any < 0)
continue;
if (acc > cutoff || acc == cutoff && c > cutlim) {
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = ULONG_MAX;
errno = ERANGE;

View File

@ -1,3 +1,5 @@
/* $NetBSD: strtouq.c,v 1.7 1997/07/13 20:17:04 christos Exp $ */
/*-
* Copyright (c) 1992 The Regents of the University of California.
* All rights reserved.
@ -31,10 +33,16 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)strtouq.c 5.1 (Berkeley) 6/26/92";
#else
__RCSID("$NetBSD: strtouq.c,v 1.7 1997/07/13 20:17:04 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <sys/types.h>
#include <ctype.h>
@ -49,7 +57,7 @@ static char sccsid[] = "@(#)strtouq.c 5.1 (Berkeley) 6/26/92";
* alphabets and digits are each contiguous.
*/
u_quad_t
strtouq(nptr, endptr, base)
_strtouq(nptr, endptr, base)
const char *nptr;
char **endptr;
register int base;
@ -96,7 +104,7 @@ strtouq(nptr, endptr, base)
break;
if (any < 0)
continue;
if (acc > cutoff || acc == cutoff && c > cutlim) {
if (acc > cutoff || (acc == cutoff && c > cutlim)) {
any = -1;
acc = UQUAD_MAX;
errno = ERANGE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: system.c,v 1.11 1995/12/28 08:52:58 thorpej Exp $ */
/* $NetBSD: system.c,v 1.12 1997/07/13 20:17:05 christos Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char *sccsid = "from: @(#)system.c 5.10 (Berkeley) 2/23/91";
#else
static char *rcsid = "$NetBSD: system.c,v 1.11 1995/12/28 08:52:58 thorpej Exp $";
__RCSID("$NetBSD: system.c,v 1.12 1997/07/13 20:17:05 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */