NAME my-word-count -- a program that does what wc does, but differently. SYNOPSIS my-word-count [-vclmw] _filename_ DESCRIPTION Creates a child process, joined withe a pipe. The parent exec's cat on _filename_ and the child exec's wc the appropriate flags taken from the command line. The following options are available: -v verbose output. This option is not forwarded to the exec'ed processes. -clmw see man wc OUTPUT See man wc HISTORY Introduced in csc421.231. BUGS
The templates to guide in this are in the class/examples folder of the subversion respository,
Create you proj1 directory under your folder, and copy class/proj1 to that folder.
I suggest cutting and pasting code from pipe-test.c and exec-test.c. Note that the template my-word-count.c correctly references the provided header file my-word-count.h.
The pipe-test code does a lot of the work.
The short exec-test code demonstrates how you will invoke wc and cat. The execlp acts as if the command line received the various arguments to the call. However, we have to review some matters about the argv array.
Get the program correct for the simple case of sending no arguments to wc. Then create the code that constructs the option string to be given to wc from the option string given to my-word-count.
A good basic program works without considering options. However full credit will require properly handling the options. Test targets is given in the makefile for the case of no options, and for a particular combination of options. This is not exhaustive.
Only the options asked for in the pseudo-manpage (above) are to be implemented.
author: burton rosenberg
created: 4 sep 2023
update: 4 sep 2023