Warning: This is not for the current semester.
General Statement of the Problem:
Characters will be coming in to your program 1 at a time.
You are to gather up full lines and when you get a full line,
parse and output the line. The format of the input will be similar
to the input accepted by a web server.
Details:
Legal input will consist of sequences of characters which either make
up short lines of printing characters or binary data.
Binary data will only come in after a line in the form
    Content-Length: 12345
followed by an arbitrary number of lines of printing characters.
The binary data will start after a blank line
(a line containing only 0 or more blanks)
and the number of bytes will be given by the number on the
Content-Length line.
Create a file myparser.c which contains only one identifier with
external linkage, myparser.
This will be a function with the following prototype:
    void myparser(char x);
You may put additional functions in this file, but they need to
have internal linkage (static). You may use global variables, but these
also must have internal linkage.
As myparser is called it will save up its characters
in a string until an end of line is found.
If a short line of printing characters is found,
that line will be sent to standard output.
If binary data is received it should output a message in the form:
Error checking:
Testing:
You should make up test data for your program. You can start by using input
from the keyboard. Remember that your program does not receive anything you
type until you hit the RETURN key. You should also test the program
by creating input files. You can use cat to combine a file containing
non-printing characters (such as a GIF image) to a file created with
an editor. Make sure you test for all possible error conditions including
long lines and non-printing characters occurring when they are not allowed.
Turning in the assignment:
Notes:
    receiving n bytes of binary data
    binary data complete
when it receives the last byte of binary data.
The first time myparser is called, it should print out a line in the form:
    This version of myparser was written by xxx
There are two types of errors that can occur:
In either of these cases, an appropriate warning message should be sent to
standard error and all future input should be ignored.
In a separate file called mytester.c,
write a main program which reads
characters from standard input and sends them to myparser.
It should terminate when it receives and EOF.
Use the cover sheet available in
/usr/local/courses/cs3733/fall1999/cover1.ps
or just click here.
This sheet lists what needs to be turned in.
You will need to include a complete description of how you tested the program
including how you tested for the handling of errors.
This description should be typed, rather than hand written.
    function returns value which is always ignored
    which cc
and the result should contain SUNWspro/bin/cc.
Similarly,
    which lint
should produce output which contains SUNWspro/bin/lint.
If this is not the case you need to modify your path. Execute
    utsa path
for more information about how your path is set up.