Due Date: Monday, November 30, 1998
Total Points: 250
access options user file
Here, user is either a user's login name or UID, file is a file (or directory, or other entity), and options is any combination of r (for read), w (for write), and x (for execute), with a leading -. If none of r, w, or x is given, act as though all three had been given. Your output should say:
user can read fileor
user can read and write fileand so forth. If the option l is given, then every component of the path is to be checked as well as the file itself.
If the file cannot be accessed, any command line argument is malformed, or an error occurs in your code, print an appropriate error message and exit with an exit code of 1. Otherwise, exit with an error code of 0. Please write your code robustly, and comment it!
Example. The output of
access -rwx bishop /home/cs153/public_htmlshould be
bishop can read and execute /home/cs153/public_htmlThe output of
access -l bishop /home/cs153/public_html/index.htmlshould be
bishop can read and execute / bishop can read and execute /home bishop can read and execute /home/cs153 bishop can read and execute /home/cs153/public_html bishop can read /home/cs153/public_html/index.html
Submitting your programs. If you write your programs in a compilable language (like C), you must submit a makefile to compile your source code. A single make should generate the access executable. Do not submit access executables unless it is written in a scripted language (such as shell script or Perl). Your program should run correctly on any of the CSIF machines (that is, on the DECs, the HPs, and the SGIs).
Department of Computer Science
University of California at Davis
Davis, CA 95616-8562