diff options
| author | Toby Goodwin <tjg@star.le.ac.uk> | 2002-06-19 16:12:04 +0100 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:22:10 +0100 |
| commit | 77b18786228a8cf9f58aee09677440c61dc218a9 (patch) | |
| tree | 0497e7cecadb1a25fc607a92eec9f9cdf0b43fce /mkstatval.c | |
| parent | 2e67f638ea031ce0138891b6356806b463f5e9af (diff) | |
release: rc-1.7
Diffstat (limited to 'mkstatval.c')
| -rw-r--r-- | mkstatval.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mkstatval.c b/mkstatval.c new file mode 100644 index 0000000..c74ac46 --- /dev/null +++ b/mkstatval.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <unistd.h> + +int main(void) { + int cstatus, pstatus; + pid_t pid; + + for (cstatus = 0; cstatus < 2; ++cstatus) { + switch (pid = fork()) { + case -1: + perror("fork"); + return 1; + case 0: + _exit(cstatus); + default: + if (wait(&pstatus) != pid) { + perror("wait"); + return 1; + } + printf("#define STATUS%d %d\n", cstatus, pstatus); + } + } + return 0; +} |