Fixed compilation errors

This commit is contained in:
TriantaTV 2022-10-27 23:11:40 -05:00
parent f87379c9da
commit 702b77073f
2 changed files with 15 additions and 5 deletions

View File

@ -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);

View File

@ -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