Skip to content
Snippets Groups Projects
Commit 7b8045e4 authored by Park SungHo's avatar Park SungHo
Browse files

Update 180507

parent 98fbc382
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,9 @@
#include <string.h>
#include <assert.h>
#include <wait.h>
#include <unistd.h>
#include "commands.h"
#include "built_in.h"
......@@ -49,6 +52,19 @@ int evaluate_command(int n_commands, struct single_command (*commands)[512])
return 0;
} else if (strcmp(com->argv[0], "exit") == 0) {
return 1;
} else if (strcmp(com->argv[0], com->argv)) { //compare input command = argv
int pid = fork(); //create child
int *parentStatus;
if (pid < 0) { //failed process
fprintf(stderr,"Failed create process\n");
}
else if (pid == 0) {
fprintf(stderr,"Execv doesn't execute\n");
}
else {
wait(parentStatus);
}
} else {
fprintf(stderr, "%s: command not found\n", com->argv[0]);
return -1;
......
#include <stdio.h>
#include <signal.h>
#include "signal_handlers.h"
void catch_sigint(int signalNo)
{
printf("you input Ctrl + C\n");
signal(signalNo,SIG_IGN);
// TODO: File this!
}
void catch_sigtstp(int signalNo)
{
printf("you input Ctrl + Z\n");
signal(signalNo,SIG_IGN);
// TODO: File this!
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment