1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

various cleanups; david says results are same

This commit is contained in:
deraadt 2003-07-31 21:48:02 +00:00
parent 0ef9c1bb96
commit db3296cf5c
92 changed files with 574 additions and 590 deletions

View File

@ -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 */
static void
clearbits(bitstr_t *b, int n)
{
register int i = bitstr_size(n);
while (i--)
*(b + i) = 0;
}
static void
printbits(bitstr_t *b, int n)
{
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
main(int argc, char *argv[])
{
void clearbits();
void printbits();
int i;
bitstr_t *bs;
bitstr_t bit_decl(bss, DECL_TEST_LENGTH);
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 (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);
}
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("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));
}
(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);
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_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_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));
}
(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);
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);
(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, 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);
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 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 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 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("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("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) 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);
}
void
clearbits(b, n)
bitstr_t *b;
int n;
{
register int i = bitstr_size(n);
while(i--)
*(b + i) = 0;
}
void
printbits(b, n)
bitstr_t *b;
int n;
{
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) free(bs);
(void) exit(0);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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");
}

View File

@ -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)

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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));

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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];

View File

@ -1,4 +1,4 @@
/* $OpenBSD: socket1.c,v 1.1.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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: stdio.c,v 1.1.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));

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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";

View File

@ -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";

View File

@ -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]);

View File

@ -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);

View File

@ -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();

View File

@ -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";

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)
{
}

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);