Project 2 -- fork, exec, and wait

Due Tuesday, October 16

(Note that due date is later than originally listed in the class schedule.)

NOTE: This assignment, like the other projects in this class, is due at the beginning of the class period. This means that if you are even a minute late, you lose 20%. If you are worried about potentially being late, turn in your homework ahead of time. Do this by submitting them electronically then giving the hard copy to me or the TA during office hours or by sliding it under my office door within twenty-four hours after the time it is due. Do not send assignments to me through email or leave them in my departmental mail box.

As discussed in class, part of the UNIX program design philosophy is not to create each application from scratch but, rather, to build new applications by utilizing existing programs. One way to tie these programs together is to spawn off child processes using fork and run the programs using exec.

One new application people might find useful, or at least fun, is a picture sharing application. We'll call this application PicShare.

PicShare will have the following basic functions:



The Assignment

For this assignment, we'll implement a simple version of PicShare. In this version, PicShare will be restricted to running on a single machine. A better version would allow users to share pictures over the Internet. Also, in this version users will have to check back periodically to see if new pictures have been made available, whereas in a better version they could be notified automatically. These other features could be added to a future version of PicShare, as you learn more about POSIX.

To implement the functions listed above, your program will present the user with a simple prompt (the main menu):

    Press:
        C   to Create a new picture.
        E   to Edit an existing picture.
        P   to Place the picture for viewing.
        V   to View pictures in the viewing area.
        Q   to Quit.
    Then hit Enter.

PicShare will use files in two directories. One of these will be the /tmp directory (see Place and View, below). The other will the user's picture directory. This will be specified by the user's environment variable PIC_DIR or, if that isn't set, will be PicDir in the user's home directory. If no directory is mentioned in the description below, the user's picture directory is assumed.