diff --git a/334/homework/3/msh.c b/334/homework/3/msh.c index 6ad650d..73e6511 100644 --- a/334/homework/3/msh.c +++ b/334/homework/3/msh.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -93,13 +94,15 @@ int builtin_response(char* buffer) { // Execute child process pid_t child = fork(); - if(child) { + if(child != 0) { int status_child = wait(NULL); if(status_child == 127) { - echo("command not found: oh btw remember to not print this string kek"); + printf("msh: %s: %d", tokens[0], status_child); } } - execvp(tokens[0], tokens); + else { + execvp(tokens[0], tokens); + } // Cleanup pointers for(int i = 0; i< 64; i++) { tokens[i] = NULL;