Assignment 4

Due Date: Midnight April 15

Send a tar file of your clean project directory to me at my Dijkstra account by midnight of the due date. Be sure to put your name and ID number in the body of your email message, and use "Submitting Assignment 4" as the subject line of your message.


Requirements

The assignment is to implement a rudimentary shell with the following features:

The shell is to use the string "jsh> " as its prompt string. The space after the > is important.

The shell is not to implement any of the following features: I/O redirection, quoting of any sort; variable definition or expansion except for the two shell variables named above; alias definition or substitution; pattern matching; pipelines or other syntax allowing multiple commands per line; background command processing.

The main() function must be defined in a file named main.cc. Functions implementing built-in commands must be defined in a file named builtins.cc. There must be a header file named jshell.h containing function prototypes, typedefs, etc. that are shared among the .cc files. There must be a Makefile which includes the normal phony targets for "clean" and "depend" as well as a default target named "jsh" which builds the executable program. You may use additional source files for the project if you wish, but the files named here must be present, and must have the names given.

Testing

Be sure to test all the project management features of your program. Be sure the clean, depend, and jsh targets all work correctly. Be sure no files are recompiled unnecessarily. Be sure all three targets operate correctly from a clean project directory as well as from a project directory in which various combinations of source files are checked out with or without locks. There is no need for multiple versions of any of the files in this directory; they may all have revision number 1.1 when checked in, although it is okay to have multiple revisions in the 1.1 to 1.999 range of any files, provided each revision has a proper log message associated with it.

The echo command lets you check your implementation of the $ and ? shell variables. For example, typing the command "grep fribbitz main.cc" should produce an exit code of 1, so if the next command entered is "echo The exit code was $?" the output should be "The exit code was 1".

You can use the pwd command to check that the cd command executed correctly.

Assuming "$ " is your bash prompt, you should be able to reproduce the following dialog. (User input is normal weight and computer output is boldface for clarity.)

      jsh
      jsh> exit 77
      The jsh exit code was $?
      The jsh exit code was 77