Fixed compilation errors
This commit is contained in:
+10
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user