1 /* $FreeBSD: src/tools/regression/p1003_1b/main.c,v 1.1 2000/02/16 14:28:40 dufault Exp $ */
5 int fifo(int argc
, char *argv
[]);
6 int memlock(int argc
, char *argv
[]);
7 int p26(int argc
, char *argv
[]);
8 int sched(int argc
, char *argv
[]);
9 int yield(int argc
, char *argv
[]);
13 int (*f
)(int, char *[]);
17 { "memlock", memlock
, 0 },
19 { "sched", sched
, 1 },
20 { "yield", yield
, 1 },
23 #define N(T) (sizeof (T)/ sizeof(T[0]))
25 static int usage(int argc
, char *argv
[])
29 fprintf(stderr
, "%s is unknown\n", argv
[1]);
31 fprintf(stderr
, "usage: %s [-a] or one of [", argv
[0]);
32 for (i
= 0; i
< (sizeof(tab
) / sizeof(tab
[0])); i
++)
33 fprintf(stderr
, "%s%s", (i
)? " | " : "", tab
[i
].t
);
34 fprintf(stderr
, "]\n");
39 int main(int argc
, char *argv
[])
43 if (argc
== 2 && strcmp(argv
[1], "-a") == 0) {
46 "-a should but doesn't really work"
47 " (my notes say \"because things detach\");\n"
48 "meanwhile do these individual tests and look"
49 " for a non-zero exit code:\n");
50 for (i
= 0; i
< N(tab
); i
++)
52 fprintf(stderr
, "p1003_1b %s\n", tab
[i
].t
);
57 for (i
= 0; i
< N(tab
); i
++) {
60 (*tab
[i
].f
)(argc
- 1, argv
+ 1)) ) {
62 "%s failed\n", tab
[i
].t
);
73 for (i
= 0; i
< N(tab
); i
++)
74 if (strcmp(tab
[i
].t
, argv
[1]) == 0)
75 return (*tab
[i
].f
)(argc
- 1, argv
+ 1);
78 return usage(argc
, argv
);