Committing again because push did not go through
This commit is contained in:
parent
25cd3f8929
commit
9f28625f1a
@ -89,3 +89,65 @@ void ReadPishrc(CommandStruct* command, char* inputString)
|
||||
}
|
||||
assert(close(fd) >= 0);
|
||||
}
|
||||
// i/o redirection
|
||||
void ioRedirection(char* inputString, CommandStruct* command)
|
||||
{
|
||||
int newfd;
|
||||
// check command standard output
|
||||
if (strchr(inputString, '>' )!= NULL)
|
||||
{
|
||||
|
||||
newfd = open((command, O_CREAT |O_TRUNC | O_WRONLY, 0644)) <0) {
|
||||
//failed
|
||||
perror(command);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// copies the new file descriptor
|
||||
dup2(newfd,1);
|
||||
}//this is supposed to close if statement??
|
||||
|
||||
// check command standard input
|
||||
if(strchr(inputString, '<') != NULL)
|
||||
{
|
||||
newfd = open((command, O_CREAT |O_TRUNC | O_WRONLY, 0644)) <0) {
|
||||
//failed
|
||||
perror(command);
|
||||
exit(1);
|
||||
}
|
||||
dup2(newfd,0);
|
||||
}
|
||||
|
||||
//check pipe
|
||||
if(strchr(command, '|') != NULL)
|
||||
{
|
||||
|
||||
}
|
||||
//check append
|
||||
if (strpbrk(command, ">>") != NULL)
|
||||
newfd = open((command, O_CREAT |O_TRUNC | O_WRONLY, 0644)) <0) {
|
||||
//failed
|
||||
perror(command);
|
||||
exit(1);
|
||||
}
|
||||
dup2(newfd,0);
|
||||
}
|
||||
|
||||
//check pipe
|
||||
if(strchr(command, '|') != NULL)
|
||||
{
|
||||
|
||||
}
|
||||
//check append
|
||||
if (strpbrk(command, ">>") != NULL)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
//Environment varibles
|
||||
void varibles(char str, int count)
|
||||
{
|
||||
char var[1000];
|
||||
var[count]= str;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user