Roger L. Kraft

59000-01 - Programming Assignment 6

In this assignment you will complete the code for a "prompting shell" that does pipelines. Please download this zip file. Be sure to review the homework grading criteria. This assignment is due Thursday, May 7.

In the zip file there is a file psh6.c that you need to complete. This is a "prompting shell" like the shell examples in Chapter 8. This prompting shell is supposed to implement a pipeline of the form

   $ cmd1 arg1 ... argn < source_file | cmd2 arg1 ... argm > dest_file

The prompting shell will first ask the user for the name of a source file. Then for the name of the first command, followed by the command's argument list (a blank line or CTRL-D ends the command's argument list). Then the shell prompts for the name of the second command followed by its arguments. Lastly, the shell prompts the user for the name of a destination file. After all of this has been input to the shell, the shell should use fork(), exec(), wait(), pipe(), dup(), and I/O redirection to set up and execute the pipeline.

In the psh6.c file is all the code that does the prompting. You need to implement the execute() function (at the end of the file) that sets up and executes the pipeline using all the information passed into the function.

In the zip file is a sample "script" file, psh6_script. You can run the script file using the command

   $ ./psh6 < psh6_script

This script file implements the same commands as the bash script file bash_script. Running the bash script

   $ bash < bash_script

should produce the same results as running the psh6 script.

Turn in a zip file called CS59000Hw6Surname.zip (where Surname is your last name) containing your completed psh6.c, a Makefile that compiles your program, and any "script" files that you want to include.

This assignment is due Thursday, May 7.