summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpat <>2005-03-30 18:51:49 +0000
committerpat <>2005-03-30 18:51:49 +0000
commit894b6ab0099e7d9ca2ad9acb75246cd0a4542167 (patch)
treef9fb8e9324f6cbdc10d72cab8b889d470252465a
parent162f8b042bf31ab94714a6f194e9836c08c085f5 (diff)
downloadopenbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.tar.gz
openbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.tar.bz2
openbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.zip
ansi + de-register
ok otto deraadt
-rw-r--r--src/lib/libc/stdlib/a64l.c5
-rw-r--r--src/lib/libc/stdlib/abs.c5
-rw-r--r--src/lib/libc/stdlib/atexit.c16
-rw-r--r--src/lib/libc/stdlib/atof.c5
-rw-r--r--src/lib/libc/stdlib/atoi.c5
-rw-r--r--src/lib/libc/stdlib/atol.c5
-rw-r--r--src/lib/libc/stdlib/bsearch.c16
-rw-r--r--src/lib/libc/stdlib/calloc.c8
-rw-r--r--src/lib/libc/stdlib/cfree.c7
-rw-r--r--src/lib/libc/stdlib/div.c5
-rw-r--r--src/lib/libc/stdlib/exit.c9
-rw-r--r--src/lib/libc/stdlib/getenv.c11
-rw-r--r--src/lib/libc/stdlib/getopt_long.c20
-rw-r--r--src/lib/libc/stdlib/getsubopt.c12
-rw-r--r--src/lib/libc/stdlib/heapsort.c12
-rw-r--r--src/lib/libc/stdlib/l64a.c5
-rw-r--r--src/lib/libc/stdlib/labs.c5
-rw-r--r--src/lib/libc/stdlib/ldiv.c5
-rw-r--r--src/lib/libc/stdlib/merge.c25
-rw-r--r--src/lib/libc/stdlib/putenv.c5
-rw-r--r--src/lib/libc/stdlib/qabs.c5
-rw-r--r--src/lib/libc/stdlib/qdiv.c5
-rw-r--r--src/lib/libc/stdlib/qsort.c25
-rw-r--r--src/lib/libc/stdlib/radixsort.c42
-rw-r--r--src/lib/libc/stdlib/rand.c13
-rw-r--r--src/lib/libc/stdlib/random.c17
-rw-r--r--src/lib/libc/stdlib/setenv.c10
-rw-r--r--src/lib/libc/stdlib/strtod.c166
-rw-r--r--src/lib/libc/stdlib/strtol.c15
-rw-r--r--src/lib/libc/stdlib/strtoll.c12
-rw-r--r--src/lib/libc/stdlib/strtoul.c15
-rw-r--r--src/lib/libc/stdlib/strtoull.c12
-rw-r--r--src/lib/libc/stdlib/system.c5
-rw-r--r--src/lib/libc/stdlib/tfind.c8
-rw-r--r--src/lib/libc/stdlib/tsearch.c31
35 files changed, 170 insertions, 397 deletions
diff --git a/src/lib/libc/stdlib/a64l.c b/src/lib/libc/stdlib/a64l.c
index a68f0a6dcd..518bdb64f9 100644
--- a/src/lib/libc/stdlib/a64l.c
+++ b/src/lib/libc/stdlib/a64l.c
@@ -4,15 +4,14 @@
4 */ 4 */
5 5
6#if defined(LIBC_SCCS) && !defined(lint) 6#if defined(LIBC_SCCS) && !defined(lint)
7static char *rcsid = "$OpenBSD: a64l.c,v 1.3 1997/08/17 22:58:34 millert Exp $"; 7static char *rcsid = "$OpenBSD: a64l.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
8#endif /* LIBC_SCCS and not lint */ 8#endif /* LIBC_SCCS and not lint */
9 9
10#include <errno.h> 10#include <errno.h>
11#include <stdlib.h> 11#include <stdlib.h>
12 12
13long 13long
14a64l(s) 14a64l(const char *s)
15 const char *s;
16{ 15{
17 long value, digit, shift; 16 long value, digit, shift;
18 int i; 17 int i;
diff --git a/src/lib/libc/stdlib/abs.c b/src/lib/libc/stdlib/abs.c
index c67ad9494f..a471ab3a1e 100644
--- a/src/lib/libc/stdlib/abs.c
+++ b/src/lib/libc/stdlib/abs.c
@@ -28,14 +28,13 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: abs.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: abs.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36int 36int
37abs(j) 37abs(int j)
38 int j;
39{ 38{
40 return(j < 0 ? -j : j); 39 return(j < 0 ? -j : j);
41} 40}
diff --git a/src/lib/libc/stdlib/atexit.c b/src/lib/libc/stdlib/atexit.c
index 98564d0dd3..4fd2c57318 100644
--- a/src/lib/libc/stdlib/atexit.c
+++ b/src/lib/libc/stdlib/atexit.c
@@ -29,7 +29,7 @@
29 */ 29 */
30 30
31#if defined(LIBC_SCCS) && !defined(lint) 31#if defined(LIBC_SCCS) && !defined(lint)
32static char *rcsid = "$OpenBSD: atexit.c,v 1.7 2002/09/14 22:03:14 dhartmei Exp $"; 32static char *rcsid = "$OpenBSD: atexit.c,v 1.8 2005/03/30 18:51:49 pat Exp $";
33#endif /* LIBC_SCCS and not lint */ 33#endif /* LIBC_SCCS and not lint */
34 34
35#include <sys/types.h> 35#include <sys/types.h>
@@ -59,11 +59,10 @@ struct atexit *__atexit;
59 * Register a function to be performed at exit. 59 * Register a function to be performed at exit.
60 */ 60 */
61int 61int
62atexit(fn) 62atexit(void (*fn)(void))
63 void (*fn)();
64{ 63{
65 register struct atexit *p = __atexit; 64 struct atexit *p = __atexit;
66 register int pgsize = getpagesize(); 65 int pgsize = getpagesize();
67 66
68 if (pgsize < sizeof(*p)) 67 if (pgsize < sizeof(*p))
69 return (-1); 68 return (-1);
@@ -102,11 +101,10 @@ atexit(fn)
102 * Register the cleanup function 101 * Register the cleanup function
103 */ 102 */
104void 103void
105__atexit_register_cleanup(fn) 104__atexit_register_cleanup(void (*fn)(void))
106 void (*fn)();
107{ 105{
108 register struct atexit *p = __atexit; 106 struct atexit *p = __atexit;
109 register int pgsize = getpagesize(); 107 int pgsize = getpagesize();
110 108
111 if (pgsize < sizeof(*p)) 109 if (pgsize < sizeof(*p))
112 return; 110 return;
diff --git a/src/lib/libc/stdlib/atof.c b/src/lib/libc/stdlib/atof.c
index dad2b77bfd..2724530231 100644
--- a/src/lib/libc/stdlib/atof.c
+++ b/src/lib/libc/stdlib/atof.c
@@ -28,14 +28,13 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: atof.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: atof.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36double 36double
37atof(ascii) 37atof(const char *ascii)
38 const char *ascii;
39{ 38{
40 return(strtod(ascii, (char **)NULL)); 39 return(strtod(ascii, (char **)NULL));
41} 40}
diff --git a/src/lib/libc/stdlib/atoi.c b/src/lib/libc/stdlib/atoi.c
index b1fe789fd5..ea821ced3d 100644
--- a/src/lib/libc/stdlib/atoi.c
+++ b/src/lib/libc/stdlib/atoi.c
@@ -28,14 +28,13 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: atoi.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: atoi.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36int 36int
37atoi(str) 37atoi(const char *str)
38 const char *str;
39{ 38{
40 return((int)strtol(str, (char **)NULL, 10)); 39 return((int)strtol(str, (char **)NULL, 10));
41} 40}
diff --git a/src/lib/libc/stdlib/atol.c b/src/lib/libc/stdlib/atol.c
index 83adad3eae..38236b556c 100644
--- a/src/lib/libc/stdlib/atol.c
+++ b/src/lib/libc/stdlib/atol.c
@@ -28,14 +28,13 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: atol.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: atol.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36long 36long
37atol(str) 37atol(const char *str)
38 const char *str;
39{ 38{
40 return(strtol(str, (char **)NULL, 10)); 39 return(strtol(str, (char **)NULL, 10));
41} 40}
diff --git a/src/lib/libc/stdlib/bsearch.c b/src/lib/libc/stdlib/bsearch.c
index 9bfbf64256..109211da92 100644
--- a/src/lib/libc/stdlib/bsearch.c
+++ b/src/lib/libc/stdlib/bsearch.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: bsearch.c,v 1.4 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: bsearch.c,v 1.5 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
@@ -50,16 +50,12 @@ static char *rcsid = "$OpenBSD: bsearch.c,v 1.4 2003/06/02 20:18:37 millert Exp
50 * look at item 3. 50 * look at item 3.
51 */ 51 */
52void * 52void *
53bsearch(key, base0, nmemb, size, compar) 53bsearch(const void *key, const void *base0, size_t nmemb, size_t size,
54 register const void *key; 54 int (*compar)(const void *, const void *))
55 const void *base0;
56 size_t nmemb;
57 register size_t size;
58 register int (*compar)(const void *, const void *);
59{ 55{
60 register const char *base = base0; 56 const char *base = base0;
61 register int lim, cmp; 57 int lim, cmp;
62 register const void *p; 58 const void *p;
63 59
64 for (lim = nmemb; lim != 0; lim >>= 1) { 60 for (lim = nmemb; lim != 0; lim >>= 1) {
65 p = base + (lim >> 1) * size; 61 p = base + (lim >> 1) * size;
diff --git a/src/lib/libc/stdlib/calloc.c b/src/lib/libc/stdlib/calloc.c
index b0703cc884..7aabed235f 100644
--- a/src/lib/libc/stdlib/calloc.c
+++ b/src/lib/libc/stdlib/calloc.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: calloc.c,v 1.8 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: calloc.c,v 1.9 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
@@ -37,11 +37,9 @@ static char *rcsid = "$OpenBSD: calloc.c,v 1.8 2003/06/02 20:18:37 millert Exp $
37#include <errno.h> 37#include <errno.h>
38 38
39void * 39void *
40calloc(num, size) 40calloc(size_t num, size_t size)
41 size_t num;
42 register size_t size;
43{ 41{
44 register void *p; 42 void *p;
45 43
46 if (num && size && SIZE_T_MAX / num < size) { 44 if (num && size && SIZE_T_MAX / num < size) {
47 errno = ENOMEM; 45 errno = ENOMEM;
diff --git a/src/lib/libc/stdlib/cfree.c b/src/lib/libc/stdlib/cfree.c
index ecbc11d6c3..db1fa56039 100644
--- a/src/lib/libc/stdlib/cfree.c
+++ b/src/lib/libc/stdlib/cfree.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cfree.c,v 1.3 2003/07/18 23:05:13 david Exp $ */ 1/* $OpenBSD: cfree.c,v 1.4 2005/03/30 18:51:49 pat Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> 4 * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@@ -26,7 +26,7 @@
26 */ 26 */
27 27
28#if defined(LIBC_SCCS) && !defined(lint) 28#if defined(LIBC_SCCS) && !defined(lint)
29static char rcsid[] = "$OpenBSD: cfree.c,v 1.3 2003/07/18 23:05:13 david Exp $"; 29static char rcsid[] = "$OpenBSD: cfree.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
30#endif /* LIBC_SCCS and not lint */ 30#endif /* LIBC_SCCS and not lint */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
@@ -37,8 +37,7 @@ __indr_reference(free, cfree);
37#else 37#else
38 38
39void 39void
40cfree(p) 40cfree(void *p)
41 void *p;
42{ 41{
43 free(p); 42 free(p);
44} 43}
diff --git a/src/lib/libc/stdlib/div.c b/src/lib/libc/stdlib/div.c
index 9e070dcd64..32c53dff03 100644
--- a/src/lib/libc/stdlib/div.c
+++ b/src/lib/libc/stdlib/div.c
@@ -31,14 +31,13 @@
31 */ 31 */
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: div.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; 34static char *rcsid = "$OpenBSD: div.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <stdlib.h> /* div_t */ 37#include <stdlib.h> /* div_t */
38 38
39div_t 39div_t
40div(num, denom) 40div(int num, int denom)
41 int num, denom;
42{ 41{
43 div_t r; 42 div_t r;
44 43
diff --git a/src/lib/libc/stdlib/exit.c b/src/lib/libc/stdlib/exit.c
index a75b32abeb..a0960e83c4 100644
--- a/src/lib/libc/stdlib/exit.c
+++ b/src/lib/libc/stdlib/exit.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: exit.c,v 1.9 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: exit.c,v 1.10 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/types.h> 34#include <sys/types.h>
@@ -51,11 +51,10 @@ int __isthreaded = 0;
51 * Exit, flushing stdio buffers if necessary. 51 * Exit, flushing stdio buffers if necessary.
52 */ 52 */
53void 53void
54exit(status) 54exit(int status)
55 int status;
56{ 55{
57 register struct atexit *p, *q; 56 struct atexit *p, *q;
58 register int n, pgsize = getpagesize(); 57 int n, pgsize = getpagesize();
59 58
60 if (!__atexit_invalid) { 59 if (!__atexit_invalid) {
61 p = __atexit; 60 p = __atexit;
diff --git a/src/lib/libc/stdlib/getenv.c b/src/lib/libc/stdlib/getenv.c
index c597e468a9..7e4d6b91a9 100644
--- a/src/lib/libc/stdlib/getenv.c
+++ b/src/lib/libc/stdlib/getenv.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: getenv.c,v 1.6 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: getenv.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
@@ -49,9 +49,9 @@ char *
49__findenv(const char *name, int *offset) 49__findenv(const char *name, int *offset)
50{ 50{
51 extern char **environ; 51 extern char **environ;
52 register int len, i; 52 int len, i;
53 register const char *np; 53 const char *np;
54 register char **p, *cp; 54 char **p, *cp;
55 55
56 if (name == NULL || environ == NULL) 56 if (name == NULL || environ == NULL)
57 return (NULL); 57 return (NULL);
@@ -75,8 +75,7 @@ __findenv(const char *name, int *offset)
75 * Returns ptr to value associated with name, if any, else NULL. 75 * Returns ptr to value associated with name, if any, else NULL.
76 */ 76 */
77char * 77char *
78getenv(name) 78getenv(const char *name)
79 const char *name;
80{ 79{
81 int offset; 80 int offset;
82 81
diff --git a/src/lib/libc/stdlib/getopt_long.c b/src/lib/libc/stdlib/getopt_long.c
index bf50195b94..6ddc8e2060 100644
--- a/src/lib/libc/stdlib/getopt_long.c
+++ b/src/lib/libc/stdlib/getopt_long.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getopt_long.c,v 1.17 2004/06/03 18:46:52 millert Exp $ */ 1/* $OpenBSD: getopt_long.c,v 1.18 2005/03/30 18:51:49 pat Exp $ */
2/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ 2/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
3 3
4/* 4/*
@@ -57,7 +57,7 @@
57 */ 57 */
58 58
59#if defined(LIBC_SCCS) && !defined(lint) 59#if defined(LIBC_SCCS) && !defined(lint)
60static char *rcsid = "$OpenBSD: getopt_long.c,v 1.17 2004/06/03 18:46:52 millert Exp $"; 60static char *rcsid = "$OpenBSD: getopt_long.c,v 1.18 2005/03/30 18:51:49 pat Exp $";
61#endif /* LIBC_SCCS and not lint */ 61#endif /* LIBC_SCCS and not lint */
62 62
63#include <err.h> 63#include <err.h>
@@ -515,12 +515,8 @@ getopt(int nargc, char * const *nargv, const char *options)
515 * Parse argc/argv argument vector. 515 * Parse argc/argv argument vector.
516 */ 516 */
517int 517int
518getopt_long(nargc, nargv, options, long_options, idx) 518getopt_long(int nargc, char * const *nargv, const char *options,
519 int nargc; 519 const struct option *long_options, int *idx)
520 char * const *nargv;
521 const char *options;
522 const struct option *long_options;
523 int *idx;
524{ 520{
525 521
526 return (getopt_internal(nargc, nargv, options, long_options, idx, 522 return (getopt_internal(nargc, nargv, options, long_options, idx,
@@ -532,12 +528,8 @@ getopt_long(nargc, nargv, options, long_options, idx)
532 * Parse argc/argv argument vector. 528 * Parse argc/argv argument vector.
533 */ 529 */
534int 530int
535getopt_long_only(nargc, nargv, options, long_options, idx) 531getopt_long_only(int nargc, char * const *nargv, const char *options,
536 int nargc; 532 const struct option *long_options, int *idx)
537 char * const *nargv;
538 const char *options;
539 const struct option *long_options;
540 int *idx;
541{ 533{
542 534
543 return (getopt_internal(nargc, nargv, options, long_options, idx, 535 return (getopt_internal(nargc, nargv, options, long_options, idx,
diff --git a/src/lib/libc/stdlib/getsubopt.c b/src/lib/libc/stdlib/getsubopt.c
index 308458ea75..dfd7a50bd8 100644
--- a/src/lib/libc/stdlib/getsubopt.c
+++ b/src/lib/libc/stdlib/getsubopt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert Exp $ */ 1/* $OpenBSD: getsubopt.c,v 1.3 2005/03/30 18:51:49 pat Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
@@ -33,7 +33,7 @@
33#if 0 33#if 0
34static char sccsid[] = "@(#)getsubopt.c 8.1 (Berkeley) 6/4/93"; 34static char sccsid[] = "@(#)getsubopt.c 8.1 (Berkeley) 6/4/93";
35#else 35#else
36static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert Exp $"; 36static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.3 2005/03/30 18:51:49 pat Exp $";
37#endif 37#endif
38#endif /* not lint */ 38#endif /* not lint */
39 39
@@ -50,12 +50,10 @@ static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert E
50char *suboptarg; 50char *suboptarg;
51 51
52int 52int
53getsubopt(optionp, tokens, valuep) 53getsubopt(char **optionp, char * const *tokens, char **valuep)
54 register char **optionp, **valuep;
55 register char * const *tokens;
56{ 54{
57 register int cnt; 55 int cnt;
58 register char *p; 56 char *p;
59 57
60 suboptarg = *valuep = NULL; 58 suboptarg = *valuep = NULL;
61 59
diff --git a/src/lib/libc/stdlib/heapsort.c b/src/lib/libc/stdlib/heapsort.c
index f4aeeef7a3..dcc0c8baad 100644
--- a/src/lib/libc/stdlib/heapsort.c
+++ b/src/lib/libc/stdlib/heapsort.c
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: heapsort.c,v 1.6 2003/09/08 16:24:05 deraadt Exp $"; 34static char *rcsid = "$OpenBSD: heapsort.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <sys/types.h> 37#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
134 * only advantage over quicksort is that it requires little additional memory. 134 * only advantage over quicksort is that it requires little additional memory.
135 */ 135 */
136int 136int
137heapsort(vbase, nmemb, size, compar) 137heapsort(void *vbase, size_t nmemb, size_t size,
138 void *vbase; 138 int (*compar)(const void *, const void *))
139 size_t nmemb, size;
140 int (*compar)(const void *, const void *);
141{ 139{
142 register int cnt, i, j, l; 140 int cnt, i, j, l;
143 register char tmp, *tmp1, *tmp2; 141 char tmp, *tmp1, *tmp2;
144 char *base, *k, *p, *t; 142 char *base, *k, *p, *t;
145 143
146 if (nmemb <= 1) 144 if (nmemb <= 1)
diff --git a/src/lib/libc/stdlib/l64a.c b/src/lib/libc/stdlib/l64a.c
index 4e99391254..325b41b33b 100644
--- a/src/lib/libc/stdlib/l64a.c
+++ b/src/lib/libc/stdlib/l64a.c
@@ -4,15 +4,14 @@
4 */ 4 */
5 5
6#if defined(LIBC_SCCS) && !defined(lint) 6#if defined(LIBC_SCCS) && !defined(lint)
7static char *rcsid = "$OpenBSD: l64a.c,v 1.3 1997/08/17 22:58:34 millert Exp $"; 7static char *rcsid = "$OpenBSD: l64a.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
8#endif /* LIBC_SCCS and not lint */ 8#endif /* LIBC_SCCS and not lint */
9 9
10#include <errno.h> 10#include <errno.h>
11#include <stdlib.h> 11#include <stdlib.h>
12 12
13char * 13char *
14l64a(value) 14l64a(long value)
15 long value;
16{ 15{
17 static char buf[8]; 16 static char buf[8];
18 char *s = buf; 17 char *s = buf;
diff --git a/src/lib/libc/stdlib/labs.c b/src/lib/libc/stdlib/labs.c
index 51ef490d97..1dc8b0184a 100644
--- a/src/lib/libc/stdlib/labs.c
+++ b/src/lib/libc/stdlib/labs.c
@@ -28,14 +28,13 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: labs.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; 31static char *rcsid = "$OpenBSD: labs.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36long 36long
37labs(j) 37labs(long j)
38 long j;
39{ 38{
40 return(j < 0 ? -j : j); 39 return(j < 0 ? -j : j);
41} 40}
diff --git a/src/lib/libc/stdlib/ldiv.c b/src/lib/libc/stdlib/ldiv.c
index e005ff77de..bbb539a68b 100644
--- a/src/lib/libc/stdlib/ldiv.c
+++ b/src/lib/libc/stdlib/ldiv.c
@@ -31,14 +31,13 @@
31 */ 31 */
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: ldiv.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; 34static char *rcsid = "$OpenBSD: ldiv.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <stdlib.h> /* ldiv_t */ 37#include <stdlib.h> /* ldiv_t */
38 38
39ldiv_t 39ldiv_t
40ldiv(num, denom) 40ldiv(long num, long denom)
41 long num, denom;
42{ 41{
43 ldiv_t r; 42 ldiv_t r;
44 43
diff --git a/src/lib/libc/stdlib/merge.c b/src/lib/libc/stdlib/merge.c
index 1826acc369..b193ae345c 100644
--- a/src/lib/libc/stdlib/merge.c
+++ b/src/lib/libc/stdlib/merge.c
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: merge.c,v 1.6 2003/06/02 20:18:38 millert Exp $"; 34static char *rcsid = "$OpenBSD: merge.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37/* 37/*
@@ -91,15 +91,12 @@ static void insertionsort(u_char *, size_t, size_t, int (*)());
91 * Arguments are as for qsort. 91 * Arguments are as for qsort.
92 */ 92 */
93int 93int
94mergesort(base, nmemb, size, cmp) 94mergesort(void *base, size_t nmemb, size_t size,
95 void *base; 95 int (*cmp)(const void *, const void *))
96 size_t nmemb;
97 register size_t size;
98 int (*cmp)(const void *, const void *);
99{ 96{
100 register int i, sense; 97 int i, sense;
101 int big, iflag; 98 int big, iflag;
102 register u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2; 99 u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
103 u_char *list2, *list1, *p2, *p, *last, **p1; 100 u_char *list2, *list1, *p2, *p, *last, **p1;
104 101
105 if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */ 102 if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */
@@ -251,10 +248,8 @@ COPY: b = t;
251 * is defined. Otherwise simple pairwise merging is used.) 248 * is defined. Otherwise simple pairwise merging is used.)
252 */ 249 */
253void 250void
254setup(list1, list2, n, size, cmp) 251setup(u_char *list1, u_char *list2, size_t n, size_t size,
255 size_t n, size; 252 int (*cmp)(const void *, const void *))
256 int (*cmp)(const void *, const void *);
257 u_char *list1, *list2;
258{ 253{
259 int i, length, size2, tmp, sense; 254 int i, length, size2, tmp, sense;
260 u_char *f1, *f2, *s, *l2, *last, *p2; 255 u_char *f1, *f2, *s, *l2, *last, *p2;
@@ -325,10 +320,8 @@ setup(list1, list2, n, size, cmp)
325 * last 4 elements. 320 * last 4 elements.
326 */ 321 */
327static void 322static void
328insertionsort(a, n, size, cmp) 323insertionsort(u_char *a, size_t n, size_t size,
329 u_char *a; 324 int (*cmp)(const void *, const void *))
330 size_t n, size;
331 int (*cmp)(const void *, const void *);
332{ 325{
333 u_char *ai, *s, *t, *u, tmp; 326 u_char *ai, *s, *t, *u, tmp;
334 int i; 327 int i;
diff --git a/src/lib/libc/stdlib/putenv.c b/src/lib/libc/stdlib/putenv.c
index 1789e686ef..231982bf87 100644
--- a/src/lib/libc/stdlib/putenv.c
+++ b/src/lib/libc/stdlib/putenv.c
@@ -28,15 +28,14 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: putenv.c,v 1.3 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: putenv.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35#include <string.h> 35#include <string.h>
36 36
37int 37int
38putenv(str) 38putenv(const char *str)
39 const char *str;
40{ 39{
41 char *p, *equal; 40 char *p, *equal;
42 int rval; 41 int rval;
diff --git a/src/lib/libc/stdlib/qabs.c b/src/lib/libc/stdlib/qabs.c
index 296d2d4742..4c561b3351 100644
--- a/src/lib/libc/stdlib/qabs.c
+++ b/src/lib/libc/stdlib/qabs.c
@@ -28,14 +28,13 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: qabs.c,v 1.3 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: qabs.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35 35
36quad_t 36quad_t
37qabs(j) 37qabs(quad_t j)
38 quad_t j;
39{ 38{
40 return(j < 0 ? -j : j); 39 return(j < 0 ? -j : j);
41} 40}
diff --git a/src/lib/libc/stdlib/qdiv.c b/src/lib/libc/stdlib/qdiv.c
index 6688ccb712..8147ee89a6 100644
--- a/src/lib/libc/stdlib/qdiv.c
+++ b/src/lib/libc/stdlib/qdiv.c
@@ -31,14 +31,13 @@
31 */ 31 */
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: qdiv.c,v 1.3 2003/06/02 20:18:38 millert Exp $"; 34static char *rcsid = "$OpenBSD: qdiv.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <stdlib.h> /* qdiv_t */ 37#include <stdlib.h> /* qdiv_t */
38 38
39qdiv_t 39qdiv_t
40qdiv(num, denom) 40qdiv(quad_t num, quad_t denom)
41 quad_t num, denom;
42{ 41{
43 qdiv_t r; 42 qdiv_t r;
44 43
diff --git a/src/lib/libc/stdlib/qsort.c b/src/lib/libc/stdlib/qsort.c
index 2a972c0eb0..154c51a86c 100644
--- a/src/lib/libc/stdlib/qsort.c
+++ b/src/lib/libc/stdlib/qsort.c
@@ -28,13 +28,13 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: qsort.c,v 1.8 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: qsort.c,v 1.9 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/types.h> 34#include <sys/types.h>
35#include <stdlib.h> 35#include <stdlib.h>
36 36
37static __inline char *med3(char *, char *, char *, int (*)()); 37static __inline char *med3(char *, char *, char *, int (*)(const void *, const void *));
38static __inline void swapfunc(char *, char *, int, int); 38static __inline void swapfunc(char *, char *, int, int);
39 39
40#define min(a, b) (a) < (b) ? a : b 40#define min(a, b) (a) < (b) ? a : b
@@ -44,10 +44,10 @@ static __inline void swapfunc(char *, char *, int, int);
44 */ 44 */
45#define swapcode(TYPE, parmi, parmj, n) { \ 45#define swapcode(TYPE, parmi, parmj, n) { \
46 long i = (n) / sizeof (TYPE); \ 46 long i = (n) / sizeof (TYPE); \
47 register TYPE *pi = (TYPE *) (parmi); \ 47 TYPE *pi = (TYPE *) (parmi); \
48 register TYPE *pj = (TYPE *) (parmj); \ 48 TYPE *pj = (TYPE *) (parmj); \
49 do { \ 49 do { \
50 register TYPE t = *pi; \ 50 TYPE t = *pi; \
51 *pi++ = *pj; \ 51 *pi++ = *pj; \
52 *pj++ = t; \ 52 *pj++ = t; \
53 } while (--i > 0); \ 53 } while (--i > 0); \
@@ -57,9 +57,7 @@ static __inline void swapfunc(char *, char *, int, int);
57 es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; 57 es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;
58 58
59static __inline void 59static __inline void
60swapfunc(a, b, n, swaptype) 60swapfunc(char *a, char *b, int n, int swaptype)
61 char *a, *b;
62 int n, swaptype;
63{ 61{
64 if (swaptype <= 1) 62 if (swaptype <= 1)
65 swapcode(long, a, b, n) 63 swapcode(long, a, b, n)
@@ -78,9 +76,7 @@ swapfunc(a, b, n, swaptype)
78#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) 76#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype)
79 77
80static __inline char * 78static __inline char *
81med3(a, b, c, cmp) 79med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *))
82 char *a, *b, *c;
83 int (*cmp)();
84{ 80{
85 return cmp(a, b) < 0 ? 81 return cmp(a, b) < 0 ?
86 (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a )) 82 (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a ))
@@ -88,14 +84,11 @@ med3(a, b, c, cmp)
88} 84}
89 85
90void 86void
91qsort(aa, n, es, cmp) 87qsort(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *))
92 void *aa;
93 size_t n, es;
94 int (*cmp)();
95{ 88{
96 char *pa, *pb, *pc, *pd, *pl, *pm, *pn; 89 char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
97 int d, r, swaptype, swap_cnt; 90 int d, r, swaptype, swap_cnt;
98 register char *a = aa; 91 char *a = aa;
99 92
100loop: SWAPINIT(a, es); 93loop: SWAPINIT(a, es);
101 swap_cnt = 0; 94 swap_cnt = 0;
diff --git a/src/lib/libc/stdlib/radixsort.c b/src/lib/libc/stdlib/radixsort.c
index 1ff30416d9..96392ea73a 100644
--- a/src/lib/libc/stdlib/radixsort.c
+++ b/src/lib/libc/stdlib/radixsort.c
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: radixsort.c,v 1.6 2003/06/02 20:18:38 millert Exp $"; 34static char *rcsid = "$OpenBSD: radixsort.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37/* 37/*
@@ -85,10 +85,7 @@ static void r_sort_b(const u_char **,
85} 85}
86 86
87int 87int
88radixsort(a, n, tab, endch) 88radixsort(const u_char **a, int n, const u_char *tab, u_int endch)
89 const u_char **a, *tab;
90 int n;
91 u_int endch;
92{ 89{
93 const u_char *tr; 90 const u_char *tr;
94 int c; 91 int c;
@@ -100,10 +97,7 @@ radixsort(a, n, tab, endch)
100} 97}
101 98
102int 99int
103sradixsort(a, n, tab, endch) 100sradixsort(const u_char **a, int n, const u_char *tab, u_int endch)
104 const u_char **a, *tab;
105 int n;
106 u_int endch;
107{ 101{
108 const u_char *tr, **ta; 102 const u_char *tr, **ta;
109 int c; 103 int c;
@@ -128,15 +122,11 @@ sradixsort(a, n, tab, endch)
128 122
129/* Unstable, in-place sort. */ 123/* Unstable, in-place sort. */
130void 124void
131r_sort_a(a, n, i, tr, endch) 125r_sort_a(const u_char **a, int n, int i, const u_char *tr, u_int endch)
132 const u_char **a;
133 int n, i;
134 const u_char *tr;
135 u_int endch;
136{ 126{
137 static int count[256], nc, bmin; 127 static int count[256], nc, bmin;
138 register int c; 128 int c;
139 register const u_char **ak, *r; 129 const u_char **ak, *r;
140 stack s[SIZE], *sp, *sp0, *sp1, temp; 130 stack s[SIZE], *sp, *sp0, *sp1, temp;
141 int *cp, bigc; 131 int *cp, bigc;
142 const u_char **an, *t, **aj, **top[256]; 132 const u_char **an, *t, **aj, **top[256];
@@ -219,15 +209,12 @@ r_sort_a(a, n, i, tr, endch)
219 209
220/* Stable sort, requiring additional memory. */ 210/* Stable sort, requiring additional memory. */
221void 211void
222r_sort_b(a, ta, n, i, tr, endch) 212r_sort_b(const u_char **a, const u_char **ta, int n, int i, const u_char *tr,
223 const u_char **a, **ta; 213 u_int endch)
224 int n, i;
225 const u_char *tr;
226 u_int endch;
227{ 214{
228 static int count[256], nc, bmin; 215 static int count[256], nc, bmin;
229 register int c; 216 int c;
230 register const u_char **ak, **ai; 217 const u_char **ak, **ai;
231 stack s[512], *sp, *sp0, *sp1, temp; 218 stack s[512], *sp, *sp0, *sp1, temp;
232 const u_char **top[256]; 219 const u_char **top[256];
233 int *cp, bigc; 220 int *cp, bigc;
@@ -291,13 +278,10 @@ r_sort_b(a, ta, n, i, tr, endch)
291} 278}
292 279
293static __inline void 280static __inline void
294simplesort(a, n, b, tr, endch) /* insertion sort */ 281simplesort(const u_char **a, int n, int b, const u_char *tr, u_int endch)
295 register const u_char **a; 282 /* insertion sort */
296 int n, b;
297 register const u_char *tr;
298 u_int endch;
299{ 283{
300 register u_char ch; 284 u_char ch;
301 const u_char **ak, **ai, *s, *t; 285 const u_char **ak, **ai, *s, *t;
302 286
303 for (ak = a+1; --n >= 1; ak++) 287 for (ak = a+1; --n >= 1; ak++)
diff --git a/src/lib/libc/stdlib/rand.c b/src/lib/libc/stdlib/rand.c
index d58d040ad5..6b27ad46d3 100644
--- a/src/lib/libc/stdlib/rand.c
+++ b/src/lib/libc/stdlib/rand.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: rand.c,v 1.7 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: rand.c,v 1.8 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/types.h> 34#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 $";
37static u_int next = 1; 37static u_int next = 1;
38 38
39int 39int
40rand_r(seed) 40rand_r(u_int *seed)
41u_int *seed;
42{ 41{
43
44 *seed = *seed * 1103515245 + 12345; 42 *seed = *seed * 1103515245 + 12345;
45 return (*seed % ((u_int)RAND_MAX + 1)); 43 return (*seed % ((u_int)RAND_MAX + 1));
46} 44}
47 45
48int 46int
49rand() 47rand(void)
50{ 48{
51
52 return (rand_r(&next)); 49 return (rand_r(&next));
53} 50}
54 51
55void 52void
56srand(seed) 53srand(u_int seed)
57u_int seed;
58{ 54{
59
60 next = seed; 55 next = seed;
61} 56}
diff --git a/src/lib/libc/stdlib/random.c b/src/lib/libc/stdlib/random.c
index 4807d2f27d..4ca8735e75 100644
--- a/src/lib/libc/stdlib/random.c
+++ b/src/lib/libc/stdlib/random.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: random.c,v 1.12 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: random.c,v 1.13 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/param.h> 34#include <sys/param.h>
@@ -190,8 +190,7 @@ static int rand_sep = SEP_3;
190 * for default usage relies on values produced by this routine. 190 * for default usage relies on values produced by this routine.
191 */ 191 */
192void 192void
193srandom(x) 193srandom(unsigned int x)
194 unsigned int x;
195{ 194{
196 int i; 195 int i;
197 int32_t test; 196 int32_t test;
@@ -232,7 +231,7 @@ srandom(x)
232 * a fixed seed. 231 * a fixed seed.
233 */ 232 */
234void 233void
235srandomdev() 234srandomdev(void)
236{ 235{
237 int fd, i, mib[2], n; 236 int fd, i, mib[2], n;
238 size_t len; 237 size_t len;
@@ -299,10 +298,7 @@ srandomdev()
299 * Returns a pointer to the old state. 298 * Returns a pointer to the old state.
300 */ 299 */
301char * 300char *
302initstate(seed, arg_state, n) 301initstate(u_int seed, char *arg_state, size_t n)
303 u_int seed; /* seed for R.N.G. */
304 char *arg_state; /* pointer to state array */
305 size_t n; /* # bytes of state info */
306{ 302{
307 char *ostate = (char *)(&state[-1]); 303 char *ostate = (char *)(&state[-1]);
308 304
@@ -359,8 +355,7 @@ initstate(seed, arg_state, n)
359 * Returns a pointer to the old state information. 355 * Returns a pointer to the old state information.
360 */ 356 */
361char * 357char *
362setstate(arg_state) 358setstate(const char *arg_state)
363 const char *arg_state;
364{ 359{
365 int32_t *new_state = (int32_t *)arg_state; 360 int32_t *new_state = (int32_t *)arg_state;
366 int32_t type = new_state[0] % MAX_TYPES; 361 int32_t type = new_state[0] % MAX_TYPES;
@@ -411,7 +406,7 @@ setstate(arg_state)
411 * Returns a 31-bit random number. 406 * Returns a 31-bit random number.
412 */ 407 */
413long 408long
414random() 409random(void)
415{ 410{
416 int32_t i; 411 int32_t i;
417 412
diff --git a/src/lib/libc/stdlib/setenv.c b/src/lib/libc/stdlib/setenv.c
index 40305dbe1c..ce0d3f9699 100644
--- a/src/lib/libc/stdlib/setenv.c
+++ b/src/lib/libc/stdlib/setenv.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: setenv.c,v 1.7 2005/02/16 21:20:22 millert Exp $"; 31static char *rcsid = "$OpenBSD: setenv.c,v 1.8 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <stdlib.h> 34#include <stdlib.h>
@@ -44,10 +44,7 @@ extern char **environ;
44 * "value". If rewrite is set, replace any current value. 44 * "value". If rewrite is set, replace any current value.
45 */ 45 */
46int 46int
47setenv(name, value, rewrite) 47setenv(const char *name, const char *value, int rewrite)
48 const char *name;
49 const char *value;
50 int rewrite;
51{ 48{
52 static char **lastenv; /* last value of environ */ 49 static char **lastenv; /* last value of environ */
53 char *C; 50 char *C;
@@ -97,8 +94,7 @@ setenv(name, value, rewrite)
97 * Delete environmental variable "name". 94 * Delete environmental variable "name".
98 */ 95 */
99void 96void
100unsetenv(name) 97unsetenv(const char *name)
101 const char *name;
102{ 98{
103 char **P; 99 char **P;
104 int offset; 100 int offset;
diff --git a/src/lib/libc/stdlib/strtod.c b/src/lib/libc/stdlib/strtod.c
index 8e839d6155..94eca88659 100644
--- a/src/lib/libc/stdlib/strtod.c
+++ b/src/lib/libc/stdlib/strtod.c
@@ -79,7 +79,6 @@
79 * #define Just_16 to store 16 bits per 32-bit Long when doing high-precision 79 * #define Just_16 to store 16 bits per 32-bit Long when doing high-precision
80 * integer arithmetic. Whether this speeds things up or slows things 80 * integer arithmetic. Whether this speeds things up or slows things
81 * down depends on the machine and the number being converted. 81 * down depends on the machine and the number being converted.
82 * #define KR_headers for old-style C function headers.
83 * #define Bad_float_h if your system lacks a float.h or if it does not 82 * #define Bad_float_h if your system lacks a float.h or if it does not
84 * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, 83 * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP,
85 * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. 84 * FLT_RADIX, FLT_ROUNDS, and DBL_MAX.
@@ -90,7 +89,7 @@
90 */ 89 */
91 90
92#if defined(LIBC_SCCS) && !defined(lint) 91#if defined(LIBC_SCCS) && !defined(lint)
93static char *rcsid = "$OpenBSD: strtod.c,v 1.19 2004/02/03 16:52:11 drahn Exp $"; 92static char *rcsid = "$OpenBSD: strtod.c,v 1.20 2005/03/30 18:51:49 pat Exp $";
94#endif /* LIBC_SCCS and not lint */ 93#endif /* LIBC_SCCS and not lint */
95 94
96#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ 95#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 $"
130#include "malloc.h" 129#include "malloc.h"
131#include "memory.h" 130#include "memory.h"
132#else 131#else
133#ifndef KR_headers
134#include "stdlib.h" 132#include "stdlib.h"
135#include "string.h" 133#include "string.h"
136#include "locale.h" 134#include "locale.h"
137#else
138#include "malloc.h"
139#include "memory.h"
140#endif
141#endif 135#endif
142 136
143#ifdef MALLOC 137#ifdef MALLOC
144#ifdef KR_headers
145extern char *MALLOC();
146#else
147extern void *MALLOC(size_t); 138extern void *MALLOC(size_t);
148#endif
149#else 139#else
150#define MALLOC malloc 140#define MALLOC malloc
151#endif 141#endif
@@ -203,12 +193,8 @@ extern "C" {
203#endif 193#endif
204 194
205#ifndef CONST 195#ifndef CONST
206#ifdef KR_headers
207#define CONST /* blank */
208#else
209#define CONST const 196#define CONST const
210#endif 197#endif
211#endif
212 198
213#ifdef Unsigned_Shifts 199#ifdef Unsigned_Shifts
214#define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000; 200#define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000;
@@ -341,11 +327,7 @@ typedef union {
341#ifdef RND_PRODQUOT 327#ifdef RND_PRODQUOT
342#define rounded_product(a,b) a = rnd_prod(a, b) 328#define rounded_product(a,b) a = rnd_prod(a, b)
343#define rounded_quotient(a,b) a = rnd_quot(a, b) 329#define rounded_quotient(a,b) a = rnd_quot(a, b)
344#ifdef KR_headers
345extern double rnd_prod(), rnd_quot();
346#else
347extern double rnd_prod(double, double), rnd_quot(double, double); 330extern double rnd_prod(double, double), rnd_quot(double, double);
348#endif
349#else 331#else
350#define rounded_product(a,b) a *= b 332#define rounded_product(a,b) a *= b
351#define rounded_quotient(a,b) a /= b 333#define rounded_quotient(a,b) a /= b
@@ -385,12 +367,7 @@ Bigint {
385 static Bigint *freelist[Kmax+1]; 367 static Bigint *freelist[Kmax+1];
386 368
387 static Bigint * 369 static Bigint *
388Balloc 370Balloc(int k)
389#ifdef KR_headers
390 (k) int k;
391#else
392 (int k)
393#endif
394{ 371{
395 int x; 372 int x;
396 Bigint *rv; 373 Bigint *rv;
@@ -409,12 +386,7 @@ Balloc
409 } 386 }
410 387
411 static void 388 static void
412Bfree 389Bfree(Bigint *v)
413#ifdef KR_headers
414 (v) Bigint *v;
415#else
416 (Bigint *v)
417#endif
418{ 390{
419 if (v) { 391 if (v) {
420 v->next = freelist[v->k]; 392 v->next = freelist[v->k];
@@ -426,12 +398,7 @@ Bfree
426y->wds*sizeof(Long) + 2*sizeof(int)) 398y->wds*sizeof(Long) + 2*sizeof(int))
427 399
428 static Bigint * 400 static Bigint *
429multadd 401multadd(Bigint *b, int m, int a) /* multiply by m and add a */
430#ifdef KR_headers
431 (b, m, a) Bigint *b; int m, a;
432#else
433 (Bigint *b, int m, int a) /* multiply by m and add a */
434#endif
435{ 402{
436 int i, wds; 403 int i, wds;
437 ULong *x, y; 404 ULong *x, y;
@@ -471,12 +438,7 @@ multadd
471 } 438 }
472 439
473 static Bigint * 440 static Bigint *
474s2b 441s2b(CONST char *s, int nd0, int nd, ULong y9)
475#ifdef KR_headers
476 (s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9;
477#else
478 (CONST char *s, int nd0, int nd, ULong y9)
479#endif
480{ 442{
481 Bigint *b; 443 Bigint *b;
482 int i, k; 444 int i, k;
@@ -509,14 +471,9 @@ s2b
509 } 471 }
510 472
511 static int 473 static int
512hi0bits 474hi0bits(ULong x)
513#ifdef KR_headers
514 (x) register ULong x;
515#else
516 (register ULong x)
517#endif
518{ 475{
519 register int k = 0; 476 int k = 0;
520 477
521 if (!(x & 0xffff0000)) { 478 if (!(x & 0xffff0000)) {
522 k = 16; 479 k = 16;
@@ -543,15 +500,10 @@ hi0bits
543 } 500 }
544 501
545 static int 502 static int
546lo0bits 503lo0bits(ULong *y)
547#ifdef KR_headers
548 (y) ULong *y;
549#else
550 (ULong *y)
551#endif
552{ 504{
553 register int k; 505 int k;
554 register ULong x = *y; 506 ULong x = *y;
555 507
556 if (x & 7) { 508 if (x & 7) {
557 if (x & 1) 509 if (x & 1)
@@ -591,12 +543,7 @@ lo0bits
591 } 543 }
592 544
593 static Bigint * 545 static Bigint *
594i2b 546i2b(int i)
595#ifdef KR_headers
596 (i) int i;
597#else
598 (int i)
599#endif
600{ 547{
601 Bigint *b; 548 Bigint *b;
602 549
@@ -607,12 +554,7 @@ i2b
607 } 554 }
608 555
609 static Bigint * 556 static Bigint *
610mult 557mult(Bigint *a, Bigint *b)
611#ifdef KR_headers
612 (a, b) Bigint *a, *b;
613#else
614 (Bigint *a, Bigint *b)
615#endif
616{ 558{
617 Bigint *c; 559 Bigint *c;
618 int k, wa, wb, wc; 560 int k, wa, wb, wc;
@@ -697,12 +639,7 @@ mult
697 static Bigint *p5s; 639 static Bigint *p5s;
698 640
699 static Bigint * 641 static Bigint *
700pow5mult 642pow5mult(Bigint *b, int k)
701#ifdef KR_headers
702 (b, k) Bigint *b; int k;
703#else
704 (Bigint *b, int k)
705#endif
706{ 643{
707 Bigint *b1, *p5, *p51; 644 Bigint *b1, *p5, *p51;
708 int i; 645 int i;
@@ -736,12 +673,7 @@ pow5mult
736 } 673 }
737 674
738 static Bigint * 675 static Bigint *
739lshift 676lshift(Bigint *b, int k)
740#ifdef KR_headers
741 (b, k) Bigint *b; int k;
742#else
743 (Bigint *b, int k)
744#endif
745{ 677{
746 int i, k1, n, n1; 678 int i, k1, n, n1;
747 Bigint *b1; 679 Bigint *b1;
@@ -796,12 +728,7 @@ lshift
796 } 728 }
797 729
798 static int 730 static int
799cmp 731cmp(Bigint *a, Bigint *b)
800#ifdef KR_headers
801 (a, b) Bigint *a, *b;
802#else
803 (Bigint *a, Bigint *b)
804#endif
805{ 732{
806 ULong *xa, *xa0, *xb, *xb0; 733 ULong *xa, *xa0, *xb, *xb0;
807 int i, j; 734 int i, j;
@@ -830,12 +757,7 @@ cmp
830 } 757 }
831 758
832 static Bigint * 759 static Bigint *
833diff 760diff(Bigint *a, Bigint *b)
834#ifdef KR_headers
835 (a, b) Bigint *a, *b;
836#else
837 (Bigint *a, Bigint *b)
838#endif
839{ 761{
840 Bigint *c; 762 Bigint *c;
841 int i, wa, wb; 763 int i, wa, wb;
@@ -912,15 +834,10 @@ diff
912 } 834 }
913 835
914 static double 836 static double
915ulp 837ulp(double _x)
916#ifdef KR_headers
917 (_x) double _x;
918#else
919 (double _x)
920#endif
921{ 838{
922 _double x; 839 _double x;
923 register Long L; 840 Long L;
924 _double a; 841 _double a;
925 842
926 value(x) = _x; 843 value(x) = _x;
@@ -952,12 +869,7 @@ ulp
952 } 869 }
953 870
954 static double 871 static double
955b2d 872b2d(Bigint *a, int *e)
956#ifdef KR_headers
957 (a, e) Bigint *a; int *e;
958#else
959 (Bigint *a, int *e)
960#endif
961{ 873{
962 ULong *xa, *xa0, w, y, z; 874 ULong *xa, *xa0, w, y, z;
963 int k; 875 int k;
@@ -1022,12 +934,7 @@ b2d
1022 } 934 }
1023 935
1024 static Bigint * 936 static Bigint *
1025d2b 937d2b(double _d, int *e, int *bits)
1026#ifdef KR_headers
1027 (_d, e, bits) double d; int *e, *bits;
1028#else
1029 (double _d, int *e, int *bits)
1030#endif
1031{ 938{
1032 Bigint *b; 939 Bigint *b;
1033 int de, i, k; 940 int de, i, k;
@@ -1156,12 +1063,7 @@ d2b
1156#undef d1 1063#undef d1
1157 1064
1158 static double 1065 static double
1159ratio 1066ratio(Bigint *a, Bigint *b)
1160#ifdef KR_headers
1161 (a, b) Bigint *a, *b;
1162#else
1163 (Bigint *a, Bigint *b)
1164#endif
1165{ 1067{
1166 _double da, db; 1068 _double da, db;
1167 int k, ka, kb; 1069 int k, ka, kb;
@@ -1223,12 +1125,7 @@ static CONST double tinytens[] = { 1e-16, 1e-32 };
1223#endif 1125#endif
1224 1126
1225 double 1127 double
1226strtod 1128strtod(CONST char *s00, char **se)
1227#ifdef KR_headers
1228 (s00, se) CONST char *s00; char **se;
1229#else
1230 (CONST char *s00, char **se)
1231#endif
1232{ 1129{
1233 int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, 1130 int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
1234 e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; 1131 e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
@@ -1239,11 +1136,7 @@ strtod
1239 ULong y, z; 1136 ULong y, z;
1240 Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; 1137 Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
1241 1138
1242#ifndef KR_headers
1243 CONST char decimal_point = localeconv()->decimal_point[0]; 1139 CONST char decimal_point = localeconv()->decimal_point[0];
1244#else
1245 CONST char decimal_point = '.';
1246#endif
1247 1140
1248 sign = nz0 = nz = 0; 1141 sign = nz0 = nz = 0;
1249 value(rv) = 0.; 1142 value(rv) = 0.;
@@ -1769,12 +1662,7 @@ strtod
1769 } 1662 }
1770 1663
1771 static int 1664 static int
1772quorem 1665quorem(Bigint *b, Bigint *S)
1773#ifdef KR_headers
1774 (b, S) Bigint *b, *S;
1775#else
1776 (Bigint *b, Bigint *S)
1777#endif
1778{ 1666{
1779 int n; 1667 int n;
1780 Long borrow, y; 1668 Long borrow, y;
@@ -1909,13 +1797,7 @@ quorem
1909 */ 1797 */
1910 1798
1911 char * 1799 char *
1912__dtoa 1800__dtoa(double _d, int mode, int ndigits, int *decpt, int *sign, char **rve)
1913#ifdef KR_headers
1914 (_d, mode, ndigits, decpt, sign, rve)
1915 double _d; int mode, ndigits, *decpt, *sign; char **rve;
1916#else
1917 (double _d, int mode, int ndigits, int *decpt, int *sign, char **rve)
1918#endif
1919{ 1801{
1920 /* Arguments ndigits, decpt, sign are similar to those 1802 /* Arguments ndigits, decpt, sign are similar to those
1921 of ecvt and fcvt; trailing zeros are suppressed from 1803 of ecvt and fcvt; trailing zeros are suppressed from
diff --git a/src/lib/libc/stdlib/strtol.c b/src/lib/libc/stdlib/strtol.c
index 1c39720794..9692bb6b07 100644
--- a/src/lib/libc/stdlib/strtol.c
+++ b/src/lib/libc/stdlib/strtol.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: strtol.c,v 1.5 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: strtol.c,v 1.6 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <ctype.h> 34#include <ctype.h>
@@ -44,15 +44,12 @@ static char *rcsid = "$OpenBSD: strtol.c,v 1.5 2003/06/02 20:18:38 millert Exp $
44 * alphabets and digits are each contiguous. 44 * alphabets and digits are each contiguous.
45 */ 45 */
46long 46long
47strtol(nptr, endptr, base) 47strtol(const char *nptr, char **endptr, int base)
48 const char *nptr;
49 char **endptr;
50 register int base;
51{ 48{
52 register const char *s; 49 const char *s;
53 register long acc, cutoff; 50 long acc, cutoff;
54 register int c; 51 int c;
55 register int neg, any, cutlim; 52 int neg, any, cutlim;
56 53
57 /* 54 /*
58 * Skip white space and pick up leading +/- sign if any. 55 * Skip white space and pick up leading +/- sign if any.
diff --git a/src/lib/libc/stdlib/strtoll.c b/src/lib/libc/stdlib/strtoll.c
index 5002e9ed64..fa4d30ef5a 100644
--- a/src/lib/libc/stdlib/strtoll.c
+++ b/src/lib/libc/stdlib/strtoll.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static const char rcsid[] = "$OpenBSD: strtoll.c,v 1.3 2005/03/02 12:24:26 millert Exp $"; 31static const char rcsid[] = "$OpenBSD: strtoll.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/types.h> 34#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
45 * alphabets and digits are each contiguous. 45 * alphabets and digits are each contiguous.
46 */ 46 */
47long long 47long long
48strtoll(nptr, endptr, base) 48strtoll(const char *nptr, char **endptr, int base)
49 const char *nptr;
50 char **endptr;
51 int base;
52{ 49{
53 const char *s; 50 const char *s;
54 long long acc, cutoff; 51 long long acc, cutoff;
@@ -151,10 +148,7 @@ strtoll(nptr, endptr, base)
151__weak_alias(strtoq, strtoll); 148__weak_alias(strtoq, strtoll);
152#else 149#else
153quad_t 150quad_t
154strtoq(nptr, endptr, base) 151strtoq(const char *nptr, char **endptr, int base)
155 const char *nptr;
156 char **endptr;
157 int base;
158{ 152{
159 153
160 return ((quad_t)strtoll(nptr, endptr, base)); 154 return ((quad_t)strtoll(nptr, endptr, base));
diff --git a/src/lib/libc/stdlib/strtoul.c b/src/lib/libc/stdlib/strtoul.c
index 7d31ce79fb..1faa0abbd0 100644
--- a/src/lib/libc/stdlib/strtoul.c
+++ b/src/lib/libc/stdlib/strtoul.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: strtoul.c,v 1.5 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: strtoul.c,v 1.6 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <ctype.h> 34#include <ctype.h>
@@ -43,15 +43,12 @@ static char *rcsid = "$OpenBSD: strtoul.c,v 1.5 2003/06/02 20:18:38 millert Exp
43 * alphabets and digits are each contiguous. 43 * alphabets and digits are each contiguous.
44 */ 44 */
45unsigned long 45unsigned long
46strtoul(nptr, endptr, base) 46strtoul(const char *nptr, char **endptr, int base)
47 const char *nptr;
48 char **endptr;
49 register int base;
50{ 47{
51 register const char *s; 48 const char *s;
52 register unsigned long acc, cutoff; 49 unsigned long acc, cutoff;
53 register int c; 50 int c;
54 register int neg, any, cutlim; 51 int neg, any, cutlim;
55 52
56 /* 53 /*
57 * See strtol for comments as to the logic used. 54 * See strtol for comments as to the logic used.
diff --git a/src/lib/libc/stdlib/strtoull.c b/src/lib/libc/stdlib/strtoull.c
index c383f1d83f..5fa841fff7 100644
--- a/src/lib/libc/stdlib/strtoull.c
+++ b/src/lib/libc/stdlib/strtoull.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static const char rcsid[] = "$OpenBSD: strtoull.c,v 1.3 2005/03/02 12:24:26 millert Exp $"; 31static const char rcsid[] = "$OpenBSD: strtoull.c,v 1.4 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/types.h> 34#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
45 * alphabets and digits are each contiguous. 45 * alphabets and digits are each contiguous.
46 */ 46 */
47unsigned long long 47unsigned long long
48strtoull(nptr, endptr, base) 48strtoull(const char *nptr, char **endptr, int base)
49 const char *nptr;
50 char **endptr;
51 int base;
52{ 49{
53 const char *s; 50 const char *s;
54 unsigned long long acc, cutoff; 51 unsigned long long acc, cutoff;
@@ -113,10 +110,7 @@ strtoull(nptr, endptr, base)
113__weak_alias(strtouq, strtoull); 110__weak_alias(strtouq, strtoull);
114#else 111#else
115u_quad_t 112u_quad_t
116strtouq(nptr, endptr, base) 113strtouq(const char *nptr, char **endptr, int base)
117 const char *nptr;
118 char **endptr;
119 int base;
120{ 114{
121 115
122 return ((u_quad_t)strtoull(nptr, endptr, base)); 116 return ((u_quad_t)strtoull(nptr, endptr, base));
diff --git a/src/lib/libc/stdlib/system.c b/src/lib/libc/stdlib/system.c
index 06b439230b..ebf5577674 100644
--- a/src/lib/libc/stdlib/system.c
+++ b/src/lib/libc/stdlib/system.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#if defined(LIBC_SCCS) && !defined(lint) 30#if defined(LIBC_SCCS) && !defined(lint)
31static char *rcsid = "$OpenBSD: system.c,v 1.6 2003/06/02 20:18:38 millert Exp $"; 31static char *rcsid = "$OpenBSD: system.c,v 1.7 2005/03/30 18:51:49 pat Exp $";
32#endif /* LIBC_SCCS and not lint */ 32#endif /* LIBC_SCCS and not lint */
33 33
34#include <sys/types.h> 34#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 $
41extern char **environ; 41extern char **environ;
42 42
43int 43int
44system(command) 44system(const char *command)
45 const char *command;
46{ 45{
47 pid_t pid; 46 pid_t pid;
48 sig_t intsave, quitsave; 47 sig_t intsave, quitsave;
diff --git a/src/lib/libc/stdlib/tfind.c b/src/lib/libc/stdlib/tfind.c
index 34b916db6c..ff6bcd742d 100644
--- a/src/lib/libc/stdlib/tfind.c
+++ b/src/lib/libc/stdlib/tfind.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tfind.c,v 1.4 2004/10/01 04:08:45 jsg Exp $ */ 1/* $OpenBSD: tfind.c,v 1.5 2005/03/30 18:51:49 pat Exp $ */
2 2
3/* 3/*
4 * Tree search generalized from Knuth (6.2.2) Algorithm T just like 4 * Tree search generalized from Knuth (6.2.2) Algorithm T just like
@@ -21,10 +21,8 @@ typedef struct node_t
21 21
22/* find a node, or return 0 */ 22/* find a node, or return 0 */
23void * 23void *
24tfind(vkey, vrootp, compar) 24tfind(const void *vkey, void * const *vrootp,
25 const void *vkey; /* key to be found */ 25 int (*compar)(const void *, const void *))
26 void *const *vrootp; /* address of the tree root */
27 int (*compar)(const void *, const void *);
28{ 26{
29 char *key = (char *)vkey; 27 char *key = (char *)vkey;
30 node **rootp = (node **)vrootp; 28 node **rootp = (node **)vrootp;
diff --git a/src/lib/libc/stdlib/tsearch.c b/src/lib/libc/stdlib/tsearch.c
index 67388b4e7f..a5d0c2b9b3 100644
--- a/src/lib/libc/stdlib/tsearch.c
+++ b/src/lib/libc/stdlib/tsearch.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tsearch.c,v 1.4 2004/10/01 04:08:45 jsg Exp $ */ 1/* $OpenBSD: tsearch.c,v 1.5 2005/03/30 18:51:49 pat Exp $ */
2 2
3/* 3/*
4 * Tree search generalized from Knuth (6.2.2) Algorithm T just like 4 * Tree search generalized from Knuth (6.2.2) Algorithm T just like
@@ -22,12 +22,10 @@ typedef struct node_t {
22 22
23/* find or insert datum into search tree */ 23/* find or insert datum into search tree */
24void * 24void *
25tsearch(vkey, vrootp, compar) 25tsearch(const void *vkey, void **vrootp,
26 const void *vkey; /* key to be located */ 26 int (*compar)(const void *, const void *))
27 void **vrootp; /* address of tree root */
28 int (*compar)(const void *, const void *);
29{ 27{
30 register node *q; 28 node *q;
31 char *key = (char *)vkey; 29 char *key = (char *)vkey;
32 node **rootp = (node **)vrootp; 30 node **rootp = (node **)vrootp;
33 31
@@ -53,16 +51,14 @@ tsearch(vkey, vrootp, compar)
53 51
54/* delete node with given key */ 52/* delete node with given key */
55void * 53void *
56tdelete(vkey, vrootp, compar) 54tdelete(const void *vkey, void **vrootp,
57 const void *vkey; /* key to be deleted */ 55 int (*compar)(const void *, const void *))
58 void **vrootp; /* address of the root of tree */
59 int (*compar)(const void *, const void *);
60{ 56{
61 node **rootp = (node **)vrootp; 57 node **rootp = (node **)vrootp;
62 char *key = (char *)vkey; 58 char *key = (char *)vkey;
63 node *p; 59 node *p;
64 register node *q; 60 node *q;
65 register node *r; 61 node *r;
66 int cmp; 62 int cmp;
67 63
68 if (rootp == (struct node_t **)0 || (p = *rootp) == (struct node_t *)0) 64 if (rootp == (struct node_t **)0 || (p = *rootp) == (struct node_t *)0)
@@ -97,10 +93,7 @@ tdelete(vkey, vrootp, compar)
97 93
98/* Walk the nodes of a tree */ 94/* Walk the nodes of a tree */
99static void 95static void
100trecurse(root, action, level) 96trecurse(node *root, void (*action)(const void *, VISIT, int), int level)
101 register node *root; /* Root of the tree to be walked */
102 register void (*action)(); /* Function to be called at each node */
103 register int level;
104{ 97{
105 if (root->left == (struct node_t *)0 && root->right == (struct node_t *)0) 98 if (root->left == (struct node_t *)0 && root->right == (struct node_t *)0)
106 (*action)(root, leaf, level); 99 (*action)(root, leaf, level);
@@ -117,12 +110,10 @@ trecurse(root, action, level)
117 110
118/* Walk the nodes of a tree */ 111/* Walk the nodes of a tree */
119void 112void
120twalk(vroot, action) 113twalk(const void *vroot, void (*action)(const void *, VISIT, int))
121 const void *vroot; /* Root of the tree to be walked */
122 void (*action)(const void *, VISIT, int);
123{ 114{
124 node *root = (node *)vroot; 115 node *root = (node *)vroot;
125 116
126 if (root != (node *)0 && action != (void(*)())0) 117 if (root != (node *)0 && action != (void (*)(const void *, VISIT, int))0)
127 trecurse(root, action, 0); 118 trecurse(root, action, 0);
128} 119}