Commit 06b6dcfd authored by Zara Saldanha's avatar Zara Saldanha

Update ishell.c

parent f111eae1
......@@ -70,6 +70,14 @@ void split(char *input) {
exec(shell_path,argv);
}
int compare(char* argv[]) {
if(strcmp(argv[1],argv[2])==0){
return 1;
} else {
return 0;
}
}
int main(){
char input[BUFFER];
char* argv[150];
......@@ -133,6 +141,16 @@ int main(){
printf("%s\n", argv[i]);
}
//compare two strings (problem 5)
if(strcmp(argv[0], "compare\n")==0){
if(compare(argv)==1){
printf("Both strings are the same!\n");
} else {
printf("The strings are different!\n");
}
}
strcpy(shell_path, path);
strcat(shell_path, argv[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment