wc.cc
which performs exactly
the same operations as the wc command.
Option | Interpretation | |
---|---|---|
-c or --chars | Print the number of characters only. | |
-l or --lines | Print the number of lines only. | |
-w or --words | Print the number of words only. | |
-L or --max-line-length | Print the length of the longest line only. | |
-? or --help | Print a "usage" message and exit. |
Options may be combined, so that "-c -w" (or -cw) will print the counts for both the number of characters and the number of words.
Until we have our Linux virtual machines, you will have to use Forbin, which does not support the getopt_long() function. So if you start working on forbin, ignore the long versions of the options and process only the short versions (-c, -l, -w, and -L) using the getopt() function. You can add the code for the long options later.
./wc -lw file1 file2 file3 > out1 /usr/bin/wc -lw file1 file2 file3 > out2 diff out1 out2(The above diff command should produce no output.)
Follow the instructions in the Coding Guidelines web page for creating
a tar file of your "clean" project directory. For this assignment,
you will not be using make or rcs for project
management, so your tar file should contain just the following: your
project directory, which is to contain only the file named wc.cc and
an empty subdirectory named RCS
. There must be no other
files in the tar file.
When your assignment has been coded and tested on your linux virtual machine, send me an email message with the subject line, "701: Assignment 2". Put your name and id number in the body of the message, and include your tar file as an attachment. Send the assignment to me from your linux virtual machine, using the pine email program to send it. (Attach a file by typing Control-J while the cursor is in the heading part of your message.)
Submit the assignment to me using my account (vickery) on the linux virtual machine.