Skip to content

Latest commit

 

History

History

hw3-signals

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

extending rshell again

coding requirements

You will make three modifications to your rshell project.

  1. Implement the cd command. Every time this command is run, you must update the PWD and OLDPWD environment variables appropriately. This will require using the chdir,getenv, and setenv functions. Your implementation must support the following forms:

    a. cd <PATH> will change the current working directory to <PATH>

    b. cd will change the current working directory to the user's home directory

    c. cd - will change the current working directory to the previous working directory

  2. Change your prompt so that it displays the current working directory.

  3. The shell should not exit when the user types ^C. Instead, the current foreground job should receive the SIGINT signal. If SIGINT kills the job, then control should return to your shell.

submission instructions

You will add this code to your rshell project on github. You may use any number of branches/commits you find convenient. When finished, merge with the master branch and create a tag called hw3.

To download and grade your homework, the TA will run the following commands:

$ git clone  http://github.com/yourusername/rshell.git
$ cd rshell
$ git checkout hw3
$ make
$ bin/rshell

You should run them as well to verify that you've submitted your code successfully.

project structure

There are no changes to your project structure.

testing

Again, the tests you choose will be the most important part of your grade.

As with your previous assignments: Your tests directory will contain a file called signals.script that contains all of the test cases you tried. You will generate the file using the script command, and it must be succinct (i.e. it cannot have unnecessary commands in it). You should use comments in your script to document what you are testing with each test case.

collaboration policy

You MAY NOT look at the source code of any other student.

You MAY discuss with other students in general terms how to use the unix functions.

You are ENCOURAGED to talk with other students about test cases. You are allowed to freely share ideas in this regard.

You are ENCOURAGED to look at bash's source code for inspiration.

grading

20 points for implementing cd PATH

20 points for implementing cd

20 points for implementing cd -

40 points for handling the ^C signal

extra credit 1

Catch the ^Z signal, and implement the fg and bg commands. You can earn up to 30 points of extra credit for this.

extra credit 2

If the current working directory contains the user's homefolder, replace the home folder with a ~. For example, my home folder is /home/user. So if I'm in the directory /home/user/proj/ucr-cs100, then my prompt would display ~/proj/ucr-cs100. If the current working directory does not contain the user's homefolder, then display the directory normally.

You can earn 5 points of extra credit for this. It should be a very simple task.