added input redirection
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include<readline/readline.h>
|
||||
#include<readline/history.h>
|
||||
#include<signal.h>
|
||||
#include"include/redirection.h"
|
||||
pid_t backgroundPids[64];
|
||||
int backgroundCount = 0;
|
||||
void handleSIGINT(int sig) {
|
||||
@@ -112,6 +113,14 @@ int main() {
|
||||
free(parsed);
|
||||
continue;
|
||||
}
|
||||
char *filename;
|
||||
int redirectionType = detectRedirect(parsed, &filename);
|
||||
if (redirectionType) {
|
||||
executeRedirect(parsed, redirectionType, filename);
|
||||
free(parsed);
|
||||
free(line);
|
||||
continue;
|
||||
}
|
||||
pid_t pid = fork();
|
||||
if(pid == 0) {
|
||||
signal(SIGINT, SIG_DFL);
|
||||
|
||||
Reference in New Issue
Block a user