homework 3 i think

This commit is contained in:
shockrah 2019-09-17 00:25:55 -07:00
parent 61cd0af471
commit 374022ee7a

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <time.h>
#include <sys/types.h>
@ -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);
}
}
else {
execvp(tokens[0], tokens);
}
// Cleanup pointers
for(int i = 0; i< 64; i++) {
tokens[i] = NULL;