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 /regress/lib | |
parent | 1472e2b5666bd9c64d37882b7cfb2596d9352eb3 (diff) |
various cleanups; david says results are same
Diffstat (limited to 'regress/lib')
51 files changed, 288 insertions, 311 deletions
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; |