added input redirection

This commit is contained in:
2026-05-12 17:32:57 +02:00
parent a9d4503bfe
commit 2cc7df8581
4 changed files with 100 additions and 2 deletions
+9
View File
@@ -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);