Fixed compilation errors
This commit is contained in:
parent
f87379c9da
commit
702b77073f
@ -4,9 +4,13 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
const char* GetHomeDir(void);
|
const char* GetHomeDir(void);
|
||||||
void ioRedirection(char *inputString, CommandStruct *command);
|
void ioRedirection(CommandStruct *command);
|
||||||
void IntegratedCheck(CommandStruct* command);
|
void IntegratedCheck(CommandStruct* command);
|
||||||
void GetInput(char* inputString);
|
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 ParseInput(char* inputString, CommandStruct* command);
|
||||||
void ReadPishrc(CommandStruct* command, char* inputString);
|
void ReadPishrc(CommandStruct* command, char* inputString);
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void ioRedirection(CommandStruct *command)
|
|||||||
}
|
}
|
||||||
if (strchr(command->argv[i], '<') != NULL)
|
if (strchr(command->argv[i], '<') != NULL)
|
||||||
{
|
{
|
||||||
input(command->[i+1]);
|
input(command->argv[i+1]);
|
||||||
}
|
}
|
||||||
if (strchr(command->argv[i], '|')!= NULL)
|
if (strchr(command->argv[i], '|')!= NULL)
|
||||||
{
|
{
|
||||||
@ -120,6 +120,7 @@ void ioRedirection(CommandStruct *command)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void output(char *command){
|
void output(char *command){
|
||||||
int newfd;
|
int newfd;
|
||||||
if(newfd = open(command, O_CREAT | O_TRUNC | O_WRONLY, 0644)< 0)
|
if(newfd = open(command, O_CREAT | O_TRUNC | O_WRONLY, 0644)< 0)
|
||||||
@ -129,6 +130,7 @@ void output(char *command){
|
|||||||
}
|
}
|
||||||
dup2(newfd,1);
|
dup2(newfd,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void input(char *command)
|
void input(char *command)
|
||||||
{
|
{
|
||||||
int newfd;
|
int newfd;
|
||||||
@ -139,14 +141,19 @@ void input(char *command)
|
|||||||
}
|
}
|
||||||
dup2(newfd,0);
|
dup2(newfd,0);
|
||||||
}
|
}
|
||||||
void pipe(){}
|
|
||||||
|
void ExecPipe()
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
void append(char *input, char *file)
|
void append(char *input, char *file)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
fp = fopen(file, "a+");
|
fp = fopen(file, "a+");
|
||||||
|
|
||||||
fputs(input);
|
fputs(input, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
// check command standard input
|
// check command standard input
|
||||||
@ -194,7 +201,6 @@ void append(char *input, char *file)
|
|||||||
// {
|
// {
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
// Environment varibles
|
// Environment varibles
|
||||||
// TODO: Add this function to CommandStruct
|
// TODO: Add this function to CommandStruct
|
||||||
|
Loading…
Reference in New Issue
Block a user