Browse Source

ansi + de-register

ok otto deraadt
OPENBSD_3_8
pat 20 years ago
parent
commit
4d0a547963
35 changed files with 170 additions and 397 deletions
  1. +2
    -3
      src/lib/libc/stdlib/a64l.c
  2. +2
    -3
      src/lib/libc/stdlib/abs.c
  3. +7
    -9
      src/lib/libc/stdlib/atexit.c
  4. +2
    -3
      src/lib/libc/stdlib/atof.c
  5. +2
    -3
      src/lib/libc/stdlib/atoi.c
  6. +2
    -3
      src/lib/libc/stdlib/atol.c
  7. +6
    -10
      src/lib/libc/stdlib/bsearch.c
  8. +3
    -5
      src/lib/libc/stdlib/calloc.c
  9. +3
    -4
      src/lib/libc/stdlib/cfree.c
  10. +2
    -3
      src/lib/libc/stdlib/div.c
  11. +4
    -5
      src/lib/libc/stdlib/exit.c
  12. +5
    -6
      src/lib/libc/stdlib/getenv.c
  13. +6
    -14
      src/lib/libc/stdlib/getopt_long.c
  14. +5
    -7
      src/lib/libc/stdlib/getsubopt.c
  15. +5
    -7
      src/lib/libc/stdlib/heapsort.c
  16. +2
    -3
      src/lib/libc/stdlib/l64a.c
  17. +2
    -3
      src/lib/libc/stdlib/labs.c
  18. +2
    -3
      src/lib/libc/stdlib/ldiv.c
  19. +9
    -16
      src/lib/libc/stdlib/merge.c
  20. +2
    -3
      src/lib/libc/stdlib/putenv.c
  21. +2
    -3
      src/lib/libc/stdlib/qabs.c
  22. +2
    -3
      src/lib/libc/stdlib/qdiv.c
  23. +9
    -16
      src/lib/libc/stdlib/qsort.c
  24. +13
    -29
      src/lib/libc/stdlib/radixsort.c
  25. +4
    -9
      src/lib/libc/stdlib/rand.c
  26. +6
    -11
      src/lib/libc/stdlib/random.c
  27. +3
    -7
      src/lib/libc/stdlib/setenv.c
  28. +24
    -142
      src/lib/libc/stdlib/strtod.c
  29. +6
    -9
      src/lib/libc/stdlib/strtol.c
  30. +3
    -9
      src/lib/libc/stdlib/strtoll.c
  31. +6
    -9
      src/lib/libc/stdlib/strtoul.c
  32. +3
    -9
      src/lib/libc/stdlib/strtoull.c
  33. +2
    -3
      src/lib/libc/stdlib/system.c
  34. +3
    -5
      src/lib/libc/stdlib/tfind.c
  35. +11
    -20
      src/lib/libc/stdlib/tsearch.c

+ 2
- 3
src/lib/libc/stdlib/a64l.c View File

@ -4,15 +4,14 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: a64l.c,v 1.3 1997/08/17 22:58:34 millert Exp $";
static char *rcsid = "$OpenBSD: a64l.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
long long
a64l(s)
const char *s;
a64l(const char *s)
{ {
long value, digit, shift; long value, digit, shift;
int i; int i;


+ 2
- 3
src/lib/libc/stdlib/abs.c View File

@ -28,14 +28,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: abs.c,v 1.3 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: abs.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
int int
abs(j)
int j;
abs(int j)
{ {
return(j < 0 ? -j : j); return(j < 0 ? -j : j);
} }

+ 7
- 9
src/lib/libc/stdlib/atexit.c View File

@ -29,7 +29,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: atexit.c,v 1.7 2002/09/14 22:03:14 dhartmei Exp $";
static char *rcsid = "$OpenBSD: atexit.c,v 1.8 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -59,11 +59,10 @@ struct atexit *__atexit;
* Register a function to be performed at exit. * Register a function to be performed at exit.
*/ */
int int
atexit(fn)
void (*fn)();
atexit(void (*fn)(void))
{ {
register struct atexit *p = __atexit;
register int pgsize = getpagesize();
struct atexit *p = __atexit;
int pgsize = getpagesize();
if (pgsize < sizeof(*p)) if (pgsize < sizeof(*p))
return (-1); return (-1);
@ -102,11 +101,10 @@ atexit(fn)
* Register the cleanup function * Register the cleanup function
*/ */
void void
__atexit_register_cleanup(fn)
void (*fn)();
__atexit_register_cleanup(void (*fn)(void))
{ {
register struct atexit *p = __atexit;
register int pgsize = getpagesize();
struct atexit *p = __atexit;
int pgsize = getpagesize();
if (pgsize < sizeof(*p)) if (pgsize < sizeof(*p))
return; return;


+ 2
- 3
src/lib/libc/stdlib/atof.c View File

@ -28,14 +28,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: atof.c,v 1.3 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: atof.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
double double
atof(ascii)
const char *ascii;
atof(const char *ascii)
{ {
return(strtod(ascii, (char **)NULL)); return(strtod(ascii, (char **)NULL));
} }

+ 2
- 3
src/lib/libc/stdlib/atoi.c View File

@ -28,14 +28,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: atoi.c,v 1.3 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: atoi.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
int int
atoi(str)
const char *str;
atoi(const char *str)
{ {
return((int)strtol(str, (char **)NULL, 10)); return((int)strtol(str, (char **)NULL, 10));
} }

+ 2
- 3
src/lib/libc/stdlib/atol.c View File

@ -28,14 +28,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: atol.c,v 1.3 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: atol.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
long long
atol(str)
const char *str;
atol(const char *str)
{ {
return(strtol(str, (char **)NULL, 10)); return(strtol(str, (char **)NULL, 10));
} }

+ 6
- 10
src/lib/libc/stdlib/bsearch.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: bsearch.c,v 1.4 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: bsearch.c,v 1.5 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
@ -50,16 +50,12 @@ static char *rcsid = "$OpenBSD: bsearch.c,v 1.4 2003/06/02 20:18:37 millert Exp
* look at item 3. * look at item 3.
*/ */
void * void *
bsearch(key, base0, nmemb, size, compar)
register const void *key;
const void *base0;
size_t nmemb;
register size_t size;
register int (*compar)(const void *, const void *);
bsearch(const void *key, const void *base0, size_t nmemb, size_t size,
int (*compar)(const void *, const void *))
{ {
register const char *base = base0;
register int lim, cmp;
register const void *p;
const char *base = base0;
int lim, cmp;
const void *p;
for (lim = nmemb; lim != 0; lim >>= 1) { for (lim = nmemb; lim != 0; lim >>= 1) {
p = base + (lim >> 1) * size; p = base + (lim >> 1) * size;


+ 3
- 5
src/lib/libc/stdlib/calloc.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: calloc.c,v 1.8 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: calloc.c,v 1.9 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
@ -37,11 +37,9 @@ static char *rcsid = "$OpenBSD: calloc.c,v 1.8 2003/06/02 20:18:37 millert Exp $
#include <errno.h> #include <errno.h>
void * void *
calloc(num, size)
size_t num;
register size_t size;
calloc(size_t num, size_t size)
{ {
register void *p;
void *p;
if (num && size && SIZE_T_MAX / num < size) { if (num && size && SIZE_T_MAX / num < size) {
errno = ENOMEM; errno = ENOMEM;


+ 3
- 4
src/lib/libc/stdlib/cfree.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: cfree.c,v 1.3 2003/07/18 23:05:13 david Exp $ */
/* $OpenBSD: cfree.c,v 1.4 2005/03/30 18:51:49 pat Exp $ */
/* /*
* Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@ -26,7 +26,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$OpenBSD: cfree.c,v 1.3 2003/07/18 23:05:13 david Exp $";
static char rcsid[] = "$OpenBSD: cfree.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h> #include <sys/cdefs.h>
@ -37,8 +37,7 @@ __indr_reference(free, cfree);
#else #else
void void
cfree(p)
void *p;
cfree(void *p)
{ {
free(p); free(p);
} }


+ 2
- 3
src/lib/libc/stdlib/div.c View File

@ -31,14 +31,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: div.c,v 1.3 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: div.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> /* div_t */ #include <stdlib.h> /* div_t */
div_t div_t
div(num, denom)
int num, denom;
div(int num, int denom)
{ {
div_t r; div_t r;


+ 4
- 5
src/lib/libc/stdlib/exit.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: exit.c,v 1.9 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: exit.c,v 1.10 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -51,11 +51,10 @@ int __isthreaded = 0;
* Exit, flushing stdio buffers if necessary. * Exit, flushing stdio buffers if necessary.
*/ */
void void
exit(status)
int status;
exit(int status)
{ {
register struct atexit *p, *q;
register int n, pgsize = getpagesize();
struct atexit *p, *q;
int n, pgsize = getpagesize();
if (!__atexit_invalid) { if (!__atexit_invalid) {
p = __atexit; p = __atexit;


+ 5
- 6
src/lib/libc/stdlib/getenv.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: getenv.c,v 1.6 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: getenv.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
@ -49,9 +49,9 @@ char *
__findenv(const char *name, int *offset) __findenv(const char *name, int *offset)
{ {
extern char **environ; extern char **environ;
register int len, i;
register const char *np;
register char **p, *cp;
int len, i;
const char *np;
char **p, *cp;
if (name == NULL || environ == NULL) if (name == NULL || environ == NULL)
return (NULL); return (NULL);
@ -75,8 +75,7 @@ __findenv(const char *name, int *offset)
* Returns ptr to value associated with name, if any, else NULL. * Returns ptr to value associated with name, if any, else NULL.
*/ */
char * char *
getenv(name)
const char *name;
getenv(const char *name)
{ {
int offset; int offset;


+ 6
- 14
src/lib/libc/stdlib/getopt_long.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getopt_long.c,v 1.17 2004/06/03 18:46:52 millert Exp $ */
/* $OpenBSD: getopt_long.c,v 1.18 2005/03/30 18:51:49 pat Exp $ */
/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
/* /*
@ -57,7 +57,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: getopt_long.c,v 1.17 2004/06/03 18:46:52 millert Exp $";
static char *rcsid = "$OpenBSD: getopt_long.c,v 1.18 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <err.h> #include <err.h>
@ -515,12 +515,8 @@ getopt(int nargc, char * const *nargv, const char *options)
* Parse argc/argv argument vector. * Parse argc/argv argument vector.
*/ */
int int
getopt_long(nargc, nargv, options, long_options, idx)
int nargc;
char * const *nargv;
const char *options;
const struct option *long_options;
int *idx;
getopt_long(int nargc, char * const *nargv, const char *options,
const struct option *long_options, int *idx)
{ {
return (getopt_internal(nargc, nargv, options, long_options, idx, return (getopt_internal(nargc, nargv, options, long_options, idx,
@ -532,12 +528,8 @@ getopt_long(nargc, nargv, options, long_options, idx)
* Parse argc/argv argument vector. * Parse argc/argv argument vector.
*/ */
int int
getopt_long_only(nargc, nargv, options, long_options, idx)
int nargc;
char * const *nargv;
const char *options;
const struct option *long_options;
int *idx;
getopt_long_only(int nargc, char * const *nargv, const char *options,
const struct option *long_options, int *idx)
{ {
return (getopt_internal(nargc, nargv, options, long_options, idx, return (getopt_internal(nargc, nargv, options, long_options, idx,


+ 5
- 7
src/lib/libc/stdlib/getsubopt.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert Exp $ */
/* $OpenBSD: getsubopt.c,v 1.3 2005/03/30 18:51:49 pat Exp $ */
/*- /*-
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -33,7 +33,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)getsubopt.c 8.1 (Berkeley) 6/4/93"; static char sccsid[] = "@(#)getsubopt.c 8.1 (Berkeley) 6/4/93";
#else #else
static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert Exp $";
static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.3 2005/03/30 18:51:49 pat Exp $";
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -50,12 +50,10 @@ static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert E
char *suboptarg; char *suboptarg;
int int
getsubopt(optionp, tokens, valuep)
register char **optionp, **valuep;
register char * const *tokens;
getsubopt(char **optionp, char * const *tokens, char **valuep)
{ {
register int cnt;
register char *p;
int cnt;
char *p;
suboptarg = *valuep = NULL; suboptarg = *valuep = NULL;


+ 5
- 7
src/lib/libc/stdlib/heapsort.c View File

@ -31,7 +31,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: heapsort.c,v 1.6 2003/09/08 16:24:05 deraadt Exp $";
static char *rcsid = "$OpenBSD: heapsort.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -134,13 +134,11 @@ static char *rcsid = "$OpenBSD: heapsort.c,v 1.6 2003/09/08 16:24:05 deraadt Exp
* only advantage over quicksort is that it requires little additional memory. * only advantage over quicksort is that it requires little additional memory.
*/ */
int int
heapsort(vbase, nmemb, size, compar)
void *vbase;
size_t nmemb, size;
int (*compar)(const void *, const void *);
heapsort(void *vbase, size_t nmemb, size_t size,
int (*compar)(const void *, const void *))
{ {
register int cnt, i, j, l;
register char tmp, *tmp1, *tmp2;
int cnt, i, j, l;
char tmp, *tmp1, *tmp2;
char *base, *k, *p, *t; char *base, *k, *p, *t;
if (nmemb <= 1) if (nmemb <= 1)


+ 2
- 3
src/lib/libc/stdlib/l64a.c View File

@ -4,15 +4,14 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: l64a.c,v 1.3 1997/08/17 22:58:34 millert Exp $";
static char *rcsid = "$OpenBSD: l64a.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
char * char *
l64a(value)
long value;
l64a(long value)
{ {
static char buf[8]; static char buf[8];
char *s = buf; char *s = buf;


+ 2
- 3
src/lib/libc/stdlib/labs.c View File

@ -28,14 +28,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: labs.c,v 1.3 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: labs.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
long long
labs(j)
long j;
labs(long j)
{ {
return(j < 0 ? -j : j); return(j < 0 ? -j : j);
} }

+ 2
- 3
src/lib/libc/stdlib/ldiv.c View File

@ -31,14 +31,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: ldiv.c,v 1.3 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: ldiv.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> /* ldiv_t */ #include <stdlib.h> /* ldiv_t */
ldiv_t ldiv_t
ldiv(num, denom)
long num, denom;
ldiv(long num, long denom)
{ {
ldiv_t r; ldiv_t r;


+ 9
- 16
src/lib/libc/stdlib/merge.c View File

@ -31,7 +31,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: merge.c,v 1.6 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: merge.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
/* /*
@ -91,15 +91,12 @@ static void insertionsort(u_char *, size_t, size_t, int (*)());
* Arguments are as for qsort. * Arguments are as for qsort.
*/ */
int int
mergesort(base, nmemb, size, cmp)
void *base;
size_t nmemb;
register size_t size;
int (*cmp)(const void *, const void *);
mergesort(void *base, size_t nmemb, size_t size,
int (*cmp)(const void *, const void *))
{ {
register int i, sense;
int i, sense;
int big, iflag; int big, iflag;
register u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
u_char *list2, *list1, *p2, *p, *last, **p1; u_char *list2, *list1, *p2, *p, *last, **p1;
if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */ if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */
@ -251,10 +248,8 @@ COPY: b = t;
* is defined. Otherwise simple pairwise merging is used.) * is defined. Otherwise simple pairwise merging is used.)
*/ */
void void
setup(list1, list2, n, size, cmp)
size_t n, size;
int (*cmp)(const void *, const void *);
u_char *list1, *list2;
setup(u_char *list1, u_char *list2, size_t n, size_t size,
int (*cmp)(const void *, const void *))
{ {
int i, length, size2, tmp, sense; int i, length, size2, tmp, sense;
u_char *f1, *f2, *s, *l2, *last, *p2; u_char *f1, *f2, *s, *l2, *last, *p2;
@ -325,10 +320,8 @@ setup(list1, list2, n, size, cmp)
* last 4 elements. * last 4 elements.
*/ */
static void static void
insertionsort(a, n, size, cmp)
u_char *a;
size_t n, size;
int (*cmp)(const void *, const void *);
insertionsort(u_char *a, size_t n, size_t size,
int (*cmp)(const void *, const void *))
{ {
u_char *ai, *s, *t, *u, tmp; u_char *ai, *s, *t, *u, tmp;
int i; int i;


+ 2
- 3
src/lib/libc/stdlib/putenv.c View File

@ -28,15 +28,14 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: putenv.c,v 1.3 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: putenv.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
int int
putenv(str)
const char *str;
putenv(const char *str)
{ {
char *p, *equal; char *p, *equal;
int rval; int rval;


+ 2
- 3
src/lib/libc/stdlib/qabs.c View File

@ -28,14 +28,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: qabs.c,v 1.3 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: qabs.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
quad_t quad_t
qabs(j)
quad_t j;
qabs(quad_t j)
{ {
return(j < 0 ? -j : j); return(j < 0 ? -j : j);
} }

+ 2
- 3
src/lib/libc/stdlib/qdiv.c View File

@ -31,14 +31,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: qdiv.c,v 1.3 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: qdiv.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> /* qdiv_t */ #include <stdlib.h> /* qdiv_t */
qdiv_t qdiv_t
qdiv(num, denom)
quad_t num, denom;
qdiv(quad_t num, quad_t denom)
{ {
qdiv_t r; qdiv_t r;


+ 9
- 16
src/lib/libc/stdlib/qsort.c View File

@ -28,13 +28,13 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: qsort.c,v 1.8 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: qsort.c,v 1.9 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h> #include <stdlib.h>
static __inline char *med3(char *, char *, char *, int (*)());
static __inline char *med3(char *, char *, char *, int (*)(const void *, const void *));
static __inline void swapfunc(char *, char *, int, int); static __inline void swapfunc(char *, char *, int, int);
#define min(a, b) (a) < (b) ? a : b #define min(a, b) (a) < (b) ? a : b
@ -44,10 +44,10 @@ static __inline void swapfunc(char *, char *, int, int);
*/ */
#define swapcode(TYPE, parmi, parmj, n) { \ #define swapcode(TYPE, parmi, parmj, n) { \
long i = (n) / sizeof (TYPE); \ long i = (n) / sizeof (TYPE); \
register TYPE *pi = (TYPE *) (parmi); \
register TYPE *pj = (TYPE *) (parmj); \
TYPE *pi = (TYPE *) (parmi); \
TYPE *pj = (TYPE *) (parmj); \
do { \ do { \
register TYPE t = *pi; \
TYPE t = *pi; \
*pi++ = *pj; \ *pi++ = *pj; \
*pj++ = t; \ *pj++ = t; \
} while (--i > 0); \ } while (--i > 0); \
@ -57,9 +57,7 @@ static __inline void swapfunc(char *, char *, int, int);
es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
static __inline void static __inline void
swapfunc(a, b, n, swaptype)
char *a, *b;
int n, swaptype;
swapfunc(char *a, char *b, int n, int swaptype)
{ {
if (swaptype <= 1) if (swaptype <= 1)
swapcode(long, a, b, n) swapcode(long, a, b, n)
@ -78,9 +76,7 @@ swapfunc(a, b, n, swaptype)
#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
static __inline char * static __inline char *
med3(a, b, c, cmp)
char *a, *b, *c;
int (*cmp)();
med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
{ {
return cmp(a, b) < 0 ? return cmp(a, b) < 0 ?
(cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a )) (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a ))
@ -88,14 +84,11 @@ med3(a, b, c, cmp)
} }
void void
qsort(aa, n, es, cmp)
void *aa;
size_t n, es;
int (*cmp)();
qsort(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *))
{ {
char *pa, *pb, *pc, *pd, *pl, *pm, *pn; char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
int d, r, swaptype, swap_cnt; int d, r, swaptype, swap_cnt;
register char *a = aa;
char *a = aa;
loop: SWAPINIT(a, es); loop: SWAPINIT(a, es);
swap_cnt = 0; swap_cnt = 0;


+ 13
- 29
src/lib/libc/stdlib/radixsort.c View File

@ -31,7 +31,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: radixsort.c,v 1.6 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: radixsort.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
/* /*
@ -85,10 +85,7 @@ static void r_sort_b(const u_char **,
} }
int int
radixsort(a, n, tab, endch)
const u_char **a, *tab;
int n;
u_int endch;
radixsort(const u_char **a, int n, const u_char *tab, u_int endch)
{ {
const u_char *tr; const u_char *tr;
int c; int c;
@ -100,10 +97,7 @@ radixsort(a, n, tab, endch)
} }
int int
sradixsort(a, n, tab, endch)
const u_char **a, *tab;
int n;
u_int endch;
sradixsort(const u_char **a, int n, const u_char *tab, u_int endch)
{ {
const u_char *tr, **ta; const u_char *tr, **ta;
int c; int c;
@ -128,15 +122,11 @@ sradixsort(a, n, tab, endch)
/* Unstable, in-place sort. */ /* Unstable, in-place sort. */
void void
r_sort_a(a, n, i, tr, endch)
const u_char **a;
int n, i;
const u_char *tr;
u_int endch;
r_sort_a(const u_char **a, int n, int i, const u_char *tr, u_int endch)
{ {
static int count[256], nc, bmin; static int count[256], nc, bmin;
register int c;
register const u_char **ak, *r;
int c;
const u_char **ak, *r;
stack s[SIZE], *sp, *sp0, *sp1, temp; stack s[SIZE], *sp, *sp0, *sp1, temp;
int *cp, bigc; int *cp, bigc;
const u_char **an, *t, **aj, **top[256]; const u_char **an, *t, **aj, **top[256];
@ -219,15 +209,12 @@ r_sort_a(a, n, i, tr, endch)
/* Stable sort, requiring additional memory. */ /* Stable sort, requiring additional memory. */
void void
r_sort_b(a, ta, n, i, tr, endch)
const u_char **a, **ta;
int n, i;
const u_char *tr;
u_int endch;
r_sort_b(const u_char **a, const u_char **ta, int n, int i, const u_char *tr,
u_int endch)
{ {
static int count[256], nc, bmin; static int count[256], nc, bmin;
register int c;
register const u_char **ak, **ai;
int c;
const u_char **ak, **ai;
stack s[512], *sp, *sp0, *sp1, temp; stack s[512], *sp, *sp0, *sp1, temp;
const u_char **top[256]; const u_char **top[256];
int *cp, bigc; int *cp, bigc;
@ -291,13 +278,10 @@ r_sort_b(a, ta, n, i, tr, endch)
} }
static __inline void static __inline void
simplesort(a, n, b, tr, endch) /* insertion sort */
register const u_char **a;
int n, b;
register const u_char *tr;
u_int endch;
simplesort(const u_char **a, int n, int b, const u_char *tr, u_int endch)
/* insertion sort */
{ {
register u_char ch;
u_char ch;
const u_char **ak, **ai, *s, *t; const u_char **ak, **ai, *s, *t;
for (ak = a+1; --n >= 1; ak++) for (ak = a+1; --n >= 1; ak++)


+ 4
- 9
src/lib/libc/stdlib/rand.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: rand.c,v 1.7 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: rand.c,v 1.8 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -37,25 +37,20 @@ static char *rcsid = "$OpenBSD: rand.c,v 1.7 2003/06/02 20:18:38 millert Exp $";
static u_int next = 1; static u_int next = 1;
int int
rand_r(seed)
u_int *seed;
rand_r(u_int *seed)
{ {
*seed = *seed * 1103515245 + 12345; *seed = *seed * 1103515245 + 12345;
return (*seed % ((u_int)RAND_MAX + 1)); return (*seed % ((u_int)RAND_MAX + 1));
} }
int int
rand()
rand(void)
{ {
return (rand_r(&next)); return (rand_r(&next));
} }
void void
srand(seed)
u_int seed;
srand(u_int seed)
{ {
next = seed; next = seed;
} }

+ 6
- 11
src/lib/libc/stdlib/random.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: random.c,v 1.12 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: random.c,v 1.13 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/param.h> #include <sys/param.h>
@ -190,8 +190,7 @@ static int rand_sep = SEP_3;
* for default usage relies on values produced by this routine. * for default usage relies on values produced by this routine.
*/ */
void void
srandom(x)
unsigned int x;
srandom(unsigned int x)
{ {
int i; int i;
int32_t test; int32_t test;
@ -232,7 +231,7 @@ srandom(x)
* a fixed seed. * a fixed seed.
*/ */
void void
srandomdev()
srandomdev(void)
{ {
int fd, i, mib[2], n; int fd, i, mib[2], n;
size_t len; size_t len;
@ -299,10 +298,7 @@ srandomdev()
* Returns a pointer to the old state. * Returns a pointer to the old state.
*/ */
char * char *
initstate(seed, arg_state, n)
u_int seed; /* seed for R.N.G. */
char *arg_state; /* pointer to state array */
size_t n; /* # bytes of state info */
initstate(u_int seed, char *arg_state, size_t n)
{ {
char *ostate = (char *)(&state[-1]); char *ostate = (char *)(&state[-1]);
@ -359,8 +355,7 @@ initstate(seed, arg_state, n)
* Returns a pointer to the old state information. * Returns a pointer to the old state information.
*/ */
char * char *
setstate(arg_state)
const char *arg_state;
setstate(const char *arg_state)
{ {
int32_t *new_state = (int32_t *)arg_state; int32_t *new_state = (int32_t *)arg_state;
int32_t type = new_state[0] % MAX_TYPES; int32_t type = new_state[0] % MAX_TYPES;
@ -411,7 +406,7 @@ setstate(arg_state)
* Returns a 31-bit random number. * Returns a 31-bit random number.
*/ */
long long
random()
random(void)
{ {
int32_t i; int32_t i;


+ 3
- 7
src/lib/libc/stdlib/setenv.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: setenv.c,v 1.7 2005/02/16 21:20:22 millert Exp $";
static char *rcsid = "$OpenBSD: setenv.c,v 1.8 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h> #include <stdlib.h>
@ -44,10 +44,7 @@ extern char **environ;
* "value". If rewrite is set, replace any current value. * "value". If rewrite is set, replace any current value.
*/ */
int int
setenv(name, value, rewrite)
const char *name;
const char *value;
int rewrite;
setenv(const char *name, const char *value, int rewrite)
{ {
static char **lastenv; /* last value of environ */ static char **lastenv; /* last value of environ */
char *C; char *C;
@ -97,8 +94,7 @@ setenv(name, value, rewrite)
* Delete environmental variable "name". * Delete environmental variable "name".
*/ */
void void
unsetenv(name)
const char *name;
unsetenv(const char *name)
{ {
char **P; char **P;
int offset; int offset;


+ 24
- 142
src/lib/libc/stdlib/strtod.c View File

@ -79,7 +79,6 @@
* #define Just_16 to store 16 bits per 32-bit Long when doing high-precision * #define Just_16 to store 16 bits per 32-bit Long when doing high-precision
* integer arithmetic. Whether this speeds things up or slows things * integer arithmetic. Whether this speeds things up or slows things
* down depends on the machine and the number being converted. * down depends on the machine and the number being converted.
* #define KR_headers for old-style C function headers.
* #define Bad_float_h if your system lacks a float.h or if it does not * #define Bad_float_h if your system lacks a float.h or if it does not
* define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP,
* FLT_RADIX, FLT_ROUNDS, and DBL_MAX. * FLT_RADIX, FLT_ROUNDS, and DBL_MAX.
@ -90,7 +89,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: strtod.c,v 1.19 2004/02/03 16:52:11 drahn Exp $";
static char *rcsid = "$OpenBSD: strtod.c,v 1.20 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ #if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \
@ -130,22 +129,13 @@ static char *rcsid = "$OpenBSD: strtod.c,v 1.19 2004/02/03 16:52:11 drahn Exp $"
#include "malloc.h" #include "malloc.h"
#include "memory.h" #include "memory.h"
#else #else
#ifndef KR_headers
#include "stdlib.h" #include "stdlib.h"
#include "string.h" #include "string.h"
#include "locale.h" #include "locale.h"
#else
#include "malloc.h"
#include "memory.h"
#endif
#endif #endif
#ifdef MALLOC #ifdef MALLOC
#ifdef KR_headers
extern char *MALLOC();
#else
extern void *MALLOC(size_t); extern void *MALLOC(size_t);
#endif
#else #else
#define MALLOC malloc #define MALLOC malloc
#endif #endif
@ -203,12 +193,8 @@ extern "C" {
#endif #endif
#ifndef CONST #ifndef CONST
#ifdef KR_headers
#define CONST /* blank */
#else
#define CONST const #define CONST const
#endif #endif
#endif
#ifdef Unsigned_Shifts #ifdef Unsigned_Shifts
#define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000; #define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000;
@ -341,11 +327,7 @@ typedef union {
#ifdef RND_PRODQUOT #ifdef RND_PRODQUOT
#define rounded_product(a,b) a = rnd_prod(a, b) #define rounded_product(a,b) a = rnd_prod(a, b)
#define rounded_quotient(a,b) a = rnd_quot(a, b) #define rounded_quotient(a,b) a = rnd_quot(a, b)
#ifdef KR_headers
extern double rnd_prod(), rnd_quot();
#else
extern double rnd_prod(double, double), rnd_quot(double, double); extern double rnd_prod(double, double), rnd_quot(double, double);
#endif
#else #else
#define rounded_product(a,b) a *= b #define rounded_product(a,b) a *= b
#define rounded_quotient(a,b) a /= b #define rounded_quotient(a,b) a /= b
@ -385,12 +367,7 @@ Bigint {
static Bigint *freelist[Kmax+1]; static Bigint *freelist[Kmax+1];
static Bigint * static Bigint *
Balloc
#ifdef KR_headers
(k) int k;
#else
(int k)
#endif
Balloc(int k)
{ {
int x; int x;
Bigint *rv; Bigint *rv;
@ -409,12 +386,7 @@ Balloc
} }
static void static void
Bfree
#ifdef KR_headers
(v) Bigint *v;
#else
(Bigint *v)
#endif
Bfree(Bigint *v)
{ {
if (v) { if (v) {
v->next = freelist[v->k]; v->next = freelist[v->k];
@ -426,12 +398,7 @@ Bfree
y->wds*sizeof(Long) + 2*sizeof(int)) y->wds*sizeof(Long) + 2*sizeof(int))
static Bigint * static Bigint *
multadd
#ifdef KR_headers
(b, m, a) Bigint *b; int m, a;
#else
(Bigint *b, int m, int a) /* multiply by m and add a */
#endif
multadd(Bigint *b, int m, int a) /* multiply by m and add a */
{ {
int i, wds; int i, wds;
ULong *x, y; ULong *x, y;
@ -471,12 +438,7 @@ multadd
} }
static Bigint * static Bigint *
s2b
#ifdef KR_headers
(s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9;
#else
(CONST char *s, int nd0, int nd, ULong y9)
#endif
s2b(CONST char *s, int nd0, int nd, ULong y9)
{ {
Bigint *b; Bigint *b;
int i, k; int i, k;
@ -509,14 +471,9 @@ s2b
} }
static int static int
hi0bits
#ifdef KR_headers
(x) register ULong x;
#else
(register ULong x)
#endif
hi0bits(ULong x)
{ {
register int k = 0;
int k = 0;
if (!(x & 0xffff0000)) { if (!(x & 0xffff0000)) {
k = 16; k = 16;
@ -543,15 +500,10 @@ hi0bits
} }
static int static int
lo0bits
#ifdef KR_headers
(y) ULong *y;
#else
(ULong *y)
#endif
lo0bits(ULong *y)
{ {
register int k;
register ULong x = *y;
int k;
ULong x = *y;
if (x & 7) { if (x & 7) {
if (x & 1) if (x & 1)
@ -591,12 +543,7 @@ lo0bits
} }
static Bigint * static Bigint *
i2b
#ifdef KR_headers
(i) int i;
#else
(int i)
#endif
i2b(int i)
{ {
Bigint *b; Bigint *b;
@ -607,12 +554,7 @@ i2b
} }
static Bigint * static Bigint *
mult
#ifdef KR_headers
(a, b) Bigint *a, *b;
#else
(Bigint *a, Bigint *b)
#endif
mult(Bigint *a, Bigint *b)
{ {
Bigint *c; Bigint *c;
int k, wa, wb, wc; int k, wa, wb, wc;
@ -697,12 +639,7 @@ mult
static Bigint *p5s; static Bigint *p5s;
static Bigint * static Bigint *
pow5mult
#ifdef KR_headers
(b, k) Bigint *b; int k;
#else
(Bigint *b, int k)
#endif
pow5mult(Bigint *b, int k)
{ {
Bigint *b1, *p5, *p51; Bigint *b1, *p5, *p51;
int i; int i;
@ -736,12 +673,7 @@ pow5mult
} }
static Bigint * static Bigint *
lshift
#ifdef KR_headers
(b, k) Bigint *b; int k;
#else
(Bigint *b, int k)
#endif
lshift(Bigint *b, int k)
{ {
int i, k1, n, n1; int i, k1, n, n1;
Bigint *b1; Bigint *b1;
@ -796,12 +728,7 @@ lshift
} }
static int static int
cmp
#ifdef KR_headers
(a, b) Bigint *a, *b;
#else
(Bigint *a, Bigint *b)
#endif
cmp(Bigint *a, Bigint *b)
{ {
ULong *xa, *xa0, *xb, *xb0; ULong *xa, *xa0, *xb, *xb0;
int i, j; int i, j;
@ -830,12 +757,7 @@ cmp
} }
static Bigint * static Bigint *
diff
#ifdef KR_headers
(a, b) Bigint *a, *b;
#else
(Bigint *a, Bigint *b)
#endif
diff(Bigint *a, Bigint *b)
{ {
Bigint *c; Bigint *c;
int i, wa, wb; int i, wa, wb;
@ -912,15 +834,10 @@ diff
} }
static double static double
ulp
#ifdef KR_headers
(_x) double _x;
#else
(double _x)
#endif
ulp(double _x)
{ {
_double x; _double x;
register Long L;
Long L;
_double a; _double a;
value(x) = _x; value(x) = _x;
@ -952,12 +869,7 @@ ulp
} }
static double static double
b2d
#ifdef KR_headers
(a, e) Bigint *a; int *e;
#else
(Bigint *a, int *e)
#endif
b2d(Bigint *a, int *e)
{ {
ULong *xa, *xa0, w, y, z; ULong *xa, *xa0, w, y, z;
int k; int k;
@ -1022,12 +934,7 @@ b2d
} }
static Bigint * static Bigint *
d2b
#ifdef KR_headers
(_d, e, bits) double d; int *e, *bits;
#else
(double _d, int *e, int *bits)
#endif
d2b(double _d, int *e, int *bits)
{ {
Bigint *b; Bigint *b;
int de, i, k; int de, i, k;
@ -1156,12 +1063,7 @@ d2b
#undef d1 #undef d1
static double static double
ratio
#ifdef KR_headers
(a, b) Bigint *a, *b;
#else
(Bigint *a, Bigint *b)
#endif
ratio(Bigint *a, Bigint *b)
{ {
_double da, db; _double da, db;
int k, ka, kb; int k, ka, kb;
@ -1223,12 +1125,7 @@ static CONST double tinytens[] = { 1e-16, 1e-32 };
#endif #endif
double double
strtod
#ifdef KR_headers
(s00, se) CONST char *s00; char **se;
#else
(CONST char *s00, char **se)
#endif
strtod(CONST char *s00, char **se)
{ {
int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
@ -1239,11 +1136,7 @@ strtod
ULong y, z; ULong y, z;
Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
#ifndef KR_headers
CONST char decimal_point = localeconv()->decimal_point[0]; CONST char decimal_point = localeconv()->decimal_point[0];
#else
CONST char decimal_point = '.';
#endif
sign = nz0 = nz = 0; sign = nz0 = nz = 0;
value(rv) = 0.; value(rv) = 0.;
@ -1769,12 +1662,7 @@ strtod
} }
static int static int
quorem
#ifdef KR_headers
(b, S) Bigint *b, *S;
#else
(Bigint *b, Bigint *S)
#endif
quorem(Bigint *b, Bigint *S)
{ {
int n; int n;
Long borrow, y; Long borrow, y;
@ -1909,13 +1797,7 @@ quorem
*/ */
char * char *
__dtoa
#ifdef KR_headers
(_d, mode, ndigits, decpt, sign, rve)
double _d; int mode, ndigits, *decpt, *sign; char **rve;
#else
(double _d, int mode, int ndigits, int *decpt, int *sign, char **rve)
#endif
__dtoa(double _d, int mode, int ndigits, int *decpt, int *sign, char **rve)
{ {
/* Arguments ndigits, decpt, sign are similar to those /* Arguments ndigits, decpt, sign are similar to those
of ecvt and fcvt; trailing zeros are suppressed from of ecvt and fcvt; trailing zeros are suppressed from


+ 6
- 9
src/lib/libc/stdlib/strtol.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: strtol.c,v 1.5 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: strtol.c,v 1.6 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <ctype.h> #include <ctype.h>
@ -44,15 +44,12 @@ static char *rcsid = "$OpenBSD: strtol.c,v 1.5 2003/06/02 20:18:38 millert Exp $
* alphabets and digits are each contiguous. * alphabets and digits are each contiguous.
*/ */
long long
strtol(nptr, endptr, base)
const char *nptr;
char **endptr;
register int base;
strtol(const char *nptr, char **endptr, int base)
{ {
register const char *s;
register long acc, cutoff;
register int c;
register int neg, any, cutlim;
const char *s;
long acc, cutoff;
int c;
int neg, any, cutlim;
/* /*
* Skip white space and pick up leading +/- sign if any. * Skip white space and pick up leading +/- sign if any.


+ 3
- 9
src/lib/libc/stdlib/strtoll.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$OpenBSD: strtoll.c,v 1.3 2005/03/02 12:24:26 millert Exp $";
static const char rcsid[] = "$OpenBSD: strtoll.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -45,10 +45,7 @@ static const char rcsid[] = "$OpenBSD: strtoll.c,v 1.3 2005/03/02 12:24:26 mille
* alphabets and digits are each contiguous. * alphabets and digits are each contiguous.
*/ */
long long long long
strtoll(nptr, endptr, base)
const char *nptr;
char **endptr;
int base;
strtoll(const char *nptr, char **endptr, int base)
{ {
const char *s; const char *s;
long long acc, cutoff; long long acc, cutoff;
@ -151,10 +148,7 @@ strtoll(nptr, endptr, base)
__weak_alias(strtoq, strtoll); __weak_alias(strtoq, strtoll);
#else #else
quad_t quad_t
strtoq(nptr, endptr, base)
const char *nptr;
char **endptr;
int base;
strtoq(const char *nptr, char **endptr, int base)
{ {
return ((quad_t)strtoll(nptr, endptr, base)); return ((quad_t)strtoll(nptr, endptr, base));


+ 6
- 9
src/lib/libc/stdlib/strtoul.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: strtoul.c,v 1.5 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: strtoul.c,v 1.6 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <ctype.h> #include <ctype.h>
@ -43,15 +43,12 @@ static char *rcsid = "$OpenBSD: strtoul.c,v 1.5 2003/06/02 20:18:38 millert Exp
* alphabets and digits are each contiguous. * alphabets and digits are each contiguous.
*/ */
unsigned long unsigned long
strtoul(nptr, endptr, base)
const char *nptr;
char **endptr;
register int base;
strtoul(const char *nptr, char **endptr, int base)
{ {
register const char *s;
register unsigned long acc, cutoff;
register int c;
register int neg, any, cutlim;
const char *s;
unsigned long acc, cutoff;
int c;
int neg, any, cutlim;
/* /*
* See strtol for comments as to the logic used. * See strtol for comments as to the logic used.


+ 3
- 9
src/lib/libc/stdlib/strtoull.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$OpenBSD: strtoull.c,v 1.3 2005/03/02 12:24:26 millert Exp $";
static const char rcsid[] = "$OpenBSD: strtoull.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -45,10 +45,7 @@ static const char rcsid[] = "$OpenBSD: strtoull.c,v 1.3 2005/03/02 12:24:26 mill
* alphabets and digits are each contiguous. * alphabets and digits are each contiguous.
*/ */
unsigned long long unsigned long long
strtoull(nptr, endptr, base)
const char *nptr;
char **endptr;
int base;
strtoull(const char *nptr, char **endptr, int base)
{ {
const char *s; const char *s;
unsigned long long acc, cutoff; unsigned long long acc, cutoff;
@ -113,10 +110,7 @@ strtoull(nptr, endptr, base)
__weak_alias(strtouq, strtoull); __weak_alias(strtouq, strtoull);
#else #else
u_quad_t u_quad_t
strtouq(nptr, endptr, base)
const char *nptr;
char **endptr;
int base;
strtouq(const char *nptr, char **endptr, int base)
{ {
return ((u_quad_t)strtoull(nptr, endptr, base)); return ((u_quad_t)strtoull(nptr, endptr, base));


+ 2
- 3
src/lib/libc/stdlib/system.c View File

@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: system.c,v 1.6 2003/06/02 20:18:38 millert Exp $";
static char *rcsid = "$OpenBSD: system.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -41,8 +41,7 @@ static char *rcsid = "$OpenBSD: system.c,v 1.6 2003/06/02 20:18:38 millert Exp $
extern char **environ; extern char **environ;
int int
system(command)
const char *command;
system(const char *command)
{ {
pid_t pid; pid_t pid;
sig_t intsave, quitsave; sig_t intsave, quitsave;


+ 3
- 5
src/lib/libc/stdlib/tfind.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: tfind.c,v 1.4 2004/10/01 04:08:45 jsg Exp $ */
/* $OpenBSD: tfind.c,v 1.5 2005/03/30 18:51:49 pat Exp $ */
/* /*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like * Tree search generalized from Knuth (6.2.2) Algorithm T just like
@ -21,10 +21,8 @@ typedef struct node_t
/* find a node, or return 0 */ /* find a node, or return 0 */
void * void *
tfind(vkey, vrootp, compar)
const void *vkey; /* key to be found */
void *const *vrootp; /* address of the tree root */
int (*compar)(const void *, const void *);
tfind(const void *vkey, void * const *vrootp,
int (*compar)(const void *, const void *))
{ {
char *key = (char *)vkey; char *key = (char *)vkey;
node **rootp = (node **)vrootp; node **rootp = (node **)vrootp;


+ 11
- 20
src/lib/libc/stdlib/tsearch.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: tsearch.c,v 1.4 2004/10/01 04:08:45 jsg Exp $ */
/* $OpenBSD: tsearch.c,v 1.5 2005/03/30 18:51:49 pat Exp $ */
/* /*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like * Tree search generalized from Knuth (6.2.2) Algorithm T just like
@ -22,12 +22,10 @@ typedef struct node_t {
/* find or insert datum into search tree */ /* find or insert datum into search tree */
void * void *
tsearch(vkey, vrootp, compar)
const void *vkey; /* key to be located */
void **vrootp; /* address of tree root */
int (*compar)(const void *, const void *);
tsearch(const void *vkey, void **vrootp,
int (*compar)(const void *, const void *))
{ {
register node *q;
node *q;
char *key = (char *)vkey; char *key = (char *)vkey;
node **rootp = (node **)vrootp; node **rootp = (node **)vrootp;
@ -53,16 +51,14 @@ tsearch(vkey, vrootp, compar)
/* delete node with given key */ /* delete node with given key */
void * void *
tdelete(vkey, vrootp, compar)
const void *vkey; /* key to be deleted */
void **vrootp; /* address of the root of tree */
int (*compar)(const void *, const void *);
tdelete(const void *vkey, void **vrootp,
int (*compar)(const void *, const void *))
{ {
node **rootp = (node **)vrootp; node **rootp = (node **)vrootp;
char *key = (char *)vkey; char *key = (char *)vkey;
node *p; node *p;
register node *q;
register node *r;
node *q;
node *r;
int cmp; int cmp;
if (rootp == (struct node_t **)0 || (p = *rootp) == (struct node_t *)0) if (rootp == (struct node_t **)0 || (p = *rootp) == (struct node_t *)0)
@ -97,10 +93,7 @@ tdelete(vkey, vrootp, compar)
/* Walk the nodes of a tree */ /* Walk the nodes of a tree */
static void static void
trecurse(root, action, level)
register node *root; /* Root of the tree to be walked */
register void (*action)(); /* Function to be called at each node */
register int level;
trecurse(node *root, void (*action)(const void *, VISIT, int), int level)
{ {
if (root->left == (struct node_t *)0 && root->right == (struct node_t *)0) if (root->left == (struct node_t *)0 && root->right == (struct node_t *)0)
(*action)(root, leaf, level); (*action)(root, leaf, level);
@ -117,12 +110,10 @@ trecurse(root, action, level)
/* Walk the nodes of a tree */ /* Walk the nodes of a tree */
void void
twalk(vroot, action)
const void *vroot; /* Root of the tree to be walked */
void (*action)(const void *, VISIT, int);
twalk(const void *vroot, void (*action)(const void *, VISIT, int))
{ {
node *root = (node *)vroot; node *root = (node *)vroot;
if (root != (node *)0 && action != (void(*)())0)
if (root != (node *)0 && action != (void (*)(const void *, VISIT, int))0)
trecurse(root, action, 0); trecurse(root, action, 0);
} }

Loading…
Cancel
Save