Implement question 6
[TD_IML.git] / TD1 / part_one / exo.c
similarity index 65%
rename from TD1/exo.c
rename to TD1/part_one/exo.c
index 237c2d6c29086f2a0c1e9ae5d8c588629cb6b342..3eeb4c4bfd73d62519f672161db66df9463b8fc0 100644 (file)
--- a/TD1/exo.c
@@ -32,6 +32,15 @@ int main() {
         show_proc_pids();
         pid_t rtw = wait(&status);
         system("ps aux");
+        if (WIFEXITED(status)) {
+            printf("Fils termine, status=%d\n", WEXITSTATUS(status));
+        } else if (WIFSIGNALED(status)) {
+            printf("Fils tue par un signal %d\n", WTERMSIG(status));
+        } else if (WIFSTOPPED(status)) {
+            printf("Fils stoppe par un signal %d\n", WSTOPSIG(status));
+        } else if (WIFCONTINUED(status)) {
+            printf("Fils continue\n");
+        }
     }
     
     return EXIT_SUCCESS;