The UNIX utility
wc counts the number of lines, words, and characters
in a provided file (actually a little bit more than that, as shown by the
manual page). This program is implemented in C in the
coreutils package on
linux (similar implementation on the real UNIXes). In this assignment, we will
implement four programs, called
chars, which will all share code from a "common" source file and
be built from a single makefile.
common.hand declare them in
common.h. Call the relevant functions from each program's
main. Each of these functions should take an
wc. If you don't get the exact numbers, don't sweat it (there are some very specific quirks of wc), but you should get within 10 or so on all counts.
Submit all source code (the seven files listed above) in as compact a format as possible (I recommend using
a2ps with the command line
a2ps -2 -C -E -A fill -o output.ps input1 input2 ...)
along with the output of your programs (clearly labeled) and of
wc (again, clearly labeled).
DO NOT use a font size smaller than 8 or larger than 10. DO use a monospaced font. If possible, print line numbers
and syntax higlighting (the
a2ps command above will do this).