diff options
| author | tjg <tjg> | 2002-06-20 15:29:07 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:22 +0100 |
| commit | 604e3fa3c170ab78dc15c6ffded55fbc6ed4a041 (patch) | |
| tree | b0a3909ff0581ed561ec0c15d0a6dc567df1a48e | |
| parent | 0d95155a112f968589ec737e9248ed171a002f1c (diff) | |
Initial revision
| -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; +} |