Question: Test 1 : 1 . desc - Input to check bad cd . No arguments are passed to cd . 1 . err - An

Test 1:
1.desc - Input to check bad cd. No arguments are passed to cd.
1.err - An error has occurred
1.in - cd
exit
1.out -
Test 2:
2.desc -2 arguments are passed to cd.
2.err - An error has occurred
2.in - cd /bad1/bad2
exit
2.out -
Test 3:
3.desc - Is with a bad directory name.
3.err -Is: /no/such/file: No such file or directory
3.in - Is /no/such/file
exit
3.out -
Test 4:
4.desc - Input to run misc. commands.
4.err -
4.in - cd tests/p2a-test
4 out-test 1 is
test1 test2
test3
test4
void process_command(const char "command, int line_number){
printf("line%d: %sin", line_number, command);
void interactive_mode(){
char command[MAX_COMMAND_LENGTH];
int line_number =1;
while (1) f
printf("wish>");
if (fgets(command, MAX_COMMAND_LENGTH, stdin)== NULL){
break; // Exit loop on EOF
}
process_command(command, line_number++);
}
void batch_mode(FILE *file){
char command[MAX_COMMAND_LENGTH];
int line_number =1;
while (fgets(command, MAX_COMMAND_LENGTH, file)!= NULL)(
process_command(command, line_number++);
}
common.h:
void process_command(const char *command, int line_number);
void interactive_mode():
void batch_mode(FILE *file);
Test 5:
5.desc - Tries to exit with an argument. Should throw an error.
5.err - An error has occurred
5.in - exit bad
exit
5.out -
Test 6:
6.desc - Try running a shell script without setting path.
6.err - An error has occurred
6.in -
p1.sh
exit
6.out -
Test 7:
7.desc - Set path, run a shell script. Overwrite path and then try running the script again.
7.err - An error has occurred
An error has occurred
7.in - path tests
p1.sh
path
p1.sh
Is
exit
7.out - test1
test2
test3
Prompt:
using the provided code and test files, improve the code to pass these testing files.
Be sure that /bin/ls should come from a search from paths, and should not be hard coded. The same with the testing folder as well. Make sure to use execv() and not execvp().
 Test 1: 1.desc - Input to check bad cd. No arguments

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!