Assignment 1, CS-701, Spring 1997

File Utility Program

Due Date:
February 27, 1997
Deliverables:
When the assignment is complete, send me an email message telling me the path to the project directory. The project directory is to contain an RCS subdirectory, and nothing else. Consult "Using RCS" for information on how to set up your project directory and use RCS for project management. In addition, the ~/man directory tree is to contain a man page for the executable program. See "How to Write a Man Page" for information on how to prepare your man page.

You may also leave a README file in the project directory if you think that one is needed, but I neither expect nor require you to do so.

Requirements:
In addition to the information given here, be sure to consult the Grading Form for this assignment, which includes additional information about the requirements for this project.

Project Description

You are to write a utility program that can be used to find out information about files on a UNIX system. In class I called the program debe in honor of an old utility program I used when I first started using computers (its name stood for "does everything but eat"!), but you may give your program any meaningful name you like. You should follow the UNIX convention of naming your program with a terse mnemonic for what the program does.

The program accepts a set of command line arguments, and produces informative messages based on the arguments given. Arguments may be given in any order, and may be repeated any number of times. They are to operate as follows:

-t
The next argument is an entity name, and the program tells the type of entity it names, whether it is a regular file, a directory, a special file, etc. Use the information returned by stat() to determine the type. If the call to stat() fails, give an informative message, but do not abort the program. (This rule holds for all error conditions your program encounters.)

Optional: If the entity is a regular file, tell whether it is a text file or a binary file.

-i
The next argument is an entity name, and the program tells everything it can about that entity.

-s
The next argument is an entity name. If the -s argument has already appeared, tell whether this entity is the same one as the previous one or not.

-c
The next argument is an entity name. If the -c argument has already appeared and both entities are regular files, tell whether the files contain exactly the same information or not.

Write your program so that command line arguments can be entered in any sequence and any number of times. The program must not terminate until all command line arguments have been processed, regardless of what the user types on the command line. Do not write the program so that it interacts with the user.

You may add other "interesting" options to your program. If you do, be sure to document them in your man page.

It is all right to write the program as a single source module. Modify your Makefile so that the make command will build your program as its default target.



Christopher Vickery
Queens College of CUNY