CS 3733 Operating Systems, Spring 2003 Assignment 0 Comments
This assignment was graded on a basis of 20 points.
Everyone who sent me email for this assignment got at least 10 points.
Between 0 and 10 points was assigned for the readline function.
Most grades for readline were 0, 5 or 10.
General comments about readline appear below.
If you send me eamil for assignment 0, you should have received an email
from me in the morning on January 27. This email should contain a statement
indicating which of the readline implementations in the following link is yours.
If you sent me two copies, the one with the higher grade is the one that
counts.
Click here for comments on
individual implementations of readline.
It is clear that most people did not test the readline that was sent to me
by email. The assignment stated that you were to debug the function as well
as you could. You should have written a main program that called readline
and tested it with as many possibilities as you could think of. Here are the
major ones:
- an empty line (no characters before the end of file)
- a simple line (shorter than nbytes and ending with a newline)
- a line much too long (more than nbytes before the newline)
- no newline: an end of file long before nbytes
- lines with a newline near the boundary of nbytes. In each case
calculate the return value before doing the test and then compare
the results.
- nbytes-3 characters before the newline
- nbytes-2 characters before the newline
- nbytes-1 characters before the newline
- nbytes characters before the newline
- nbytes+1 characters before the newline
- nbytes+2 characters before the newline
In each case you should check that the return value is correct, and if the
return value is greater than 0, then the characters put in buf should be
checked to see that they are correct.
- Very few students attempted to run their code.
- getc, ferror, feof are for FILE pointers, not file descriptors.
- Do not exit from a function, especially if it is not part of the specification.
- Do not do any other I/O in readline. No perror or printf.
- Do not use C++ comment syntax.
- Consider using buf+i for &buf[i].
- Be careful not to return a value one too small or one too large.
- Must read one bytes at a time.
- Be careful not to return 0 on end of file if some bytes have been read.
- Do not use the constant EOF with file descriptor I/O.
- There is no end-of-file character in Unix.
- Do not use more than 3 spaces for indentation.
- Be careful about how you use indentation. Pick a standard and use it
consistently.