summaryrefslogtreecommitdiff
path: root/mkstatval.c
diff options
context:
space:
mode:
Diffstat (limited to 'mkstatval.c')
-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;
+}