/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following definitions.
- spawnv
- main
1 /*
2 * hogparty
3 *
4 * create some talking hogs
5 *
6 * relies on fork, _exit, stdout and stderr, and execv
7 *
8 */
9
10 #include <unistd.h>
11 #include <err.h>
12
13 static char *xhargv[2] = { (char *)"xhog", NULL };
14 static char *yhargv[2] = { (char *)"yhog", NULL };
15 static char *zhargv[2] = { (char *)"zhog", NULL };
16
17 static
18 void
19 spawnv(const char *prog, char **argv)
20 {
21 pid_t pid = fork();
22 switch (pid) {
23 case -1:
24 err(1, "fork");
25 case 0:
26 /* child */
27 execv(prog, argv);
28 err(1, "%s", prog);
29 default:
30 /* parent */
31 break;
32 }
33 }
34
35 int
36 main()
37 {
38 spawnv("/uw-testbin/xhog", xhargv);
39 spawnv("/uw-testbin/yhog", yhargv);
40 spawnv("/uw-testbin/zhog", zhargv);
41 return 0;
42 }