Adjusted a little bit of syntax (personal)
This commit is contained in:
parent
702b77073f
commit
94f2c4fcb8
@ -123,7 +123,7 @@ void ioRedirection(CommandStruct *command)
|
||||
|
||||
void output(char *command){
|
||||
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)
|
||||
{
|
||||
perror(command);
|
||||
exit(1);
|
||||
@ -134,7 +134,7 @@ void output(char *command){
|
||||
void input(char *command)
|
||||
{
|
||||
int newfd;
|
||||
if(newfd = open(command, O_RDONLY)<0)
|
||||
if (newfd = open(command, O_RDONLY) < 0)
|
||||
{
|
||||
perror(command);
|
||||
exit(1);
|
||||
@ -150,57 +150,56 @@ void ExecPipe()
|
||||
void append(char *input, char *file)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(file, "a+");
|
||||
|
||||
fputs(input, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
// check command standard input
|
||||
// if (strchr(inputString, '<') != NULL)
|
||||
// {
|
||||
// newfd = open((command, O_CREAT |O_TRUNC | O_WRONLY, 0644)) < 0);
|
||||
// // No if statement for fail checking, brackets just exist here
|
||||
// {
|
||||
// // failed
|
||||
// perror(command);
|
||||
// exit(1);
|
||||
// }
|
||||
// dup2(newfd, 0);
|
||||
// }
|
||||
|
||||
// check pipe
|
||||
// TODO: Check for pipe symbol
|
||||
// Check in command->argv[] instead
|
||||
// if (strchr(command, '|') != NULL)
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
// check append
|
||||
// TODO: Implement append
|
||||
// if (strpbrk(command, ">>") != NULL)
|
||||
// {
|
||||
// newfd = open((command, O_CREAT |O_TRUNC | O_WRONLY, 0644)) < 0);
|
||||
// // No if statement for fail checking, brackets just exist here
|
||||
// {
|
||||
// // failed
|
||||
// perror(command);
|
||||
// exit(1);
|
||||
// }
|
||||
// dup2(newfd, 0);
|
||||
// }
|
||||
// check pipe
|
||||
// TODO: Check pipe already exists above, maybe loop?
|
||||
// if (strchr(command, '|') != NULL)
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
// check append
|
||||
// TODO: Check append already exists above, maybe loop?
|
||||
// if (strpbrk(command, ">>") != NULL)
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
// check command standard input
|
||||
// if (strchr(inputString, '<') != NULL)
|
||||
// {
|
||||
// newfd = open((command, O_CREAT |O_TRUNC | O_WRONLY, 0644)) < 0);
|
||||
// // No if statement for fail checking, brackets just exist here
|
||||
// {
|
||||
// // failed
|
||||
// perror(command);
|
||||
// exit(1);
|
||||
// }
|
||||
// dup2(newfd, 0);
|
||||
// }
|
||||
|
||||
// check pipe
|
||||
// TODO: Check for pipe symbol
|
||||
// Check in command->argv[] instead
|
||||
// if (strchr(command, '|') != NULL)
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
// check append
|
||||
// TODO: Implement append
|
||||
// if (strpbrk(command, ">>") != NULL)
|
||||
// {
|
||||
// newfd = open((command, O_CREAT |O_TRUNC | O_WRONLY, 0644)) < 0);
|
||||
// // No if statement for fail checking, brackets just exist here
|
||||
// {
|
||||
// // failed
|
||||
// perror(command);
|
||||
// exit(1);
|
||||
// }
|
||||
// dup2(newfd, 0);
|
||||
// }
|
||||
// check pipe
|
||||
// TODO: Check pipe already exists above, maybe loop?
|
||||
// if (strchr(command, '|') != NULL)
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
// check append
|
||||
// TODO: Check append already exists above, maybe loop?
|
||||
// if (strpbrk(command, ">>") != NULL)
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
|
||||
// Environment varibles
|
||||
// TODO: Add this function to CommandStruct
|
||||
|
Loading…
Reference in New Issue
Block a user