From 604e3fa3c170ab78dc15c6ffded55fbc6ed4a041 Mon Sep 17 00:00:00 2001 From: tjg Date: Thu, 20 Jun 2002 15:29:07 +0000 Subject: Initial revision --- mkstatval.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 mkstatval.c (limited to 'mkstatval.c') 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 +#include +#include +#include + +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; +} -- cgit v1.2.3