Homework 2

Points: 100
Due Date: Monday, October 25, 1999 at 11:59PM

  1. (16 points) Chapter 20, exercise 1
  2. (16 points) Chapter 20, exercise 2
  3. (10 points) Chapter 20, exercise 9
  4. (10 points) Chapter 2, exercise 2
  5. (10 points) Chapter 2, exercise 3
  6. (38 points) Write a program called where that takes one or more command names as an argument. On output, it prints the full path names of all programs with the command name in the user's path. Output should look like:
    	dec24 % where mail sh
    	mail: /usr/bin/mail* /usr/ucb/mail* /var/spool/mail
    	sh: /bin/sh@ -> /sbin/sh*
    If the user could execute a listed program, put a "*" after it (as above). If any of the files are symbolic links, put "@ -> " followed by what it refers to. Please use this format exactly; we will use an automated script for grading, and you will lose points if you don't! Also, you must use C or C++ for this program. (Hint: You do not need to worry about aliases.)

Extra Credit

  1. (20 points) Chapter 2, exercise 7
  2. (15 points) Modify your program in problem 6 to handle C shell aliases.
  3. (15 points) Modify your program in problem 6 to handle Korn shell aliases.

Send email to cs153@csif.cs.ucdavis.edu.

Department of Computer Science
University of California at Davis
Davis, CA 95616-8562

Page last modified on 10/22/99