summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/examples/Makefile3
-rw-r--r--src/examples/wait.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/src/examples/Makefile b/src/examples/Makefile
index 13c09fc..515bb74 100644
--- a/src/examples/Makefile
+++ b/src/examples/Makefile
@@ -8,7 +8,7 @@ PROGS = cat cmp cp echo halt hex-dump ls mcat mcp mkdir pwd rm shell \
sumargv lab2test lab1test lab1test2 pfs pfs_reader pfs_writer dummy longrun \
child parent create-bad printf
-PROGS += create read lab3test1 lab4test1 lab3test2 args
+PROGS += create read lab3test1 lab4test1 lab3test2 args wait
create_SRC = create.c
read_SRC = read.c
@@ -16,6 +16,7 @@ lab3test1_SRC = lab3test1.c
lab4test1_SRC = lab4test1.c
lab3test2_SRC = lab3test2.c
args_SRC = args.c
+wait_SRC = wait.c
# Added test programs
printf_SRC = printf.c
diff --git a/src/examples/wait.c b/src/examples/wait.c
new file mode 100644
index 0000000..ab0ea90
--- /dev/null
+++ b/src/examples/wait.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <syscall.h>
+
+int
+main (int argc, char **argv)
+{
+ printf ("hello\n");
+ if (argc != 1) {
+ int child = exec("wait");
+ printf("%d: %d\n", child, wait(child));
+ }
+ exit(1);
+}