NOTE: This assignment, like the other projects in this class, is due at a particular time, listed above. This means that if you are even a minute late, you lose 20%. If you are worried about potentially being late, turn in your project ahead of time. Do this by submitting it electronically before the due date (the electronic copy is what is due by the time given above) then giving the hard copy to me or the TA during office hours or by sliding it under my office door (the hard copy is due within twenty-four hours after the electronic copy is due). Do not send assignments to my personal email address or to the personal email address of the TA. Do not leave hard copies in my departmental mail box or attempt to give them to departmental staff (who cannot and will not accept them).
As discussed in class, POSIX systems are required to have a relatively simply access control system built in. This system includes the notions of users and groups; file ownership; and permissions for reading, writing, and executing. This system works well for many common file access needs. However, one place it encounters difficulty is with the password file. Each user should be able to change his or her own password but not other information in the file. For this reason, the idea of effective user IDs (EUIDs) was added.
As further discussed in class, EUIDs can be useful in other cases as well. For example, it would be quite helpful if you each could see your own scores in the grade file for this class but you should not be able to modify your scores or see the scores of other students. For this assignment, you will create a utility program capable of doing just that.
You are to create a program called gradelook
. When run,
gradelook
will first ask for the student ID number of the
user, then open a comma-separated value (csv) version of the grade file and
check to see if the student ID number given and the username of the current
user of gradelook
are found in the file and correspond to one
another. If this verification step fails, gradelook
should
give an appropriate error message. (You should explain, in your write up,
why you think any error message you are generating should be considered
appropriate.)
If the verification step succeeds, gradelook
should copy
parts of the grade file to a new csv file that the user may access. In
particular, gradelook
should copy the header lines (which are
the first four lines of the file), the line showing the user's own scores,
and the six trailer lines showing the aggregate score information
(maxmimum, minimum, median, mode, mean and standard deviation). Note,
however, that gradelook
should not copy the lines
showing the scores of other users nor the final lines of the file showing
the numbers of letter grades.
The general form of the call to gradelook
will be:
gradelook <classgradefile> <usergradefile>where
<classgradefile>
is the name of the existing grade
file containing entries for the whole class and
<usergradefile>
is the name of the grade file to be
created that contains entries only for the present user of
gradelook
.
If only one argument is given, it will be assumed to be
<classgradefile> and the output will be sent to standard out. If no
argument is given, gradelook
will look for a
<classgradefile> called called gradefile.csv
in the
current working directory and will write to standard out.
Note that for gradelook
to work properly, it will need to
be able to read a grade file owned by one user and write to a file owned by
another user (the one who runs gradelook
). Further, the
permissions of the grade file and the directory in which is resides must be
such that no user of the system, besides the owner of the grade file, can
read the gradefile without using gradelook
and no user of the
system, besides the owner of the grade file, can overwrite its
contents.
In order to verify that your code is working correctly within these
bounds, you should test it within your group. (For example, you may have a
sample grade file owned by one member of your group, with permissions set
so that no other member of your group can erase or alter it or read it
without using gradelook
, then have another member of your team
attempt to access it using gradelook
.)
As part of this project, you should specify in your write up which
directory or directories should contain the actual grade file for the class
and the official version of gradelook
that you will use to
access your scores. Note that there is an interesting twist here. We are
using a system with home directories mounted using the network file system
(NFS) so that they are available on all of the lab machines. By default
a directory for a given user is not mounted unless that user logs into the
computer in question. You will have to determine a reasonable way to
handle this, given the fact that I am unlikely to be logged into any
particular lab machine at any given time, yet you should be able to run
gradelook
from any given lab machine at any given time.
An example grade file in OpenOffice.org 1.0 spreadsheet format and csv format is available, to give you an idea of how the actual grade file should looks. To use it, you should add a line for yourself. Feel free to make up scores for yourself for this file.
You should not expect the csv files (either the original or the reduced version with just your scores) to be very understandable with a text editor or pager. Instead, you should be able to import it back into OpenOffice and view it that way.
You will turn in both a hard copy and an electronic copy of your assignment. Please follow the instructions on how to send electronic copies. Do not send them to my email address.
Both the hard copy and the electronic copy will contain a write-up plus
the source code for gradelook
. The electronic copy will also
contain the executable of gradelook
. The electronic copy of
your write-up should not be in a proprietary format (such as MS Word); it
should be either in plain ASCII text or in a portable format (such as
Postscript or PDF). Your source code for gradelook
should be
in a single file called gradelook.c
or
gradelook.cxx
and your executable code should be called
gradelook
.
Your source code should be well structured and well commented. It should conform to good coding standards (e.g., no memory leaks).
Your write-up will include 1/2 to 1 page (roughly 80 characters per line, 50 lines per page) explaining the data structures and algorithms used in your code. This page limitation does not include figures used in your explanations, which are encouraged and may take up any amount of space. (The explanations do not remove the requirement that your code be well commented.)
You may write your program from scratch or may start from programs for which the source code is freely available on the web or through other sources (such as friends or student organizations). If you do not start from scratch, you must give a complete and accurate accounting of where all of your code came from and indicate which parts are original or changed, and which you got from which other source. Failure to give credit where credit is due is academic fraud and will be dealt with accordingly.
As noted in the syllabus, you are required to work on this programming assignment in a group of at least two people. It is your responsibility to find other group members and work with them. The group should turn in only one (1) hard copy and one (1) electronic copy of the assignment. Both the electronic and hard copies should contain the names and student ID numbers of all group members. If your group composition changes during the course of working on this assignment (for example, a group of five splits into a group of two and a separate group of three), this must be clearly indicated in your write-up, including the names and student ID numbers of everyone involved and details of when the change occurred and who accomplished what before and after the change.
Each group member is required to contribute equally to each project, as far as is possible. You must thoroughly document which group members were involved in each part of the project. For example, if you have three functions in your program and one function was written by group member one, the second was written by group member two, and the third was written jointly and equally by group members three and four, both your write-up and the comments in your code must clearly indicate this division of labor.