From 702b77073fc3001238e2ad62ea2253d42f76c61e Mon Sep 17 00:00:00 2001 From: TriantaTV Date: Thu, 27 Oct 2022 23:11:40 -0500 Subject: [PATCH] Fixed compilation errors --- include/Integrated.h | 6 +++++- src/Integrated.c | 14 ++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/Integrated.h b/include/Integrated.h index 9a0f05a..1b91336 100755 --- a/include/Integrated.h +++ b/include/Integrated.h @@ -4,9 +4,13 @@ #include "Common.h" const char* GetHomeDir(void); -void ioRedirection(char *inputString, CommandStruct *command); +void ioRedirection(CommandStruct *command); void IntegratedCheck(CommandStruct* command); void GetInput(char* inputString); +void append(char *input, char *file); +void input(char *command); +void ExecPipe(); +void output(char *command); void ParseInput(char* inputString, CommandStruct* command); void ReadPishrc(CommandStruct* command, char* inputString); diff --git a/src/Integrated.c b/src/Integrated.c index d1a2ef0..3c14943 100755 --- a/src/Integrated.c +++ b/src/Integrated.c @@ -107,7 +107,7 @@ void ioRedirection(CommandStruct *command) } if (strchr(command->argv[i], '<') != NULL) { - input(command->[i+1]); + input(command->argv[i+1]); } if (strchr(command->argv[i], '|')!= NULL) { @@ -120,6 +120,7 @@ void ioRedirection(CommandStruct *command) } } } + void output(char *command){ int newfd; if(newfd = open(command, O_CREAT | O_TRUNC | O_WRONLY, 0644)< 0) @@ -129,6 +130,7 @@ void output(char *command){ } dup2(newfd,1); } + void input(char *command) { int newfd; @@ -139,14 +141,19 @@ void input(char *command) } dup2(newfd,0); } -void pipe(){} + +void ExecPipe() +{ + ; +} + void append(char *input, char *file) { FILE *fp; fp = fopen(file, "a+"); - fputs(input); + fputs(input, fp); fclose(fp); } // check command standard input @@ -194,7 +201,6 @@ void append(char *input, char *file) // { // ; // } -} // Environment varibles // TODO: Add this function to CommandStruct