diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-07-31 21:48:11 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-07-31 21:48:11 +0000 |
commit | 8deaa5cb1bdad9c4505896866607f4272b307e9a (patch) | |
tree | f2b66a24b21f1edc23c12fdb15eab63814fc036d | |
parent | 1472e2b5666bd9c64d37882b7cfb2596d9352eb3 (diff) |
various cleanups; david says results are same
92 files changed, 590 insertions, 606 deletions
diff --git a/regress/include/bitstring/bitstring_test.c b/regress/include/bitstring/bitstring_test.c index 2af5279691b..545a3cb7969 100644 --- a/regress/include/bitstring/bitstring_test.c +++ b/regress/include/bitstring/bitstring_test.c @@ -1,20 +1,20 @@ -/* $OpenBSD: bitstring_test.c,v 1.4 2003/01/04 22:36:12 deraadt Exp $ */ -/* $NetBSD: bitstring_test.c,v 1.4 1995/04/29 05:44:35 cgd Exp $ */ +/* $OpenBSD: bitstring_test.c,v 1.5 2003/07/31 21:48:02 deraadt Exp $ */ +/* $NetBSD: bitstring_test.c,v 1.4 1995/04/29 05:44:35 cgd Exp $ */ /* * this is a simple program to test bitstring.h * inspect the output, you should notice problems * choose the ATT or BSD flavor */ -/*#define ATT /*-*/ -#define BSD /*-*/ +/* #define ATT /*- */ +#define BSD /*-*/ -/* include the following define if you want the - * program to link. this corrects a misspeling - * in bitstring.h +/* + * include the following define if you want the program to link. this + * corrects a misspeling in bitstring.h */ #define _bitstr_size bitstr_size - + #include <stdio.h> #include <stdlib.h> @@ -24,190 +24,192 @@ /* #include "gbitstring.h" */ /* #endif */ -int TEST_LENGTH; +int TEST_LENGTH; #define DECL_TEST_LENGTH 37 /* a mostly random number */ -int -main(int argc, char *argv[]) +static void +clearbits(bitstr_t *b, int n) { - void clearbits(); - void printbits(); - int i; - bitstr_t *bs; - bitstr_t bit_decl(bss, DECL_TEST_LENGTH); - - if (argc > 1) - TEST_LENGTH = atoi(argv[1]); - else - TEST_LENGTH = DECL_TEST_LENGTH; - - if (TEST_LENGTH < 4) { - fprintf(stderr, "TEST_LENGTH must be at least 4, but it is %d\n", - TEST_LENGTH); - exit(1); - } - - (void) printf("Testing with TEST_LENGTH = %d\n\n", TEST_LENGTH); - - (void) printf("test _bit_byte, _bit_mask, and bitstr_size\n"); - (void) printf(" i _bit_byte(i) _bit_mask(i) bitstr_size(i)\n"); - for (i=0; i<TEST_LENGTH; i++) { - (void) printf("%3d%15d%15d%15d\n", - i, _bit_byte(i), _bit_mask(i), bitstr_size(i)); - } - - bs = bit_alloc(TEST_LENGTH); - clearbits(bs, TEST_LENGTH); - (void) printf("\ntest bit_alloc, clearbits, bit_ffc, bit_ffs\n"); - (void) printf("be: 0 -1 "); - for (i=0; i < TEST_LENGTH; i++) - (void) putchar('0'); - (void) printf("\nis: "); - printbits(bs, TEST_LENGTH); - - (void) printf("\ntest bit_set\n"); - for (i=0; i<TEST_LENGTH; i+=3) { - bit_set(bs, i); - } - (void) printf("be: 1 0 "); - for (i=0; i < TEST_LENGTH; i++) - (void) putchar(*("100" + (i % 3))); - (void) printf("\nis: "); - printbits(bs, TEST_LENGTH); - - (void) printf("\ntest bit_clear\n"); - for (i=0; i<TEST_LENGTH; i+=6) { - bit_clear(bs, i); - } - (void) printf("be: 0 3 "); - for (i=0; i < TEST_LENGTH; i++) - (void) putchar(*("000100" + (i % 6))); - (void) printf("\nis: "); - printbits(bs, TEST_LENGTH); - - (void) printf("\ntest bit_test using previous bitstring\n"); - (void) printf(" i bit_test(i)\n"); - for (i=0; i<TEST_LENGTH; i++) { - (void) printf("%3d%15d\n", - i, bit_test(bs, i)); - } - - clearbits(bs, TEST_LENGTH); - (void) printf("\ntest clearbits\n"); - (void) printf("be: 0 -1 "); - for (i=0; i < TEST_LENGTH; i++) - (void) putchar('0'); - (void) printf("\nis: "); - printbits(bs, TEST_LENGTH); - - (void) printf("\ntest bit_nset and bit_nclear\n"); - bit_nset(bs, 1, TEST_LENGTH - 2); - (void) printf("be: 0 1 0"); - for (i=0; i < TEST_LENGTH - 2; i++) - (void) putchar('1'); - (void) printf("0\nis: "); - printbits(bs, TEST_LENGTH); - - bit_nclear(bs, 2, TEST_LENGTH - 3); - (void) printf("be: 0 1 01"); - for (i=0; i < TEST_LENGTH - 4; i++) - (void) putchar('0'); - (void) printf("10\nis: "); - printbits(bs, TEST_LENGTH); - - bit_nclear(bs, 0, TEST_LENGTH - 1); - (void) printf("be: 0 -1 "); - for (i=0; i < TEST_LENGTH; i++) - (void) putchar('0'); - (void) printf("\nis: "); - printbits(bs, TEST_LENGTH); - bit_nset(bs, 0, TEST_LENGTH - 2); - (void) printf("be: %3d 0 ",TEST_LENGTH - 1); - for (i=0; i < TEST_LENGTH - 1; i++) - (void) putchar('1'); - putchar('0'); - (void) printf("\nis: "); - printbits(bs, TEST_LENGTH); - bit_nclear(bs, 0, TEST_LENGTH - 1); - (void) printf("be: 0 -1 "); - for (i=0; i < TEST_LENGTH; i++) - (void) putchar('0'); - (void) printf("\nis: "); - printbits(bs, TEST_LENGTH); - - (void) printf("\n"); - (void) printf("first 1 bit should move right 1 position each line\n"); - for (i=0; i<TEST_LENGTH; i++) { - bit_nclear(bs, 0, TEST_LENGTH - 1); - bit_nset(bs, i, TEST_LENGTH - 1); - (void) printf("%3d ", i); printbits(bs, TEST_LENGTH); - } - - (void) printf("\n"); - (void) printf("first 0 bit should move right 1 position each line\n"); - for (i=0; i<TEST_LENGTH; i++) { - bit_nset(bs, 0, TEST_LENGTH - 1); - bit_nclear(bs, i, TEST_LENGTH - 1); - (void) printf("%3d ", i); printbits(bs, TEST_LENGTH); - } - - (void) printf("\n"); - (void) printf("first 0 bit should move left 1 position each line\n"); - for (i=0; i<TEST_LENGTH; i++) { - bit_nclear(bs, 0, TEST_LENGTH - 1); - bit_nset(bs, 0, TEST_LENGTH - 1 - i); - (void) printf("%3d ", i); printbits(bs, TEST_LENGTH); - } - - (void) printf("\n"); - (void) printf("first 1 bit should move left 1 position each line\n"); - for (i=0; i<TEST_LENGTH; i++) { - bit_nset(bs, 0, TEST_LENGTH - 1); - bit_nclear(bs, 0, TEST_LENGTH - 1 - i); - (void) printf("%3d ", i); printbits(bs, TEST_LENGTH); - } - - (void) printf("\n"); - (void) printf("0 bit should move right 1 position each line\n"); - for (i=0; i<TEST_LENGTH; i++) { - bit_nset(bs, 0, TEST_LENGTH - 1); - bit_nclear(bs, i, i); - (void) printf("%3d ", i); printbits(bs, TEST_LENGTH); - } - - (void) printf("\n"); - (void) printf("1 bit should move right 1 position each line\n"); - for (i=0; i<TEST_LENGTH; i++) { - bit_nclear(bs, 0, TEST_LENGTH - 1); - bit_nset(bs, i, i); - (void) printf("%3d ", i); printbits(bs, TEST_LENGTH); - } - - (void)free(bs); - (void)exit(0); + register int i = bitstr_size(n); + + while (i--) + *(b + i) = 0; } -void -clearbits(b, n) - bitstr_t *b; - int n; + +static void +printbits(bitstr_t *b, int n) { - register int i = bitstr_size(n); - while(i--) - *(b + i) = 0; + register int i; + int jc, js; + + bit_ffc(b, n, &jc); + bit_ffs(b, n, &js); + (void) printf("%3d %3d ", jc, js); + for (i = 0; i < n; i++) { + (void) putchar((bit_test(b, i) ? '1' : '0')); + } + (void) putchar('\n'); } -void -printbits(b, n) - bitstr_t *b; - int n; + +int +main(int argc, char *argv[]) { - register int i; - int jc, js; - - bit_ffc(b, n, &jc); - bit_ffs(b, n, &js); - (void) printf("%3d %3d ", jc, js); - for (i=0; i< n; i++) { - (void) putchar((bit_test(b, i) ? '1' : '0')); - } - (void)putchar('\n'); + int i; + bitstr_t *bs; + bitstr_t bit_decl(bss, DECL_TEST_LENGTH); + + if (argc > 1) + TEST_LENGTH = atoi(argv[1]); + else + TEST_LENGTH = DECL_TEST_LENGTH; + + if (TEST_LENGTH < 4) { + fprintf(stderr, "TEST_LENGTH must be at least 4, but it is %d\n", + TEST_LENGTH); + exit(1); + } + (void) printf("Testing with TEST_LENGTH = %d\n\n", TEST_LENGTH); + + (void) printf("test _bit_byte, _bit_mask, and bitstr_size\n"); + (void) printf(" i _bit_byte(i) _bit_mask(i) bitstr_size(i)\n"); + for (i = 0; i < TEST_LENGTH; i++) { + (void) printf("%3d%15d%15d%15d\n", + i, _bit_byte(i), _bit_mask(i), bitstr_size(i)); + } + + bs = bit_alloc(TEST_LENGTH); + clearbits(bs, TEST_LENGTH); + (void) printf("\ntest bit_alloc, clearbits, bit_ffc, bit_ffs\n"); + (void) printf("be: 0 -1 "); + for (i = 0; i < TEST_LENGTH; i++) + (void) putchar('0'); + (void) printf("\nis: "); + printbits(bs, TEST_LENGTH); + + (void) printf("\ntest bit_set\n"); + for (i = 0; i < TEST_LENGTH; i += 3) { + bit_set(bs, i); + } + (void) printf("be: 1 0 "); + for (i = 0; i < TEST_LENGTH; i++) + (void) putchar(*("100" + (i % 3))); + (void) printf("\nis: "); + printbits(bs, TEST_LENGTH); + + (void) printf("\ntest bit_clear\n"); + for (i = 0; i < TEST_LENGTH; i += 6) { + bit_clear(bs, i); + } + (void) printf("be: 0 3 "); + for (i = 0; i < TEST_LENGTH; i++) + (void) putchar(*("000100" + (i % 6))); + (void) printf("\nis: "); + printbits(bs, TEST_LENGTH); + + (void) printf("\ntest bit_test using previous bitstring\n"); + (void) printf(" i bit_test(i)\n"); + for (i = 0; i < TEST_LENGTH; i++) { + (void) printf("%3d%15d\n", + i, bit_test(bs, i)); + } + + clearbits(bs, TEST_LENGTH); + (void) printf("\ntest clearbits\n"); + (void) printf("be: 0 -1 "); + for (i = 0; i < TEST_LENGTH; i++) + (void) putchar('0'); + (void) printf("\nis: "); + printbits(bs, TEST_LENGTH); + + (void) printf("\ntest bit_nset and bit_nclear\n"); + bit_nset(bs, 1, TEST_LENGTH - 2); + (void) printf("be: 0 1 0"); + for (i = 0; i < TEST_LENGTH - 2; i++) + (void) putchar('1'); + (void) printf("0\nis: "); + printbits(bs, TEST_LENGTH); + + bit_nclear(bs, 2, TEST_LENGTH - 3); + (void) printf("be: 0 1 01"); + for (i = 0; i < TEST_LENGTH - 4; i++) + (void) putchar('0'); + (void) printf("10\nis: "); + printbits(bs, TEST_LENGTH); + + bit_nclear(bs, 0, TEST_LENGTH - 1); + (void) printf("be: 0 -1 "); + for (i = 0; i < TEST_LENGTH; i++) + (void) putchar('0'); + (void) printf("\nis: "); + printbits(bs, TEST_LENGTH); + bit_nset(bs, 0, TEST_LENGTH - 2); + (void) printf("be: %3d 0 ", TEST_LENGTH - 1); + for (i = 0; i < TEST_LENGTH - 1; i++) + (void) putchar('1'); + putchar('0'); + (void) printf("\nis: "); + printbits(bs, TEST_LENGTH); + bit_nclear(bs, 0, TEST_LENGTH - 1); + (void) printf("be: 0 -1 "); + for (i = 0; i < TEST_LENGTH; i++) + (void) putchar('0'); + (void) printf("\nis: "); + printbits(bs, TEST_LENGTH); + + (void) printf("\n"); + (void) printf("first 1 bit should move right 1 position each line\n"); + for (i = 0; i < TEST_LENGTH; i++) { + bit_nclear(bs, 0, TEST_LENGTH - 1); + bit_nset(bs, i, TEST_LENGTH - 1); + (void) printf("%3d ", i); + printbits(bs, TEST_LENGTH); + } + + (void) printf("\n"); + (void) printf("first 0 bit should move right 1 position each line\n"); + for (i = 0; i < TEST_LENGTH; i++) { + bit_nset(bs, 0, TEST_LENGTH - 1); + bit_nclear(bs, i, TEST_LENGTH - 1); + (void) printf("%3d ", i); + printbits(bs, TEST_LENGTH); + } + + (void) printf("\n"); + (void) printf("first 0 bit should move left 1 position each line\n"); + for (i = 0; i < TEST_LENGTH; i++) { + bit_nclear(bs, 0, TEST_LENGTH - 1); + bit_nset(bs, 0, TEST_LENGTH - 1 - i); + (void) printf("%3d ", i); + printbits(bs, TEST_LENGTH); + } + + (void) printf("\n"); + (void) printf("first 1 bit should move left 1 position each line\n"); + for (i = 0; i < TEST_LENGTH; i++) { + bit_nset(bs, 0, TEST_LENGTH - 1); + bit_nclear(bs, 0, TEST_LENGTH - 1 - i); + (void) printf("%3d ", i); + printbits(bs, TEST_LENGTH); + } + + (void) printf("\n"); + (void) printf("0 bit should move right 1 position each line\n"); + for (i = 0; i < TEST_LENGTH; i++) { + bit_nset(bs, 0, TEST_LENGTH - 1); + bit_nclear(bs, i, i); + (void) printf("%3d ", i); + printbits(bs, TEST_LENGTH); + } + + (void) printf("\n"); + (void) printf("1 bit should move right 1 position each line\n"); + for (i = 0; i < TEST_LENGTH; i++) { + bit_nclear(bs, 0, TEST_LENGTH - 1); + bit_nset(bs, i, i); + (void) printf("%3d ", i); + printbits(bs, TEST_LENGTH); + } + + (void) free(bs); + (void) exit(0); } diff --git a/regress/lib/csu/ctors/ctors.c b/regress/lib/csu/ctors/ctors.c index d6661efb355..e5c04b6c8d0 100644 --- a/regress/lib/csu/ctors/ctors.c +++ b/regress/lib/csu/ctors/ctors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctors.c,v 1.2 2002/02/18 11:03:58 art Exp $ */ +/* $OpenBSD: ctors.c,v 1.3 2003/07/31 21:48:02 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain. */ @@ -13,7 +13,7 @@ foo(void) } int -main() +main(int argc, char *argv[]) { return !constructed; } diff --git a/regress/lib/libc/alloca/alloca.c b/regress/lib/libc/alloca/alloca.c index c8a6b6b40c2..1c264292933 100644 --- a/regress/lib/libc/alloca/alloca.c +++ b/regress/lib/libc/alloca/alloca.c @@ -1,11 +1,11 @@ -/* $OpenBSD: alloca.c,v 1.3 2003/07/31 03:23:41 mickey Exp $ */ +/* $OpenBSD: alloca.c,v 1.4 2003/07/31 21:48:02 deraadt Exp $ */ /* Written by Michael Shalayeff, 2003, Public Domain. */ #include <stdio.h> int -main() +main(int argc, char *argv[]) { char *q, *p; diff --git a/regress/lib/libc/atexit/atexit_test.c b/regress/lib/libc/atexit/atexit_test.c index df316e33723..c30b9dff77a 100644 --- a/regress/lib/libc/atexit/atexit_test.c +++ b/regress/lib/libc/atexit/atexit_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atexit_test.c,v 1.3 2002/10/21 20:40:50 mickey Exp $ */ +/* $OpenBSD: atexit_test.c,v 1.4 2003/07/31 21:48:02 deraadt Exp $ */ /* * Copyright (c) 2002 Daniel Hartmeier @@ -39,11 +39,11 @@ #include <signal.h> #include "stdlib/atexit.h" -void handle_first(); -void handle_middle(); -void handle_last(); -void handle_invalid(); -void handle_cleanup(); +void handle_first(void); +void handle_middle(void); +void handle_last(void); +void handle_invalid(void); +void handle_cleanup(void); void handle_signal(int); static int counter; @@ -96,31 +96,31 @@ main(int argc, char *argv[]) } void -handle_first() +handle_first(void) { fprintf(stderr, "handle_first() counter == %i\n", counter); } void -handle_middle() +handle_middle(void) { counter++; } void -handle_last() +handle_last(void) { fprintf(stderr, "handle_last() counter == %i\n", counter); } void -handle_cleanup() +handle_cleanup(void) { fprintf(stderr, "handle_cleanup()\n"); } void -handle_invalid() +handle_invalid(void) { fprintf(stderr, "handle_invalid() THIS SHOULD HAVE SEGFAULTED INSTEAD!\n"); } diff --git a/regress/lib/libc/db/dbtest.c b/regress/lib/libc/db/dbtest.c index 0cefba3e1f8..8eda40d6b3a 100644 --- a/regress/lib/libc/db/dbtest.c +++ b/regress/lib/libc/db/dbtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbtest.c,v 1.10 2003/06/02 19:38:25 millert Exp $ */ +/* $OpenBSD: dbtest.c,v 1.11 2003/07/31 21:48:02 deraadt Exp $ */ /* $NetBSD: dbtest.c,v 1.8 1996/05/03 21:57:48 cgd Exp $ */ /*- @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dbtest.c 8.17 (Berkeley) 9/1/94"; #else -static char rcsid[] = "$OpenBSD: dbtest.c,v 1.10 2003/06/02 19:38:25 millert Exp $"; +static char rcsid[] = "$OpenBSD: dbtest.c,v 1.11 2003/07/31 21:48:02 deraadt Exp $"; #endif #endif /* not lint */ @@ -88,9 +88,7 @@ DB *XXdbp; /* Global for gdb. */ int XXlineno; /* Fast breakpoint for gdb. */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { extern int optind; extern char *optarg; @@ -158,7 +156,7 @@ main(argc, argv) p = getenv("TMPDIR"); if (p == NULL) p = "/var/tmp"; - (void)sprintf(buf, "%s/__dbtest", p); + (void)snprintf(buf, sizeof buf, "%s/__dbtest", p); fname = buf; (void)unlink(buf); } else if (!sflag) diff --git a/regress/lib/libc/ieeefp/except/except.c b/regress/lib/libc/ieeefp/except/except.c index 6b65e8f3c49..7ab8fc4cb21 100644 --- a/regress/lib/libc/ieeefp/except/except.c +++ b/regress/lib/libc/ieeefp/except/except.c @@ -1,4 +1,4 @@ -/* $OpenBSD: except.c,v 1.3 2001/01/29 02:05:42 niklas Exp $ */ +/* $OpenBSD: except.c,v 1.4 2003/07/31 21:48:03 deraadt Exp $ */ #include <stdio.h> #include <signal.h> @@ -6,7 +6,6 @@ #include <ieeefp.h> #include <float.h> -void sigfpe(); volatile sig_atomic_t signal_cought; static volatile const double one = 1.0; @@ -14,8 +13,14 @@ static volatile const double zero = 0.0; static volatile const double huge = DBL_MAX; static volatile const double tiny = DBL_MIN; +static void +sigfpe(int signo) +{ + signal_cought = 1; +} + int -main() +main(int argc, char *argv[]) { volatile double x; @@ -83,8 +88,3 @@ main() exit(0); } -void -sigfpe() -{ - signal_cought = 1; -} diff --git a/regress/lib/libc/ieeefp/inf/inf.c b/regress/lib/libc/ieeefp/inf/inf.c index b6116b0df1f..a1956145a6a 100644 --- a/regress/lib/libc/ieeefp/inf/inf.c +++ b/regress/lib/libc/ieeefp/inf/inf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inf.c,v 1.2 2002/02/18 11:24:13 art Exp $ */ +/* $OpenBSD: inf.c,v 1.3 2003/07/31 21:48:03 deraadt Exp $ */ /* * Peter Valchev <pvalchev@openbsd.org> Public Domain, 2002. @@ -7,7 +7,7 @@ #include <math.h> int -main() +main(int argc, char *argv[]) { if (isinf(HUGE_VAL)) return 0; diff --git a/regress/lib/libc/ieeefp/round/round.c b/regress/lib/libc/ieeefp/round/round.c index 086c4fdf100..807941ea563 100644 --- a/regress/lib/libc/ieeefp/round/round.c +++ b/regress/lib/libc/ieeefp/round/round.c @@ -1,4 +1,4 @@ -/* $OpenBSD: round.c,v 1.2 2001/01/29 02:05:43 niklas Exp $ */ +/* $OpenBSD: round.c,v 1.3 2003/07/31 21:48:03 deraadt Exp $ */ /* $NetBSD: round.c,v 1.1 1995/04/26 00:27:28 jtc Exp $ */ /* @@ -12,7 +12,7 @@ #include <float.h> int -main() +main(int argc, char *argv[]) { /* * This test would be better if it actually performed some diff --git a/regress/lib/libc/malloc/malloc0test/malloc0test.c b/regress/lib/libc/malloc/malloc0test/malloc0test.c index 39c3fd2e64f..910b466bd4d 100644 --- a/regress/lib/libc/malloc/malloc0test/malloc0test.c +++ b/regress/lib/libc/malloc/malloc0test/malloc0test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc0test.c,v 1.1 2003/07/15 10:09:37 otto Exp $ */ +/* $OpenBSD: malloc0test.c,v 1.2 2003/07/31 21:48:03 deraadt Exp $ */ /* * Public domain. 2001, Theo de Raadt */ @@ -14,14 +14,14 @@ volatile sig_atomic_t got; jmp_buf jmp; -void +static void catch(int signo) { got++; longjmp(jmp, 1); } -int +static int test(char *p, int size) { signal(SIGSEGV, catch); diff --git a/regress/lib/libc/malloc/malloc_errno/malloc_errno.c b/regress/lib/libc/malloc/malloc_errno/malloc_errno.c index 61d85e5d410..1232dd660d8 100644 --- a/regress/lib/libc/malloc/malloc_errno/malloc_errno.c +++ b/regress/lib/libc/malloc/malloc_errno/malloc_errno.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc_errno.c,v 1.1 2003/07/15 10:06:31 otto Exp $ */ +/* $OpenBSD: malloc_errno.c,v 1.2 2003/07/31 21:48:03 deraadt Exp $ */ /* * Public domain. 2003, Otto Moerbeek */ @@ -30,7 +30,7 @@ testerrno(size_t sz) * correctly. */ int -main() +main(int argc, char *argv[]) { size_t i; diff --git a/regress/lib/libc/regex/debug.c b/regress/lib/libc/regex/debug.c index 7834e970c7b..11129e7249d 100644 --- a/regress/lib/libc/regex/debug.c +++ b/regress/lib/libc/regex/debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: debug.c,v 1.3 2001/01/29 02:05:43 niklas Exp $ */ +/* $OpenBSD: debug.c,v 1.4 2003/07/31 21:48:03 deraadt Exp $ */ /* $NetBSD: debug.c,v 1.2 1995/04/20 22:39:42 cgd Exp $ */ #include <stdio.h> @@ -238,8 +238,8 @@ int ch; static char buf[10]; if (isprint(ch) || ch == ' ') - sprintf(buf, "%c", ch); + snprintf(buf, sizeof buf, "%c", ch); else - sprintf(buf, "\\%o", ch); + snprintf(buf, sizeof buf, "\\%o", ch); return(buf); } diff --git a/regress/lib/libc/regex/main.c b/regress/lib/libc/regex/main.c index 6e63ffc2351..02f4bd7cf25 100644 --- a/regress/lib/libc/regex/main.c +++ b/regress/lib/libc/regex/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.3 1997/01/15 23:41:07 millert Exp $ */ +/* $OpenBSD: main.c,v 1.4 2003/07/31 21:48:03 deraadt Exp $ */ /* $NetBSD: main.c,v 1.2 1995/04/20 22:39:51 cgd Exp $ */ #include <stdio.h> @@ -22,16 +22,15 @@ regoff_t startoff = 0; regoff_t endoff = 0; -extern int split(); -extern void regprint(); +extern int split(char *, char *[], int, char *); +extern void regprint(regex_t *, FILE *); /* - main - do the simple case, hand off to regress() for regression */ int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) + { regex_t re; # define NS 10 @@ -431,8 +430,9 @@ char *should; (sub.rm_so != -1 && sub.rm_eo == -1) || (sub.rm_so != -1 && sub.rm_so < 0) || (sub.rm_eo != -1 && sub.rm_eo < 0) ) { - sprintf(grump, "start %ld end %ld", (long)sub.rm_so, - (long)sub.rm_eo); + snprintf(grump, sizeof grump, + "start %ld end %ld", (long)sub.rm_so, + (long)sub.rm_eo); return(grump); } @@ -444,8 +444,9 @@ char *should; /* check for in range */ if (sub.rm_eo > strlen(str)) { - sprintf(grump, "start %ld end %ld, past end of string", - (long)sub.rm_so, (long)sub.rm_eo); + snprintf(grump, sizeof grump, + "start %ld end %ld, past end of string", + (long)sub.rm_so, (long)sub.rm_eo); return(grump); } @@ -455,13 +456,13 @@ char *should; /* check for not supposed to match */ if (should == NULL) { - sprintf(grump, "matched `%.*s'", len, p); + snprintf(grump, sizeof grump, "matched `%.*s'", len, p); return(grump); } /* check for wrong match */ if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) { - sprintf(grump, "matched `%.*s' instead", len, p); + snprintf(grump, sizeof grump, "matched `%.*s' instead", len, p); return(grump); } if (shlen > 0) @@ -474,7 +475,7 @@ char *should; if (shlen == 0) shlen = 1; /* force check for end-of-string */ if (strncmp(p, at, shlen) != 0) { - sprintf(grump, "matched null at `%.20s'", p); + snprintf(grump, sizeof grump, "matched null at `%.20s'", p); return(grump); } return(NULL); @@ -507,7 +508,7 @@ char *name; static char efbuf[100]; regex_t re; - sprintf(efbuf, "REG_%s", name); + snprintf(efbuf, sizeof efbuf, "REG_%s", name); assert(strlen(efbuf) < sizeof(efbuf)); re.re_endp = efbuf; (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf)); diff --git a/regress/lib/libc/regex/split.c b/regress/lib/libc/regex/split.c index 52cb6c681e8..1e17a55b89e 100644 --- a/regress/lib/libc/regex/split.c +++ b/regress/lib/libc/regex/split.c @@ -1,19 +1,17 @@ -/* $OpenBSD: split.c,v 1.2 2001/01/29 02:05:44 niklas Exp $ */ +/* $OpenBSD: split.c,v 1.3 2003/07/31 21:48:03 deraadt Exp $ */ /* $NetBSD: split.c,v 1.2 1995/04/20 22:39:57 cgd Exp $ */ #include <stdio.h> #include <string.h> +int split(char *string, char *fields[], int nfields, char *sep); + /* - split - divide a string into fields, like awk split() = int split(char *string, char *fields[], int nfields, char *sep); */ int /* number of fields, including overflow */ -split(string, fields, nfields, sep) -char *string; -char *fields[]; /* list is not NULL-terminated */ -int nfields; /* number of entries available in fields[] */ -char *sep; /* "" white, "c" single char, "ab" [ab]+ */ +split(char *string, char *fields[], int nfields, char *sep) { register char *p = string; register char c; /* latest character */ diff --git a/regress/lib/libc/setjmp/jmptest.c b/regress/lib/libc/setjmp/jmptest.c index de6e70d9f6a..86b0e6ae938 100644 --- a/regress/lib/libc/setjmp/jmptest.c +++ b/regress/lib/libc/setjmp/jmptest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: jmptest.c,v 1.5 2001/11/11 23:26:35 deraadt Exp $ */ +/* $OpenBSD: jmptest.c,v 1.6 2003/07/31 21:48:03 deraadt Exp $ */ /* $NetBSD: jmptest.c,v 1.2 1995/01/01 20:55:35 jtc Exp $ */ /* @@ -64,9 +64,8 @@ int expectsignal; -void -aborthandler(signo) - int signo; +static void +aborthandler(int signo) { if (expectsignal) @@ -78,9 +77,7 @@ aborthandler(signo) } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct sigaction sa; BUF jb; diff --git a/regress/lib/libc/sigreturn/sigret.c b/regress/lib/libc/sigreturn/sigret.c index 416869007ab..72945fa5031 100644 --- a/regress/lib/libc/sigreturn/sigret.c +++ b/regress/lib/libc/sigreturn/sigret.c @@ -1,5 +1,5 @@ /* - * $OpenBSD: sigret.c,v 1.4 2002/04/30 01:59:47 deraadt Exp $ + * $OpenBSD: sigret.c,v 1.5 2003/07/31 21:48:04 deraadt Exp $ * * Public Domain * @@ -64,13 +64,13 @@ usage(const char * err, ...) exit(1); } -void +static void indirect_return(struct sigcontext * scp) { sigreturn(scp); } -void +static void sig_handler(int sig, siginfo_t *blah, void *x) { struct sigcontext * scp = x; @@ -90,7 +90,7 @@ sig_handler(int sig, siginfo_t *blah, void *x) } } -void +static void test2(char *fmt) { char *ofmt = fmt; diff --git a/regress/lib/libevent/eventtest.c b/regress/lib/libevent/eventtest.c index 53ed867fac5..c6cff9a401d 100644 --- a/regress/lib/libevent/eventtest.c +++ b/regress/lib/libevent/eventtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eventtest.c,v 1.1 2003/06/15 16:34:53 mickey Exp $ */ +/* $OpenBSD: eventtest.c,v 1.2 2003/07/31 21:48:04 deraadt Exp $ */ /* $NetBSD: eventtest.c,v 1.2 2003/06/13 04:09:18 itojun Exp $ */ /* @@ -63,7 +63,7 @@ static struct timeval tcalled; #define TEST1 "this is a test" #define SECONDS 1 -void +static void simple_read_cb(int fd, short event, void *arg) { char buf[256]; @@ -80,7 +80,7 @@ simple_read_cb(int fd, short event, void *arg) called++; } -void +static void simple_write_cb(int fd, short event, void *arg) { int len; @@ -92,7 +92,7 @@ simple_write_cb(int fd, short event, void *arg) test_ok = 1; } -void +static void multiple_write_cb(int fd, short event, void *arg) { struct event *ev = arg; @@ -123,7 +123,7 @@ multiple_write_cb(int fd, short event, void *arg) event_add(ev, NULL); } -void +static void multiple_read_cb(int fd, short event, void *arg) { struct event *ev = arg; @@ -143,7 +143,7 @@ multiple_read_cb(int fd, short event, void *arg) event_add(ev, NULL); } -void +static void timeout_cb(int fd, short event, void *arg) { struct timeval tv; @@ -163,7 +163,7 @@ timeout_cb(int fd, short event, void *arg) test_ok = 1; } -void +static void signal_cb(int fd, short event, void *arg) { struct event *ev = arg; @@ -177,7 +177,7 @@ struct both { int nread; }; -void +static void combined_read_cb(int fd, short event, void *arg) { struct both *both = arg; @@ -194,7 +194,7 @@ combined_read_cb(int fd, short event, void *arg) event_add(&both->ev, NULL); } -void +static void combined_write_cb(int fd, short event, void *arg) { struct both *both = arg; @@ -219,7 +219,7 @@ combined_write_cb(int fd, short event, void *arg) /* Test infrastructure */ -int +static int setup_test(char *name) { @@ -235,7 +235,7 @@ setup_test(char *name) return (0); } -int +static int cleanup_test(void) { close(pair[0]); @@ -252,7 +252,7 @@ cleanup_test(void) } int -main (int argc, char **argv) +main(int argc, char **argv) { struct event ev, ev2; struct timeval tv; diff --git a/regress/lib/libm/rint/rint.c b/regress/lib/libm/rint/rint.c index 293a09edaec..e968426f778 100644 --- a/regress/lib/libm/rint/rint.c +++ b/regress/lib/libm/rint/rint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rint.c,v 1.2 2003/07/31 03:23:41 mickey Exp $ */ +/* $OpenBSD: rint.c,v 1.3 2003/07/31 21:48:04 deraadt Exp $ */ /* Written by Michael Shalayeff, 2003, Public domain. */ @@ -7,7 +7,7 @@ #include <unistd.h> #include <math.h> -void +static void sigfpe(int sig, siginfo_t *si, void *v) { char buf[132]; @@ -21,7 +21,7 @@ sigfpe(int sig, siginfo_t *si, void *v) } int -main() +main(int argc, char *argv[]) { struct sigaction sa; diff --git a/regress/lib/libm/toint/toint.c b/regress/lib/libm/toint/toint.c index eb0df958897..7a4c60e7c2b 100644 --- a/regress/lib/libm/toint/toint.c +++ b/regress/lib/libm/toint/toint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: toint.c,v 1.2 2003/07/31 03:23:41 mickey Exp $ */ +/* $OpenBSD: toint.c,v 1.3 2003/07/31 21:48:04 deraadt Exp $ */ /* Written by Michael Shalayeff, 2003, Public domain. */ @@ -6,7 +6,7 @@ #include <signal.h> #include <unistd.h> -void +static void sigfpe(int sig, siginfo_t *si, void *v) { char buf[132]; @@ -19,14 +19,14 @@ sigfpe(int sig, siginfo_t *si, void *v) _exit(1); } -int +static int toint(double d) { return (int)d; } int -main() +main(int argc, char *argv[]) { struct sigaction sa; diff --git a/regress/lib/libpthread/cancel/cancel.c b/regress/lib/libpthread/cancel/cancel.c index 4c70a229bcd..60d9b0b7ece 100644 --- a/regress/lib/libpthread/cancel/cancel.c +++ b/regress/lib/libpthread/cancel/cancel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cancel.c,v 1.5 2002/02/17 05:44:38 marc Exp $ */ +/* $OpenBSD: cancel.c,v 1.6 2003/07/31 21:48:04 deraadt Exp $ */ /* David Leonard <d@openbsd.org>, 1999. Public Domain. */ #include <pthread.h> @@ -15,7 +15,9 @@ static struct timespec expiretime; static volatile int pv_state = 0; -void p() { +static void +p(void) +{ CHECKr(pthread_mutex_lock(&mutex)); if (pv_state <= 0) { CHECKr(pthread_cond_timedwait(&cond, &mutex, &expiretime)); @@ -24,7 +26,9 @@ void p() { CHECKr(pthread_mutex_unlock(&mutex)); } -void v() { +static void +v(void) +{ int needsignal; CHECKr(pthread_mutex_lock(&mutex)); @@ -35,16 +39,15 @@ void v() { CHECKr(pthread_mutex_unlock(&mutex)); } -void +static void c1handler(void *arg) { CHECKe(close(*(int *)arg)); v(); } -void * -child1fn(arg) - void *arg; +static void * +child1fn(void *arg) { int fd; char buf[1024]; @@ -65,7 +68,7 @@ child1fn(arg) static int c2_in_test = 0; -void +static void c2handler(void *arg) { ASSERT(c2_in_test); @@ -73,9 +76,8 @@ c2handler(void *arg) } static int message_seen = 0; -void * -child2fn(arg) - void *arg; +static void * +child2fn(void *arg) { SET_NAME("c2"); @@ -118,7 +120,7 @@ child2fn(arg) static int c3_cancel_survived; -void +static void c3handler(void *arg) { printf("(fyi, cancellation of self %s instantaneous)\n", @@ -126,9 +128,8 @@ c3handler(void *arg) v(); } -void * -child3fn(arg) - void *arg; +static void * +child3fn(void *arg) { SET_NAME("c3"); pthread_cleanup_push(c3handler, NULL); @@ -144,7 +145,7 @@ child3fn(arg) } int -main() +main(int argc, char *argv[]) { pthread_t child1, child2, child3; diff --git a/regress/lib/libpthread/cancel2/cancel2.c b/regress/lib/libpthread/cancel2/cancel2.c index 275ad8d8b61..d65abf5a074 100644 --- a/regress/lib/libpthread/cancel2/cancel2.c +++ b/regress/lib/libpthread/cancel2/cancel2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cancel2.c,v 1.1 2003/01/19 21:23:46 marc Exp $ */ +/* $OpenBSD: cancel2.c,v 1.2 2003/07/31 21:48:04 deraadt Exp $ */ /* PUBLIC DOMAIN <marc@snafu.org> */ /* @@ -14,7 +14,7 @@ #include "test.h" -void * +static void * select_thread(void *arg) { int read_fd = *(int*) arg; diff --git a/regress/lib/libpthread/close/close.c b/regress/lib/libpthread/close/close.c index e92c5c3f9c2..1ef4bf70091 100644 --- a/regress/lib/libpthread/close/close.c +++ b/regress/lib/libpthread/close/close.c @@ -1,4 +1,4 @@ -/* $OpenBSD: close.c,v 1.3 2002/02/15 23:36:52 marc Exp $ */ +/* $OpenBSD: close.c,v 1.4 2003/07/31 21:48:04 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -54,7 +54,7 @@ int fd; /* * meat of inetd discard service -- ignore data */ -void +static void discard(int s) { char buffer[BUFSIZE]; @@ -69,7 +69,7 @@ discard(int s) */ #define TEST_PORT 9876 -void +static void server(void) { int sock; @@ -94,7 +94,8 @@ server(void) exit(0); } -void* new_thread(void* arg) +static void * +new_thread(void* arg) { fd_set r; int ret; @@ -112,7 +113,7 @@ void* new_thread(void* arg) } int -main() +main(int argc, char *argv[]) { pthread_t thread; pthread_attr_t attr; diff --git a/regress/lib/libpthread/execve/execve.c b/regress/lib/libpthread/execve/execve.c index 75e2083f796..fa94f2a9e9f 100644 --- a/regress/lib/libpthread/execve/execve.c +++ b/regress/lib/libpthread/execve/execve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: execve.c,v 1.2 2002/12/13 20:21:04 marc Exp $ */ +/* $OpenBSD: execve.c,v 1.3 2003/07/31 21:48:04 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -55,7 +55,7 @@ char *argv[] = { char * should_succeed = "This line should be displayed\n"; int -main() +main(int argc, char *argv[]) { int fd; diff --git a/regress/lib/libpthread/fork/fork.c b/regress/lib/libpthread/fork/fork.c index 3a5d9ac24cd..170dfe432ec 100644 --- a/regress/lib/libpthread/fork/fork.c +++ b/regress/lib/libpthread/fork/fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fork.c,v 1.3 2002/12/08 04:16:19 marc Exp $ */ +/* $OpenBSD: fork.c,v 1.4 2003/07/31 21:48:04 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -50,14 +50,14 @@ #include "test.h" -void * +static void * empty(void *arg) { return (void *)0x12345678; } -void * +static void * sleeper(void *arg) { @@ -68,7 +68,7 @@ sleeper(void *arg) int -main() +main(int argc, char *argv[]) { int flags; pthread_t sleeper_thread; diff --git a/regress/lib/libpthread/group/group.c b/regress/lib/libpthread/group/group.c index cec7667e516..5f6a8793f64 100644 --- a/regress/lib/libpthread/group/group.c +++ b/regress/lib/libpthread/group/group.c @@ -1,4 +1,4 @@ -/* $OpenBSD: group.c,v 1.4 2001/09/12 12:07:39 fgsch Exp $ */ +/* $OpenBSD: group.c,v 1.5 2003/07/31 21:48:04 deraadt Exp $ */ /* David Leonard <d@openbsd.org>, 2001. Public Domain. */ @@ -24,7 +24,7 @@ volatile int done_count; pthread_mutex_t display; pthread_mutex_t display2; -void * +static void * test(void *arg) { gid_t gid = *(gid_t *)arg; @@ -137,7 +137,7 @@ test(void *arg) #define NGRPS 5 int -main() +main(int argc, char *argv[]) { pthread_t thread[NGRPS]; int gid; diff --git a/regress/lib/libpthread/malloc_duel/malloc_duel.c b/regress/lib/libpthread/malloc_duel/malloc_duel.c index c7733f63b45..e5573e7e5ee 100644 --- a/regress/lib/libpthread/malloc_duel/malloc_duel.c +++ b/regress/lib/libpthread/malloc_duel/malloc_duel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc_duel.c,v 1.1 2002/11/12 03:17:16 marc Exp $ */ +/* $OpenBSD: malloc_duel.c,v 1.2 2003/07/31 21:48:04 deraadt Exp $ */ /* PUBLIC DOMAIN Nov 2002 <marc@snafu.org> */ /* @@ -27,7 +27,7 @@ alarm_handler(int sig) /* * A function that does lots of mallocs, called by all threads. */ -void +static void malloc_loop(void) { int i; @@ -49,7 +49,7 @@ malloc_loop(void) /* * A thread that does a lot of mallocs */ -void * +static void * thread(void *arg) { malloc_loop(); diff --git a/regress/lib/libpthread/netdb/netdb.c b/regress/lib/libpthread/netdb/netdb.c index 9f764d87827..80cb5d2047b 100644 --- a/regress/lib/libpthread/netdb/netdb.c +++ b/regress/lib/libpthread/netdb/netdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netdb.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: netdb.c,v 1.3 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -49,7 +49,8 @@ #include <stdlib.h> #include "test.h" -static void test_serv() +static void +test_serv(void) { struct servent *serv; @@ -57,7 +58,8 @@ static void test_serv() printf("getservbyname -> port %d\n", ntohs(serv->s_port)); } -static void test_host() +static void +test_host(void) { struct hostent *host; struct in_addr addr; @@ -67,7 +69,8 @@ static void test_host() printf("gethostbyname -> %s\n", inet_ntoa(addr)); } -static void test_localhost() +static void +test_localhost(void) { struct hostent *host; diff --git a/regress/lib/libpthread/pcap/pcap.c b/regress/lib/libpthread/pcap/pcap.c index 7bbadf93c6f..faa8d38384c 100644 --- a/regress/lib/libpthread/pcap/pcap.c +++ b/regress/lib/libpthread/pcap/pcap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcap.c,v 1.4 2002/01/08 18:55:46 marc Exp $ */ +/* $OpenBSD: pcap.c,v 1.5 2003/07/31 21:48:05 deraadt Exp $ */ /* * Placed in the PUBLIC DOMAIN */ @@ -19,13 +19,13 @@ volatile int packet_count = 0; pthread_mutex_t dummy; pthread_cond_t syncer; -void +static void packet_ignore(u_char *tag, const struct pcap_pkthdr *hdr, const u_char *data) { packet_count += 1; } -void * +static void * pcap_thread(void *arg) { char errbuf[PCAP_ERRBUF_SIZE]; @@ -42,7 +42,7 @@ pcap_thread(void *arg) return 0; } -void * +static void * ping_thread(void *arg) { SET_NAME("ping_thread"); diff --git a/regress/lib/libpthread/poll/poll.c b/regress/lib/libpthread/poll/poll.c index 3ed5b52d01f..4b76bd7d858 100644 --- a/regress/lib/libpthread/poll/poll.c +++ b/regress/lib/libpthread/poll/poll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: poll.c,v 1.3 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: poll.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */ /* David Leonard <d@openbsd.org>, 2001. Public Domain. */ #include <pthread.h> @@ -13,8 +13,7 @@ #define POLLALL (POLLIN|POLLOUT|POLLERR|POLLNVAL) static void -print_pollfd(p) - struct pollfd *p; +print_pollfd(struct pollfd *p) { printf("{fd=%d, events=< %s%s%s> revents=< %s%s%s%s%s>}", @@ -31,8 +30,7 @@ print_pollfd(p) } static void * -writer(arg) - void *arg; +writer(void *arg) { int fd = *(int *)arg; const char msg[1] = { '!' }; @@ -42,8 +40,7 @@ writer(arg) } static void * -reader(arg) - void *arg; +reader(void *arg) { int fd = *(int *)arg; char buf[1]; @@ -53,9 +50,7 @@ reader(arg) } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { pthread_t t; void *result; diff --git a/regress/lib/libpthread/preemption/preemption.c b/regress/lib/libpthread/preemption/preemption.c index fad95636763..8f4e9a61762 100644 --- a/regress/lib/libpthread/preemption/preemption.c +++ b/regress/lib/libpthread/preemption/preemption.c @@ -1,4 +1,4 @@ -/* $OpenBSD: preemption.c,v 1.3 2003/01/26 22:05:12 marc Exp $ */ +/* $OpenBSD: preemption.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -37,8 +37,8 @@ #include <stdlib.h> #include "test.h" -void * -new_thread(void * new_buf) +static void * +new_thread(void *new_buf) { int i; @@ -53,7 +53,7 @@ new_thread(void * new_buf) } int -main() +main(int argc, char *argv[]) { pthread_t thread; diff --git a/regress/lib/libpthread/preemption_float/preemption_float.c b/regress/lib/libpthread/preemption_float/preemption_float.c index 6cd7cec2467..1f0b571d4d2 100644 --- a/regress/lib/libpthread/preemption_float/preemption_float.c +++ b/regress/lib/libpthread/preemption_float/preemption_float.c @@ -1,4 +1,4 @@ -/* $OpenBSD: preemption_float.c,v 1.3 2003/01/23 00:52:52 marc Exp $ */ +/* $OpenBSD: preemption_float.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -47,7 +47,8 @@ int limit = 2; int float_passed = 0; int float_failed = 1; -void *log_loop (void *x) { +static void * +log_loop (void *x) { int i; double d, d1, d2; /* sleep (1); */ @@ -70,7 +71,8 @@ void *log_loop (void *x) { pthread_exit(&float_passed); } -void *trig_loop (void *x) { +static void * +trig_loop (void *x) { int i; double d, d1, d2; /* sleep (1); */ @@ -95,7 +97,7 @@ void *trig_loop (void *x) { pthread_exit(&float_passed); } -int +static int floatloop(void) { pthread_t thread[2]; @@ -112,7 +114,7 @@ floatloop(void) } int -main() +main(int argc, char *argv[]) { pthread_t thread; int *result; diff --git a/regress/lib/libpthread/pthread_cond_timedwait/pthread_cond_timedwait.c b/regress/lib/libpthread/pthread_cond_timedwait/pthread_cond_timedwait.c index eed3e8f13a4..f5b9c1d591d 100644 --- a/regress/lib/libpthread/pthread_cond_timedwait/pthread_cond_timedwait.c +++ b/regress/lib/libpthread/pthread_cond_timedwait/pthread_cond_timedwait.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_cond_timedwait.c,v 1.3 2003/07/08 00:15:06 marc Exp $ */ +/* $OpenBSD: pthread_cond_timedwait.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -51,7 +51,8 @@ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t cond = PTHREAD_COND_INITIALIZER; -void* thread_1(void * new_buf) +static void * +thread_1(void * new_buf) { CHECKr(pthread_mutex_lock(&mutex)); CHECKr(pthread_cond_signal(&cond)); @@ -59,7 +60,8 @@ void* thread_1(void * new_buf) pthread_exit(NULL); } -void* thread_2(void * new_buf) +static void * +thread_2(void * new_buf) { sleep(1); CHECKr(pthread_mutex_lock(&mutex)); @@ -69,7 +71,7 @@ void* thread_2(void * new_buf) } int -main() +main(int argc, char *argv[]) { struct timespec abstime; struct timeval begtime; diff --git a/regress/lib/libpthread/pthread_create/pthread_create.c b/regress/lib/libpthread/pthread_create/pthread_create.c index 9b82d0945f5..6ee1e58bd2f 100644 --- a/regress/lib/libpthread/pthread_create/pthread_create.c +++ b/regress/lib/libpthread/pthread_create/pthread_create.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_create.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: pthread_create.c,v 1.3 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -43,7 +43,8 @@ #include <stdlib.h> #include "test.h" -void* new_thread(void* arg) +static void * +new_thread(void* arg) { int i; @@ -54,7 +55,7 @@ void* new_thread(void* arg) } int -main() +main(int argc, char *argv[]) { pthread_t thread; int i; diff --git a/regress/lib/libpthread/pthread_join/pthread_join.c b/regress/lib/libpthread/pthread_join/pthread_join.c index 2bda5a4045b..e77a1a0bce4 100644 --- a/regress/lib/libpthread/pthread_join/pthread_join.c +++ b/regress/lib/libpthread/pthread_join/pthread_join.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_join.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: pthread_join.c,v 1.3 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -48,7 +48,8 @@ #include "test.h" /* This thread yields so the creator has a live thread to wait on */ -void* new_thread_1(void * new_buf) +static void * +new_thread_1(void * new_buf) { int i; @@ -60,7 +61,8 @@ void* new_thread_1(void * new_buf) } /* This thread doesn't yield so the creator has a dead thread to wait on */ -void* new_thread_2(void * new_buf) +static void * +new_thread_2(void * new_buf) { int i; @@ -70,7 +72,7 @@ void* new_thread_2(void * new_buf) } int -main() +main(int argc, char *argv[]) { char buf[256], *status; pthread_t thread; diff --git a/regress/lib/libpthread/pthread_kill/pthread_kill.c b/regress/lib/libpthread/pthread_kill/pthread_kill.c index 56d4b288294..a4a63d15538 100644 --- a/regress/lib/libpthread/pthread_kill/pthread_kill.c +++ b/regress/lib/libpthread/pthread_kill/pthread_kill.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_kill.c,v 1.3 2003/06/19 00:59:54 pvalchev Exp $ */ +/* $OpenBSD: pthread_kill.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */ /* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */ /* @@ -10,10 +10,11 @@ #include <signal.h> #include <stdio.h> #include <unistd.h> +#include <stdlib.h> #include "test.h" -void +static void act_handler(int signal, siginfo_t *siginfo, void *context) { struct sigaction sa; @@ -28,7 +29,7 @@ act_handler(int signal, siginfo_t *siginfo, void *context) free(str); } -void * +static void * thread(void * arg) { sigset_t run_mask; diff --git a/regress/lib/libpthread/pthread_mutex/pthread_mutex.c b/regress/lib/libpthread/pthread_mutex/pthread_mutex.c index 311688d0259..c534479b7fc 100644 --- a/regress/lib/libpthread/pthread_mutex/pthread_mutex.c +++ b/regress/lib/libpthread/pthread_mutex/pthread_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_mutex.c,v 1.3 2001/11/03 04:33:48 marc Exp $ */ +/* $OpenBSD: pthread_mutex.c,v 1.4 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -49,9 +49,8 @@ int contention_variable; -void * -thread_contention(arg) - void *arg; +static void * +thread_contention(void *arg) { pthread_mutex_t *mutex = arg; @@ -64,9 +63,8 @@ thread_contention(arg) pthread_exit(NULL); } -void -test_contention_lock(mutex) - pthread_mutex_t *mutex; +static void +test_contention_lock(pthread_mutex_t *mutex) { pthread_t thread; @@ -82,18 +80,16 @@ test_contention_lock(mutex) CHECKr(pthread_mutex_unlock(mutex)); } -void -test_nocontention_lock(mutex) - pthread_mutex_t *mutex; +static void +test_nocontention_lock(pthread_mutex_t *mutex) { printf(" test_nocontention_lock()\n"); CHECKr(pthread_mutex_lock(mutex)); CHECKr(pthread_mutex_unlock(mutex)); } -void -test_debug_double_lock(mutex) - pthread_mutex_t *mutex; +static void +test_debug_double_lock(pthread_mutex_t *mutex) { printf(" test_debug_double_lock()\n"); CHECKr(pthread_mutex_lock(mutex)); @@ -101,9 +97,8 @@ test_debug_double_lock(mutex) CHECKr(pthread_mutex_unlock(mutex)); } -void -test_debug_double_unlock(mutex) - pthread_mutex_t *mutex; +static void +test_debug_double_unlock(pthread_mutex_t *mutex) { printf(" test_debug_double_unlock()\n"); CHECKr(pthread_mutex_lock(mutex)); @@ -112,17 +107,16 @@ test_debug_double_unlock(mutex) ASSERTe(pthread_mutex_unlock(mutex), != 0); } -void -test_nocontention_trylock(mutex) - pthread_mutex_t *mutex; +static void +test_nocontention_trylock(pthread_mutex_t *mutex) { printf(" test_nocontention_trylock()\n"); CHECKr(pthread_mutex_trylock(mutex)); CHECKr(pthread_mutex_unlock(mutex)); } -void -test_mutex_static() +static void +test_mutex_static(void) { pthread_mutex_t mutex_static = PTHREAD_MUTEX_INITIALIZER; @@ -131,7 +125,7 @@ test_mutex_static() test_contention_lock(&mutex_static); } -void +static void test_mutex_fast(void) { pthread_mutex_t mutex_fast; @@ -143,8 +137,8 @@ test_mutex_fast(void) CHECKr(pthread_mutex_destroy(&mutex_fast)); } -void -test_mutex_debug() +static void +test_mutex_debug(void) { pthread_mutexattr_t mutex_debug_attr; pthread_mutex_t mutex_debug; @@ -161,8 +155,8 @@ test_mutex_debug() CHECKr(pthread_mutex_destroy(&mutex_debug)); } -void -test_mutex_recursive() +static void +test_mutex_recursive(void) { pthread_mutexattr_t mutex_recursive_attr; pthread_mutex_t mutex_recursive; @@ -187,7 +181,7 @@ test_mutex_recursive() } int -main() +main(int argc, char *argv[]) { test_mutex_static(); test_mutex_fast(); diff --git a/regress/lib/libpthread/pthread_specific/pthread_specific.c b/regress/lib/libpthread/pthread_specific/pthread_specific.c index 7c030bacabc..ec00ce6aa5c 100644 --- a/regress/lib/libpthread/pthread_specific/pthread_specific.c +++ b/regress/lib/libpthread/pthread_specific/pthread_specific.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_specific.c,v 1.2 2002/06/16 23:05:14 marc Exp $ */ +/* $OpenBSD: pthread_specific.c,v 1.3 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 2002 CubeSoft Communications, Inc. @@ -37,7 +37,7 @@ pthread_key_t key; int destroy_run = 0; -void * +static void * run_thread(void *arg) { int i; @@ -58,14 +58,14 @@ run_thread(void *arg) return (NULL); } -void +static void destroy_key(void *keyp) { destroy_run++; } int -main() +main(int argc, char *argv[]) { pthread_t threads[NTHREADS]; int i; diff --git a/regress/lib/libpthread/readdir/readdir.c b/regress/lib/libpthread/readdir/readdir.c index c3eea4d4379..7b5c8b7413d 100644 --- a/regress/lib/libpthread/readdir/readdir.c +++ b/regress/lib/libpthread/readdir/readdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readdir.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: readdir.c,v 1.3 2003/07/31 21:48:05 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -49,7 +49,7 @@ #include "test.h" int -main() +main(int argc, char *argv[]) { struct dirent * file; DIR * dot_dir; diff --git a/regress/lib/libpthread/select/select.c b/regress/lib/libpthread/select/select.c index e7ab6b86792..5e3f4a61fa0 100644 --- a/regress/lib/libpthread/select/select.c +++ b/regress/lib/libpthread/select/select.c @@ -1,4 +1,4 @@ -/* $OpenBSD: select.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: select.c,v 1.3 2003/07/31 21:48:06 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -51,9 +51,8 @@ int ntouts = 0; -void * -bg_routine(arg) - void *arg; +static void * +bg_routine(void *arg) { char dot = '.'; int n; @@ -71,9 +70,8 @@ bg_routine(arg) } } -void * -fg_routine(arg) - void *arg; +static void * +fg_routine(void *arg) { int flags; int n; @@ -127,9 +125,7 @@ fg_routine(arg) } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { pthread_t bg_thread, fg_thread; FILE * slpr; diff --git a/regress/lib/libpthread/setjmp/setjmp.c b/regress/lib/libpthread/setjmp/setjmp.c index fa3f4867b8e..5fa9f73bd37 100644 --- a/regress/lib/libpthread/setjmp/setjmp.c +++ b/regress/lib/libpthread/setjmp/setjmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setjmp.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */ +/* $OpenBSD: setjmp.c,v 1.3 2003/07/31 21:48:06 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -38,9 +38,8 @@ int reached; -void * -_jump(arg) - void *arg; +static void * +_jump(void *arg) { jmp_buf foo; @@ -54,9 +53,8 @@ _jump(arg) PANIC("_longjmp"); } -void * -jump(arg) - void *arg; +static void * +jump(void *arg) { jmp_buf foo; @@ -71,7 +69,7 @@ jump(arg) } int -main() +main(int argc, char *argv[]) { pthread_t child; void *res; diff --git a/regress/lib/libpthread/siginfo/siginfo.c b/regress/lib/libpthread/siginfo/siginfo.c index c45ed8ce293..7deeda7c7a0 100644 --- a/regress/lib/libpthread/siginfo/siginfo.c +++ b/regress/lib/libpthread/siginfo/siginfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siginfo.c,v 1.9 2003/06/19 00:59:54 pvalchev Exp $ */ +/* $OpenBSD: siginfo.c,v 1.10 2003/07/31 21:48:06 deraadt Exp $ */ /* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */ /* @@ -9,12 +9,13 @@ #include <signal.h> #include <stdio.h> #include <unistd.h> +#include <stdlib.h> #include "test.h" #define BOGUS (char *)0x987230 -void +static void act_handler(int signal, siginfo_t *siginfo, void *context) { struct sigaction sa; diff --git a/regress/lib/libpthread/signal/signal.c b/regress/lib/libpthread/signal/signal.c index 815052db03d..a8b15d2598a 100644 --- a/regress/lib/libpthread/signal/signal.c +++ b/regress/lib/libpthread/signal/signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.c,v 1.4 2002/06/16 23:06:15 marc Exp $ */ +/* $OpenBSD: signal.c,v 1.5 2003/07/31 21:48:06 deraadt Exp $ */ /* David Leonard <d@openbsd.org>, 2001. Public Domain. */ /* @@ -14,9 +14,8 @@ volatile int alarmed; -void * -sleeper(arg) - void *arg; +static void * +sleeper(void *arg) { sigset_t mask; @@ -28,9 +27,8 @@ sleeper(arg) SUCCEED; } -void -handler(sig) - int sig; +static void +handler(int sig) { int save_errno = errno; @@ -41,7 +39,7 @@ handler(sig) } int -main() +main(int argc, char *argv[]) { pthread_t slpr; diff --git a/regress/lib/libpthread/signodefer/signodefer.c b/regress/lib/libpthread/signodefer/signodefer.c index 211cc648ce0..3773a5345e3 100644 --- a/regress/lib/libpthread/signodefer/signodefer.c +++ b/regress/lib/libpthread/signodefer/signodefer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: signodefer.c,v 1.2 2002/10/23 22:30:04 marc Exp $ */ +/* $OpenBSD: signodefer.c,v 1.3 2003/07/31 21:48:06 deraadt Exp $ */ /* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */ /* @@ -15,7 +15,7 @@ volatile sig_atomic_t sigactive; volatile sig_atomic_t sigcount; volatile sig_atomic_t was_active; -void +static void act_handler(int signal, siginfo_t *siginfo, void *context) { char *str; diff --git a/regress/lib/libpthread/sleep/sleep.c b/regress/lib/libpthread/sleep/sleep.c index e2da9992f7f..e3f024297c6 100644 --- a/regress/lib/libpthread/sleep/sleep.c +++ b/regress/lib/libpthread/sleep/sleep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sleep.c,v 1.3 2002/06/16 23:06:28 marc Exp $ */ +/* $OpenBSD: sleep.c,v 1.4 2003/07/31 21:48:06 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -50,7 +50,8 @@ const char buf[] = "abcdefghijklimnopqrstuvwxyz"; int fd = 1; -void* new_thread(void* arg) +static void * +new_thread(void* arg) { int i; @@ -62,7 +63,7 @@ void* new_thread(void* arg) } int -main() +main(int argc, char *argv[]) { pthread_t thread[2]; int count = sizeof thread/sizeof thread[0]; diff --git a/regress/lib/libpthread/socket/1/socket1.c b/regress/lib/libpthread/socket/1/socket1.c index ee41bf1db48..ad6ab73f2d4 100644 --- a/regress/lib/libpthread/socket/1/socket1.c +++ b/regress/lib/libpthread/socket/1/socket1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: socket1.c,v 1.1 2001/08/15 14:37:10 fgsch Exp $ */ +/* $OpenBSD: socket1.c,v 1.2 2003/07/31 21:48:06 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -60,9 +60,8 @@ pthread_attr_t attr; static int counter = 0; -void * -sock_connect(arg) - void *arg; +static void * +sock_connect(void *arg) { char buf[1024]; int fd; @@ -102,9 +101,8 @@ sock_connect(arg) return(NULL); } -void * -sock_write(arg) - void *arg; +static void * +sock_write(void *arg) { int fd = *(int *)arg; @@ -112,9 +110,8 @@ sock_write(arg) return(NULL); } -void * -sock_accept(arg) - void *arg; +static void * +sock_accept(void *arg) { pthread_t thread; struct sockaddr a_sin; @@ -173,7 +170,7 @@ sock_accept(arg) } int -main() +main(int argc, char *argv[]) { pthread_t thread; diff --git a/regress/lib/libpthread/socket/2/socket2.c b/regress/lib/libpthread/socket/2/socket2.c index 7ba7d19df7d..843d8d2f851 100644 --- a/regress/lib/libpthread/socket/2/socket2.c +++ b/regress/lib/libpthread/socket/2/socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: socket2.c,v 1.3 2002/01/02 16:15:32 fgsch Exp $ */ +/* $OpenBSD: socket2.c,v 1.4 2003/07/31 21:48:06 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -59,9 +59,8 @@ struct sockaddr_in a_sout; #define MESSAGE5 "This should be message #5" #define MESSAGE6 "This should be message #6" -void * -sock_write(arg) - void *arg; +static void * +sock_write(void *arg) { int fd = *(int *)arg; @@ -72,8 +71,8 @@ sock_write(arg) static pthread_mutex_t waiter_mutex = PTHREAD_MUTEX_INITIALIZER; -void* -waiter(sig) +static void * +waiter(int sig) { int status; pid_t pid; @@ -89,9 +88,8 @@ waiter(sig) return (NULL); } -void * -sock_accept(arg) - void *arg; +static void * +sock_accept(void *arg) { pthread_t thread, wthread; struct sockaddr a_sin; @@ -175,7 +173,7 @@ sock_accept(arg) } int -main() +main(int argc, char *argv[]) { pthread_t thread; diff --git a/regress/lib/libpthread/socket/2a/socket2a.c b/regress/lib/libpthread/socket/2a/socket2a.c index 67b8a07c4fb..4878a2bf16d 100644 --- a/regress/lib/libpthread/socket/2a/socket2a.c +++ b/regress/lib/libpthread/socket/2a/socket2a.c @@ -1,4 +1,4 @@ -/* $OpenBSD: socket2a.c,v 1.3 2002/01/02 16:15:32 fgsch Exp $ */ +/* $OpenBSD: socket2a.c,v 1.4 2003/07/31 21:48:06 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -57,9 +57,8 @@ struct sockaddr_in a_sout; #define MESSAGE5 "This should be message #5" #define MESSAGE6 "This should be message #6" -void * -sock_connect(arg) - void *arg; +static void * +sock_connect(void *arg) { char buf[1024]; int fd; @@ -95,9 +94,7 @@ sock_connect(arg) } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { pthread_t thread; diff --git a/regress/lib/libpthread/socket/3/socket3.c b/regress/lib/libpthread/socket/3/socket3.c index 5f17bf9571c..6df2e25f2a6 100644 --- a/regress/lib/libpthread/socket/3/socket3.c +++ b/regress/lib/libpthread/socket/3/socket3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: socket3.c,v 1.2 2002/10/12 19:02:51 marc Exp $ */ +/* $OpenBSD: socket3.c,v 1.3 2003/07/31 21:48:06 deraadt Exp $ */ /* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */ /* Test blocking/non-blocking mode inheritance on accept */ @@ -20,7 +20,7 @@ * connect to the test port passed in arg, then close the connection * and return. */ -void * +static void * sock_connect(void *arg) { struct sockaddr_in sin; @@ -43,7 +43,7 @@ sock_connect(void *arg) * verify that the blocking mode of the socket returned from accept is * also non-blocking */ -void * +static void * sock_accept(void *arg) { pthread_t connect_thread; diff --git a/regress/lib/libpthread/stdarg/stdarg.c b/regress/lib/libpthread/stdarg/stdarg.c index 3d677db3715..c06beaa185b 100644 --- a/regress/lib/libpthread/stdarg/stdarg.c +++ b/regress/lib/libpthread/stdarg/stdarg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stdarg.c,v 1.4 2001/12/12 21:18:34 fgsch Exp $ */ +/* $OpenBSD: stdarg.c,v 1.5 2003/07/31 21:48:06 deraadt Exp $ */ /* David Leonard <d@openbsd.org>, 2001. Public Domain. */ /* @@ -15,7 +15,7 @@ int thing; -int +static int test1(char *fmt, ...) { va_list ap; @@ -56,9 +56,8 @@ test1(char *fmt, ...) return 9; } -void * -run_test(arg) - void *arg; +static void * +run_test(void *arg) { char *msg = (char *)arg; int i; @@ -74,7 +73,7 @@ run_test(arg) } int -main() +main(int argc, char *argv[]) { pthread_t t1, t2; diff --git a/regress/lib/libpthread/stdio/stdio.c b/regress/lib/libpthread/stdio/stdio.c index 9f3246d516b..b2dd7c96ef3 100644 --- a/regress/lib/libpthread/stdio/stdio.c +++ b/regress/lib/libpthread/stdio/stdio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stdio.c,v 1.1 2001/08/15 14:37:16 fgsch Exp $ */ +/* $OpenBSD: stdio.c,v 1.2 2003/07/31 21:48:06 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -45,8 +45,8 @@ char * dir_name = SRCDIR; char * fullname; /* Test fopen()/ftell()/getc() */ -void -test_1() +static void +test_1(void) { struct stat statbuf; FILE * fp; @@ -66,8 +66,8 @@ test_1() } /* Test fopen()/fclose() */ -void -test_2() +static void +test_2(void) { FILE *fp1, *fp2; @@ -81,7 +81,7 @@ test_2() } /* Test sscanf()/sprintf() */ -void +static void test_3(void) { char * str = "10 4.53"; @@ -92,12 +92,12 @@ test_3(void) ASSERT(sscanf(str, "%d %lf", &i, &d) == 2); /* Should have a check */ - sprintf(buf, "%d %2.2f", i, d); + snprintf(buf, sizeof buf, "%d %2.2f", i, d); ASSERT(strcmp(buf, str) == 0); } int -main() +main(int argc, char *argv[]) { CHECKn(fullname = malloc (strlen (dir_name) + strlen (base_name) + 2)); diff --git a/regress/lib/libpthread/switch/switch.c b/regress/lib/libpthread/switch/switch.c index 1d150a461af..f90e9bdca8a 100644 --- a/regress/lib/libpthread/switch/switch.c +++ b/regress/lib/libpthread/switch/switch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switch.c,v 1.3 2002/10/12 18:59:13 marc Exp $ */ +/* $OpenBSD: switch.c,v 1.4 2003/07/31 21:48:07 deraadt Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors, * proven@mit.edu All rights reserved. @@ -58,7 +58,8 @@ volatile int ending = 0; /* ========================================================================== * usage(); */ -void usage(void) +static void +usage(void) { extern char *__progname; printf("usage: %s [-?] [-c count]\n", __progname); @@ -66,9 +67,8 @@ void usage(void) errno = 0; } -void * -new_thread(arg) - void *arg; +static void * +new_thread(void *arg) { int i; @@ -83,9 +83,7 @@ new_thread(arg) } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { pthread_t thread; int count = 4; diff --git a/regress/lib/libskey/skeytest.c b/regress/lib/libskey/skeytest.c index c3225954fcf..ce06a39f055 100644 --- a/regress/lib/libskey/skeytest.c +++ b/regress/lib/libskey/skeytest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: skeytest.c,v 1.1 2003/06/15 16:40:27 mickey Exp $ */ +/* $OpenBSD: skeytest.c,v 1.2 2003/07/31 21:48:07 deraadt Exp $ */ /* $NetBSD: skeytest.c,v 1.3 2002/02/21 07:38:18 itojun Exp $ */ /*- @@ -67,54 +67,52 @@ struct regPass { { NULL } }; -int main() - { +int +main(int argc, char *argv[]) +{ char data[16], prn[64]; struct regPass *rp; int i = 0; int errors = 0; int j; - for(rp = regPass; rp->passphrase; rp++) - { + for(rp = regPass; rp->passphrase; rp++) { struct regRes *rr; i++; - for(rr = rp->res; rr->algo; rr++) - { + for(rr = rp->res; rr->algo; rr++) { skey_set_algorithm(rr->algo); keycrunch(data, rp->seed, rp->passphrase); btoa8(prn, data); - if(strcasecmp(prn, rr->zero)) - { + if(strcasecmp(prn, rr->zero)) { errors++; - printf("Set %d, round 0, %s: Expected %s and got %s\n", i, rr->algo, rr->zero, prn); - } + printf("Set %d, round 0, %s: Expected %s and got %s\n", + i, rr->algo, rr->zero, prn); + } f(data); btoa8(prn, data); - if(strcasecmp(prn, rr->one)) - { + if(strcasecmp(prn, rr->one)) { errors++; - printf("Set %d, round 1, %s: Expected %s and got %s\n", i, rr->algo, rr->one, prn); - } + printf("Set %d, round 1, %s: Expected %s and got %s\n", + i, rr->algo, rr->one, prn); + } for(j=1; j<99; j++) f(data); btoa8(prn, data); - if(strcasecmp(prn, rr->nine)) - { + if(strcasecmp(prn, rr->nine)) { errors++; - printf("Set %d, round 99, %s: Expected %s and got %s\n", i, rr->algo, rr->nine, prn); - } - + printf("Set %d, round 99, %s: Expected %s and got %s\n", + i, rr->algo, rr->nine, prn); } } + } printf("%d errors\n", errors); return(errors ? 1 : 0); - } +} diff --git a/regress/lib/libutil/fmt_scaled/fmt_test.c b/regress/lib/libutil/fmt_scaled/fmt_test.c index f9fe5f1be20..0b7bf0ef577 100644 --- a/regress/lib/libutil/fmt_scaled/fmt_test.c +++ b/regress/lib/libutil/fmt_scaled/fmt_test.c @@ -13,8 +13,8 @@ #include <util.h> -static int fmt_test(); -static int scan_test(); +static int fmt_test(void); +static int scan_test(void); static void print_errno(int e); static int assert_int(int testnum, int checknum, int expect, int result); @@ -104,7 +104,7 @@ static struct { /* the test cases */ # define DDATA_LENGTH (sizeof ddata/sizeof *ddata) static int -fmt_test() +fmt_test(void) { unsigned int i, e, errs = 0; int ret; @@ -204,7 +204,7 @@ print(char *input, quad_t result, int ret) } static int -scan_test() +scan_test(void) { unsigned int i, errs = 0, e; int ret; diff --git a/regress/sys/arch/i386/ldt/testldt.c b/regress/sys/arch/i386/ldt/testldt.c index 60fea3cc943..6e8da7ed7a9 100644 --- a/regress/sys/arch/i386/ldt/testldt.c +++ b/regress/sys/arch/i386/ldt/testldt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: testldt.c,v 1.5 2001/11/11 23:26:35 deraadt Exp $ */ +/* $OpenBSD: testldt.c,v 1.6 2003/07/31 21:48:07 deraadt Exp $ */ /* $NetBSD: testldt.c,v 1.4 1995/04/20 22:42:38 cgd Exp $ */ #include <stdio.h> @@ -13,12 +13,14 @@ extern int i386_set_ldt(int, union descriptor *, int); int verbose = 0; struct sigaction segv_act; -inline void set_fs(unsigned long val) +static inline void +set_fs(unsigned long val) { __asm__ __volatile__("mov %0,%%fs"::"r" ((unsigned short) val)); } -inline unsigned char get_fs_byte(const char * addr) +static inline unsigned char +get_fs_byte(const char * addr) { unsigned register char _v; @@ -26,7 +28,8 @@ inline unsigned char get_fs_byte(const char * addr) return _v; } -inline unsigned short get_cs(void) +static inline unsigned short +get_cs(void) { unsigned register short _v; @@ -34,7 +37,7 @@ inline unsigned short get_cs(void) return _v; } -int +static int check_desc(unsigned int desc) { desc = LSEL(desc, SEL_UPL); @@ -42,15 +45,15 @@ check_desc(unsigned int desc) return(get_fs_byte((char *) 0)); } -void -gated_call() +static void +gated_call(void) { printf("Called from call gate..."); __asm__ __volatile__("popl %ebp"); __asm__ __volatile__(".byte 0xcb"); } -struct segment_descriptor * +static struct segment_descriptor * make_sd(unsigned base, unsigned limit, int type, int dpl, int seg32, int inpgs) { static struct segment_descriptor d; @@ -69,7 +72,7 @@ make_sd(unsigned base, unsigned limit, int type, int dpl, int seg32, int inpgs) return (&d); } -struct gate_descriptor * +static struct gate_descriptor * make_gd(unsigned offset, unsigned int sel, unsigned stkcpy, int type, int dpl) { static struct gate_descriptor d; @@ -85,7 +88,7 @@ make_gd(unsigned offset, unsigned int sel, unsigned stkcpy, int type, int dpl) return(&d); } -void +static void print_ldt(union descriptor *dp) { unsigned long base_addr, limit, offset, selector, stack_copy; diff --git a/regress/sys/crypto/auth/md5.c b/regress/sys/crypto/auth/md5.c index 8de6b7f8a77..83207b64d83 100644 --- a/regress/sys/crypto/auth/md5.c +++ b/regress/sys/crypto/auth/md5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: md5.c,v 1.3 2002/06/23 21:46:10 wcobb Exp $ */ +/* $OpenBSD: md5.c,v 1.4 2003/07/31 21:48:07 deraadt Exp $ */ /* * Copyright (c) 2002 Markus Friedl. All rights reserverd. @@ -37,7 +37,7 @@ #define MD5LEN 16 -char * +static char * sysmd5(const char *s, size_t len) { static char md[MD5LEN*2 + 1]; @@ -94,7 +94,7 @@ err: return (NULL); } -int +static int getallowsoft(void) { int mib[2], old; @@ -110,7 +110,7 @@ getallowsoft(void) return old; } -void +static void setallowsoft(int new) { int mib[2], old; diff --git a/regress/sys/crypto/enc/des3.c b/regress/sys/crypto/enc/des3.c index 49eda4d4113..0d32a56fd48 100644 --- a/regress/sys/crypto/enc/des3.c +++ b/regress/sys/crypto/enc/des3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: des3.c,v 1.5 2002/06/23 21:46:10 wcobb Exp $ */ +/* $OpenBSD: des3.c,v 1.6 2003/07/31 21:48:07 deraadt Exp $ */ /* * Copyright (c) 2002 Markus Friedl. All rights reserverd. @@ -37,7 +37,7 @@ #include <string.h> #include <unistd.h> -int +static int syscrypt(const unsigned char *key, size_t klen, const unsigned char *iv, const unsigned char *in, unsigned char *out, size_t len, int encrypt) { @@ -90,7 +90,7 @@ err: return (-1); } -int +static int getallowsoft(void) { int mib[2], old; @@ -106,7 +106,7 @@ getallowsoft(void) return old; } -void +static void setallowsoft(int new) { int mib[2], old; @@ -121,7 +121,7 @@ setallowsoft(int new) err(1, "sysctl failed"); } -int +static int match(unsigned char *a, unsigned char *b, size_t len) { int i; diff --git a/regress/sys/fdescfs/confuse/confuse.c b/regress/sys/fdescfs/confuse/confuse.c index 4fb68d94e32..a46aeced9e3 100644 --- a/regress/sys/fdescfs/confuse/confuse.c +++ b/regress/sys/fdescfs/confuse/confuse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: confuse.c,v 1.1 2002/02/08 17:33:32 art Exp $ */ +/* $OpenBSD: confuse.c,v 1.2 2003/07/31 21:48:07 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -10,7 +10,7 @@ #include <errno.h> int -main() +main(int argc, char *argv[]) { char fname[64]; int fd, newfd; diff --git a/regress/sys/kern/__syscall/__syscall.c b/regress/sys/kern/__syscall/__syscall.c index c44ea3fb773..62a75db735c 100644 --- a/regress/sys/kern/__syscall/__syscall.c +++ b/regress/sys/kern/__syscall/__syscall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: __syscall.c,v 1.2 2002/02/13 16:24:25 art Exp $ */ +/* $OpenBSD: __syscall.c,v 1.3 2003/07/31 21:48:07 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -10,7 +10,7 @@ #include <err.h> int -main() +main(int argc, char *argv[]) { int status; diff --git a/regress/sys/kern/accept/accept.c b/regress/sys/kern/accept/accept.c index 354ac8f5a37..b42e6688174 100644 --- a/regress/sys/kern/accept/accept.c +++ b/regress/sys/kern/accept/accept.c @@ -1,4 +1,4 @@ -/* $OpenBSD: accept.c,v 1.2 2002/02/14 22:43:03 art Exp $ */ +/* $OpenBSD: accept.c,v 1.3 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain. */ @@ -21,9 +21,7 @@ int child(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int listensock, sock; struct sockaddr_un sun, csun; diff --git a/regress/sys/kern/dup2/dup2test.c b/regress/sys/kern/dup2/dup2test.c index b857dadc8a2..1c60ae01623 100644 --- a/regress/sys/kern/dup2/dup2test.c +++ b/regress/sys/kern/dup2/dup2test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dup2test.c,v 1.2 2002/02/08 16:56:07 art Exp $ */ +/* $OpenBSD: dup2test.c,v 1.3 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2001 Public Domain. */ @@ -9,7 +9,7 @@ #include <fcntl.h> int -main() +main(int argc, char *argv[]) { int orgfd, fd1, fd2; char temp[] = "/tmp/dup2XXXXXXXXX"; diff --git a/regress/sys/kern/dup2_self/dup2_self.c b/regress/sys/kern/dup2_self/dup2_self.c index 08a4cd4a94c..5849abe5e86 100644 --- a/regress/sys/kern/dup2_self/dup2_self.c +++ b/regress/sys/kern/dup2_self/dup2_self.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dup2_self.c,v 1.2 2002/02/18 13:32:08 art Exp $ */ +/* $OpenBSD: dup2_self.c,v 1.3 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -29,7 +29,7 @@ */ int -main() +main(int argc, char *argv[]) { int orgfd, fd1, fd2; char temp[] = "/tmp/dup2XXXXXXXXX"; diff --git a/regress/sys/kern/execve/doexec.c b/regress/sys/kern/execve/doexec.c index cfb7d3b90ea..a331ed52481 100644 --- a/regress/sys/kern/execve/doexec.c +++ b/regress/sys/kern/execve/doexec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: doexec.c,v 1.3 2001/01/29 02:05:55 niklas Exp $ */ +/* $OpenBSD: doexec.c,v 1.4 2003/07/31 21:48:08 deraadt Exp $ */ /* $NetBSD: doexec.c,v 1.3 1995/04/20 22:43:13 cgd Exp $ */ /* @@ -37,9 +37,7 @@ #include <unistd.h> int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "usage: %s <progname>\n", argv[0]); diff --git a/regress/sys/kern/execve/tests/goodaout.c b/regress/sys/kern/execve/tests/goodaout.c index 2cc216c152a..644d8d36777 100644 --- a/regress/sys/kern/execve/tests/goodaout.c +++ b/regress/sys/kern/execve/tests/goodaout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: goodaout.c,v 1.2 2001/01/29 02:05:56 niklas Exp $ */ +/* $OpenBSD: goodaout.c,v 1.3 2003/07/31 21:48:08 deraadt Exp $ */ /* $NetBSD: goodaout.c,v 1.3 1995/04/20 22:44:20 cgd Exp $ */ /* @@ -35,9 +35,7 @@ #include <unistd.h> int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv) { printf("succeeded\n"); exit(0); diff --git a/regress/sys/kern/exit/exit.c b/regress/sys/kern/exit/exit.c index 996ad1cf75c..485a8d6be47 100644 --- a/regress/sys/kern/exit/exit.c +++ b/regress/sys/kern/exit/exit.c @@ -1,11 +1,11 @@ -/* $OpenBSD: exit.c,v 1.1 2002/02/08 20:15:14 art Exp $ */ +/* $OpenBSD: exit.c,v 1.2 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ #include <stdlib.h> int -main() +main(int argc, char *argv[]) { _exit(0); abort(); diff --git a/regress/sys/kern/fcntl_dup/fcntl_dup.c b/regress/sys/kern/fcntl_dup/fcntl_dup.c index ddad17ae908..88469c611f9 100644 --- a/regress/sys/kern/fcntl_dup/fcntl_dup.c +++ b/regress/sys/kern/fcntl_dup/fcntl_dup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fcntl_dup.c,v 1.1 2002/02/08 17:05:55 art Exp $ */ +/* $OpenBSD: fcntl_dup.c,v 1.2 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -9,7 +9,7 @@ #include <fcntl.h> int -main() +main(int argc, char *argv[]) { int orgfd, fd1, fd2; char temp[] = "/tmp/dup2XXXXXXXXX"; diff --git a/regress/sys/kern/getrusage/getrusage.c b/regress/sys/kern/getrusage/getrusage.c index f95dccc7f54..13bd3f08f88 100644 --- a/regress/sys/kern/getrusage/getrusage.c +++ b/regress/sys/kern/getrusage/getrusage.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getrusage.c,v 1.2 2002/02/16 01:03:35 nordin Exp $ */ +/* $OpenBSD: getrusage.c,v 1.3 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Thomas Nordin <nordin@openbsd.org> 2002 Public Domain. */ @@ -13,7 +13,7 @@ #include <sys/types.h> int -main() +main(int argc, char *argv[]) { struct timeval utime; struct timeval stime; diff --git a/regress/sys/kern/gettimeofday/gettimeofday.c b/regress/sys/kern/gettimeofday/gettimeofday.c index b27d16f9c0a..df6771a3b83 100644 --- a/regress/sys/kern/gettimeofday/gettimeofday.c +++ b/regress/sys/kern/gettimeofday/gettimeofday.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gettimeofday.c,v 1.1 2002/02/21 09:21:30 nordin Exp $ */ +/* $OpenBSD: gettimeofday.c,v 1.2 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Thomas Nordin <nordin@openbsd.org> 2002 Public Domain. */ @@ -8,7 +8,7 @@ #include <sys/time.h> int -main() +main(int argc, char *argv[]) { struct timeval s; struct timeval t1; diff --git a/regress/sys/kern/kqueue/kqueue-fork.c b/regress/sys/kern/kqueue/kqueue-fork.c index 497ffbd90a5..67ab19350a7 100644 --- a/regress/sys/kern/kqueue/kqueue-fork.c +++ b/regress/sys/kern/kqueue/kqueue-fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kqueue-fork.c,v 1.1 2002/02/27 17:11:51 art Exp $ */ +/* $OpenBSD: kqueue-fork.c,v 1.2 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain */ @@ -12,6 +12,8 @@ #include <sys/event.h> #include <sys/wait.h> +int check_inheritance(void); + int check_inheritance(void) { diff --git a/regress/sys/kern/kqueue/kqueue-pipe.c b/regress/sys/kern/kqueue/kqueue-pipe.c index 8995904be7c..6ef3ccdb721 100644 --- a/regress/sys/kern/kqueue/kqueue-pipe.c +++ b/regress/sys/kern/kqueue/kqueue-pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kqueue-pipe.c,v 1.3 2002/02/27 17:11:51 art Exp $ */ +/* $OpenBSD: kqueue-pipe.c,v 1.4 2003/07/31 21:48:08 deraadt Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -35,6 +35,8 @@ #include <unistd.h> #include <fcntl.h> +int do_pipe(void); + int do_pipe(void) { diff --git a/regress/sys/kern/kqueue/kqueue-process.c b/regress/sys/kern/kqueue/kqueue-process.c index 3fc9b016edf..9fda608870c 100644 --- a/regress/sys/kern/kqueue/kqueue-process.c +++ b/regress/sys/kern/kqueue/kqueue-process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kqueue-process.c,v 1.3 2003/06/12 04:52:40 mickey Exp $ */ +/* $OpenBSD: kqueue-process.c,v 1.4 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain */ @@ -19,12 +19,14 @@ static int process_child(void); #define ASSX(cond) ASS(cond, warnx("assertion " #cond " failed on line %d", __LINE__)) -void +static void usr1handler(int signum) { /* nada */ } +int do_process(void); + int do_process(void) { diff --git a/regress/sys/kern/kqueue/kqueue-pty.c b/regress/sys/kern/kqueue/kqueue-pty.c index e171fc96a67..e6f1e5ad8b4 100644 --- a/regress/sys/kern/kqueue/kqueue-pty.c +++ b/regress/sys/kern/kqueue/kqueue-pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kqueue-pty.c,v 1.4 2003/07/31 03:23:41 mickey Exp $ */ +/* $OpenBSD: kqueue-pty.c,v 1.5 2003/07/31 21:48:08 deraadt Exp $ */ /* Written by Michael Shalayeff, 2003, Public Domain */ @@ -12,7 +12,7 @@ #include <fcntl.h> #include <err.h> -int +static int pty_check(int kq, struct kevent *ev, int n, int rm, int rs, int wm, int ws) { struct timespec ts; @@ -44,6 +44,8 @@ pty_check(int kq, struct kevent *ev, int n, int rm, int rs, int wm, int ws) return (0); } +int do_pty(void); + int do_pty(void) { diff --git a/regress/sys/kern/kqueue/kqueue-random.c b/regress/sys/kern/kqueue/kqueue-random.c index 22ca4db6cfa..681e8c49a0a 100644 --- a/regress/sys/kern/kqueue/kqueue-random.c +++ b/regress/sys/kern/kqueue/kqueue-random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kqueue-random.c,v 1.3 2003/07/31 03:23:41 mickey Exp $ */ +/* $OpenBSD: kqueue-random.c,v 1.4 2003/07/31 21:48:08 deraadt Exp $ */ /* Written by Michael Shalayeff, 2002, Public Domain */ #include <stdlib.h> @@ -13,6 +13,8 @@ #include <dev/rndvar.h> +int do_random(void); + int do_random(void) { diff --git a/regress/sys/kern/minherit/minherit.c b/regress/sys/kern/minherit/minherit.c index 2b5ed236db2..644a99988bc 100644 --- a/regress/sys/kern/minherit/minherit.c +++ b/regress/sys/kern/minherit/minherit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: minherit.c,v 1.1 2002/01/31 15:53:12 art Exp $ */ +/* $OpenBSD: minherit.c,v 1.2 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> Public Domain. */ @@ -14,7 +14,7 @@ #define MAGIC "inherited" int -main() +main(int argc, char *argv[]) { void *map1, *map2; int page_size; diff --git a/regress/sys/kern/mmap2/mmaptest.c b/regress/sys/kern/mmap2/mmaptest.c index 12e08b65a29..6d7ecff7dcf 100644 --- a/regress/sys/kern/mmap2/mmaptest.c +++ b/regress/sys/kern/mmap2/mmaptest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mmaptest.c,v 1.5 2002/09/12 04:09:31 mickey Exp $ */ +/* $OpenBSD: mmaptest.c,v 1.6 2003/07/31 21:48:08 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2001 Public Domain */ @@ -20,7 +20,7 @@ #define MAGIC "The voices in my head are trying to ignore me." int -main() +main(int argc, char *argv[]) { char fname[25] = "/tmp/mmaptestXXXXXXXXXX"; int page_size; diff --git a/regress/sys/kern/mmap3/mmaptest.c b/regress/sys/kern/mmap3/mmaptest.c index 83452b8ba0e..0a2526e8004 100644 --- a/regress/sys/kern/mmap3/mmaptest.c +++ b/regress/sys/kern/mmap3/mmaptest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mmaptest.c,v 1.2 2002/08/21 14:45:17 espie Exp $ */ +/* $OpenBSD: mmaptest.c,v 1.3 2003/07/31 21:48:08 deraadt Exp $ */ /* * Copyright (c) 2002 Marc Espie. * @@ -36,7 +36,7 @@ * a short file may lose modifications made through an mmapped area. */ int -main() +main(int argc, char *argv[]) { int i; int fd; diff --git a/regress/sys/kern/noexec/noexec.c b/regress/sys/kern/noexec/noexec.c index a08fbe0bb78..f9b84cc9a95 100644 --- a/regress/sys/kern/noexec/noexec.c +++ b/regress/sys/kern/noexec/noexec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: noexec.c,v 1.6 2003/05/05 15:34:46 mickey Exp $ */ +/* $OpenBSD: noexec.c,v 1.7 2003/07/31 21:48:09 deraadt Exp $ */ /* * Copyright (c) 2002,2003 Michael Shalayeff @@ -49,9 +49,9 @@ char label[64] = "non-exec "; u_int64_t data[(PAD + TESTSZ + PAD + MAXPAGESIZE) / 8] = { 0 }; u_int64_t bss[(PAD + TESTSZ + PAD + MAXPAGESIZE) / 8]; -void testfly(); +void testfly(void); -void +static void fdcache(void *p, size_t size) { #ifdef __hppa__ @@ -68,13 +68,13 @@ fdcache(void *p, size_t size) #endif } -void +static void sigsegv(int sig, siginfo_t *sip, void *scp) { _exit(fail); } -int +static int noexec(void *p, size_t size) { fail = 0; @@ -85,7 +85,7 @@ noexec(void *p, size_t size) return (1); } -int +static int noexec_mprotect(void *p, size_t size) { @@ -108,7 +108,7 @@ noexec_mprotect(void *p, size_t size) return (1); } -void * +static void * getaddr(void *a) { void *ret; @@ -121,7 +121,7 @@ getaddr(void *a) return (void *)((u_long)ret & ~(page_size - 1)); } -int +static int noexec_mmap(void *p, size_t size) { memcpy(p + page_size * 1, p, page_size); @@ -156,7 +156,7 @@ noexec_mmap(void *p, size_t size) return (0); } -void +static void usage(void) { extern char *__progname; @@ -268,7 +268,7 @@ main(int argc, char *argv[]) __asm (".space 8192"); void -testfly() +testfly(void) { } diff --git a/regress/sys/kern/pread/pread.c b/regress/sys/kern/pread/pread.c index 23f28155d3f..c4640dd1a32 100644 --- a/regress/sys/kern/pread/pread.c +++ b/regress/sys/kern/pread/pread.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pread.c,v 1.1 2002/02/08 19:05:18 art Exp $ */ +/* $OpenBSD: pread.c,v 1.2 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -9,7 +9,7 @@ #include <fcntl.h> int -main() +main(int argc, char *argv[]) { char temp[] = "/tmp/dup2XXXXXXXXX"; const char magic[10] = "0123456789"; diff --git a/regress/sys/kern/preadv/preadv.c b/regress/sys/kern/preadv/preadv.c index 0bfeb0c8121..261af959608 100644 --- a/regress/sys/kern/preadv/preadv.c +++ b/regress/sys/kern/preadv/preadv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: preadv.c,v 1.1 2002/02/08 20:04:03 art Exp $ */ +/* $OpenBSD: preadv.c,v 1.2 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -11,7 +11,7 @@ #include <fcntl.h> int -main() +main(int argc, char *argv[]) { char temp[] = "/tmp/dup2XXXXXXXXX"; const char magic[10] = "0123456789"; diff --git a/regress/sys/kern/pwrite/pwrite.c b/regress/sys/kern/pwrite/pwrite.c index 6ee95443a0e..a27d0f75094 100644 --- a/regress/sys/kern/pwrite/pwrite.c +++ b/regress/sys/kern/pwrite/pwrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwrite.c,v 1.1 2002/02/08 20:58:02 art Exp $ */ +/* $OpenBSD: pwrite.c,v 1.2 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -9,7 +9,7 @@ #include <fcntl.h> int -main() +main(int argc, char *argv[]) { char temp[] = "/tmp/pwriteXXXXXXXXX"; const char magic[10] = "0123456789"; diff --git a/regress/sys/kern/pwritev/pwritev.c b/regress/sys/kern/pwritev/pwritev.c index 11e6f6e8984..31871565a46 100644 --- a/regress/sys/kern/pwritev/pwritev.c +++ b/regress/sys/kern/pwritev/pwritev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwritev.c,v 1.1 2002/02/08 21:06:05 art Exp $ */ +/* $OpenBSD: pwritev.c,v 1.2 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -11,7 +11,7 @@ #include <fcntl.h> int -main() +main(int argc, char *argv[]) { char temp[] = "/tmp/pwritevXXXXXXXXX"; char magic[10] = "0123456789"; diff --git a/regress/sys/kern/rcvtimeo/rcvtimeo.c b/regress/sys/kern/rcvtimeo/rcvtimeo.c index 34a5f297ec9..c8ddab4d4de 100644 --- a/regress/sys/kern/rcvtimeo/rcvtimeo.c +++ b/regress/sys/kern/rcvtimeo/rcvtimeo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcvtimeo.c,v 1.2 2003/07/31 03:23:41 mickey Exp $ */ +/* $OpenBSD: rcvtimeo.c,v 1.3 2003/07/31 21:48:09 deraadt Exp $ */ /* Written by Michael Shalayeff, 2002, Public Domain */ @@ -15,7 +15,7 @@ volatile int back; -void +static void sigalarm(int sig, siginfo_t *sip, void *scp) { if (!back) diff --git a/regress/sys/kern/rfork/madness/madness.c b/regress/sys/kern/rfork/madness/madness.c index b5002413eaf..d6add455644 100644 --- a/regress/sys/kern/rfork/madness/madness.c +++ b/regress/sys/kern/rfork/madness/madness.c @@ -1,4 +1,4 @@ -/* $OpenBSD: madness.c,v 1.1 2002/02/17 05:58:51 art Exp $ */ +/* $OpenBSD: madness.c,v 1.2 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain. */ @@ -11,7 +11,7 @@ volatile int step; int -main() +main(int argc, char *argv[]) { int fds[2], fd; pid_t pid1, pid2, pid3; diff --git a/regress/sys/kern/rfork/rfcfdg/rfcfdg.c b/regress/sys/kern/rfork/rfcfdg/rfcfdg.c index 069e298c379..95fd6204368 100644 --- a/regress/sys/kern/rfork/rfcfdg/rfcfdg.c +++ b/regress/sys/kern/rfork/rfcfdg/rfcfdg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfcfdg.c,v 1.2 2002/02/21 23:29:05 deraadt Exp $ */ +/* $OpenBSD: rfcfdg.c,v 1.3 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain. */ @@ -11,7 +11,7 @@ #include <fcntl.h> int -main() +main(int argc, char *argv[]) { int status; diff --git a/regress/sys/kern/rfork/rfmem-stack/rfmem-stack.c b/regress/sys/kern/rfork/rfmem-stack/rfmem-stack.c index 373a98767d2..a40fa871f06 100644 --- a/regress/sys/kern/rfork/rfmem-stack/rfmem-stack.c +++ b/regress/sys/kern/rfork/rfmem-stack/rfmem-stack.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfmem-stack.c,v 1.3 2002/02/22 01:06:58 art Exp $ */ +/* $OpenBSD: rfmem-stack.c,v 1.4 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain. */ @@ -14,7 +14,7 @@ #define MAGIC "inherited" int -main() +main(int argc, char *argv[]) { char *map, *map2; int status; diff --git a/regress/sys/kern/rfork/rfmem/rfmem.c b/regress/sys/kern/rfork/rfmem/rfmem.c index 86bc1eee878..b6b38fc2861 100644 --- a/regress/sys/kern/rfork/rfmem/rfmem.c +++ b/regress/sys/kern/rfork/rfmem/rfmem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfmem.c,v 1.2 2002/02/21 23:29:05 deraadt Exp $ */ +/* $OpenBSD: rfmem.c,v 1.3 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain. */ @@ -14,7 +14,7 @@ #define MAGIC "inherited" int -main() +main(int argc, char *argv[]) { void *map; int page_size; diff --git a/regress/sys/kern/rfork/rfnowait/rfnowait.c b/regress/sys/kern/rfork/rfnowait/rfnowait.c index 0b9dd7aea57..58d2421557d 100644 --- a/regress/sys/kern/rfork/rfnowait/rfnowait.c +++ b/regress/sys/kern/rfork/rfnowait/rfnowait.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfnowait.c,v 1.2 2002/02/21 23:29:05 deraadt Exp $ */ +/* $OpenBSD: rfnowait.c,v 1.3 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain. */ @@ -11,7 +11,7 @@ #include <errno.h> int -main() +main(int argc, char *argv[]) { int status; diff --git a/regress/sys/kern/rfork/rfsharefd/rfsharefd.c b/regress/sys/kern/rfork/rfsharefd/rfsharefd.c index 81ce1725c35..ad7c0a3f331 100644 --- a/regress/sys/kern/rfork/rfsharefd/rfsharefd.c +++ b/regress/sys/kern/rfork/rfsharefd/rfsharefd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfsharefd.c,v 1.2 2002/02/17 18:32:09 deraadt Exp $ */ +/* $OpenBSD: rfsharefd.c,v 1.3 2003/07/31 21:48:09 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain. */ @@ -11,7 +11,7 @@ #include <fcntl.h> int -main() +main(int argc, char *argv[]) { int status; int fd; diff --git a/regress/sys/kern/rlimit-file/rlim-file.c b/regress/sys/kern/rlimit-file/rlim-file.c index 1d817f7050e..b1114550a61 100644 --- a/regress/sys/kern/rlimit-file/rlim-file.c +++ b/regress/sys/kern/rlimit-file/rlim-file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rlim-file.c,v 1.2 2002/02/08 17:09:24 art Exp $ */ +/* $OpenBSD: rlim-file.c,v 1.3 2003/07/31 21:48:10 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> (2002) Public Domain. */ @@ -12,7 +12,7 @@ #include <string.h> int -main() +main(int argc, char *argv[]) { int lim, fd, fds[2]; struct rlimit rl; diff --git a/regress/sys/kern/signal/siginfo_addr/siginfo_addr.c b/regress/sys/kern/signal/siginfo_addr/siginfo_addr.c index 668771b7bbd..394e0c1d1c4 100644 --- a/regress/sys/kern/signal/siginfo_addr/siginfo_addr.c +++ b/regress/sys/kern/signal/siginfo_addr/siginfo_addr.c @@ -6,7 +6,7 @@ #define FAULTADDR 0x123123 -void +static void handler(int sig, siginfo_t *sip, void *scp) { char buf[1024]; @@ -23,9 +23,7 @@ handler(int sig, siginfo_t *sip, void *scp) int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct sigaction sa; diff --git a/regress/sys/kern/syscall/syscall.c b/regress/sys/kern/syscall/syscall.c index 3f46729515f..9198e5e2ef3 100644 --- a/regress/sys/kern/syscall/syscall.c +++ b/regress/sys/kern/syscall/syscall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.c,v 1.1 2002/02/08 21:33:32 art Exp $ */ +/* $OpenBSD: syscall.c,v 1.2 2003/07/31 21:48:10 deraadt Exp $ */ /* * Written by Artur Grabowski <art@openbsd.org> 2002 Public Domain. */ @@ -10,7 +10,7 @@ #include <err.h> int -main() +main(int argc, char *argv[]) { int status; diff --git a/regress/sys/kern/unfdpass/unfdpass.c b/regress/sys/kern/unfdpass/unfdpass.c index 1a9727c8d2f..1e9d886010b 100644 --- a/regress/sys/kern/unfdpass/unfdpass.c +++ b/regress/sys/kern/unfdpass/unfdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unfdpass.c,v 1.7 2002/02/16 21:27:32 millert Exp $ */ +/* $OpenBSD: unfdpass.c,v 1.8 2003/07/31 21:48:10 deraadt Exp $ */ /* $NetBSD: unfdpass.c,v 1.3 1998/06/24 23:51:30 thorpej Exp $ */ /*- @@ -89,10 +89,10 @@ main(argc, argv) * Create the test files. */ for (i = 0; i < 2; i++) { - (void) sprintf(fname, "file%d", i + 1); + (void) snprintf(fname, sizeof fname, "file%d", i + 1); if ((fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1) err(1, "open %s", fname); - (void) sprintf(buf, "This is file %d.\n", i + 1); + (void) snprintf(buf, sizeof buf, "This is file %d.\n", i + 1); if (write(fd, buf, strlen(buf)) != strlen(buf)) err(1, "write %s", fname); (void) close(fd); @@ -280,7 +280,7 @@ child() * Open the files again, and pass them to the child over the socket. */ for (i = 0; i < 2; i++) { - (void) sprintf(fname, "file%d", i + 1); + (void) snprintf(fname, sizeof fname, "file%d", i + 1); if ((fd = open(fname, O_RDONLY, 0666)) == -1) err(1, "child open %s", fname); files[i] = fd; diff --git a/regress/sys/sys/tree/rb/rb-test.c b/regress/sys/sys/tree/rb/rb-test.c index 5b05a1db01c..f3be4cc0b68 100644 --- a/regress/sys/sys/tree/rb/rb-test.c +++ b/regress/sys/sys/tree/rb/rb-test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rb-test.c,v 1.2 2002/10/16 15:30:06 art Exp $ */ +/* $OpenBSD: rb-test.c,v 1.3 2003/07/31 21:48:10 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -39,7 +39,7 @@ struct node { RB_HEAD(tree, node) root; -int +static int compare(struct node *a, struct node *b) { if (a->key < b->key) return (-1); diff --git a/regress/sys/sys/tree/splay/splay-test.c b/regress/sys/sys/tree/splay/splay-test.c index a67795a0b71..29718302b49 100644 --- a/regress/sys/sys/tree/splay/splay-test.c +++ b/regress/sys/sys/tree/splay/splay-test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: splay-test.c,v 1.2 2002/10/16 15:30:06 art Exp $ */ +/* $OpenBSD: splay-test.c,v 1.3 2003/07/31 21:48:10 deraadt Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -39,7 +39,7 @@ struct node { SPLAY_HEAD(tree, node) root; -int +static int compare(struct node *a, struct node *b) { if (a->key < b->key) return (-1); |