CS 3733 Operating Systems, Spring 1999 Assignment 4 Comments


Warning: This is not for the current semester.


Assignment 4 notes: Spring 1999

The following notes refer to Part 4.

  1. The function header_filter should be in its own file because the assignment said it should. This is good programming technique and makes it easy to tell if inappropriate global variables are being used.
  2. All non-temporary data used by header_filter must be stored in the info buffer.
    You cannot use static variables as header_filter is being called to handle two different data streams.
  3. You probably need to reserve at least 5 bytes in info. Four bytes will represent an integer giving the number of bytes stored in info which have not yet been output.
    One byte can be used as a flag to indicate whether you are still processing a line which contained non-printing characters or was too long.
  4. You need to think about how to handle the initialization of info. One way is to assume that the first byte is initialized to 0. This can be a flag indicating initialization.
  5. You should also test for the case of more than one line being sent in an single call to header_filter.
  6. It is difficult to test the case of a line being broken up between different calls to header_filter.
    Recall that if you do
    cat < pipe1
    normally, nothing will go into the pipe until you push RETURN so only full lines go into the pipe.
    You can put less than a full line in the pipe by entering a CTRL-D after entering some characters.
    A CTRL-D at the start of an input line will be interpreted as an end-of file.
  7. What does the following do?