summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortjg <tjg>2002-06-20 15:29:07 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:22 +0100
commit604e3fa3c170ab78dc15c6ffded55fbc6ed4a041 (patch)
treeb0a3909ff0581ed561ec0c15d0a6dc567df1a48e
parent0d95155a112f968589ec737e9248ed171a002f1c (diff)
Initial revision
-rw-r--r--mkstatval.c26
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;
+}