Assignment 10: Better Matching Words
Complete assignment due: Thursday, Nov 6th, 9:00 p.m.
This assignment is a variation on Assignment 10. Your program will be named match2. The program will take at least two file names. There is one optional command-line argument that may be present:
match [-i] wordsFile file [file ...]
The specifications for the program are the same as for match in Assignment 9, with the following differences:
  1. Use an array of struct’s to hold the matches found for words in a given file. Assume there will be at most 30,000 words in the words file. The specifications for what constitutes a word are the same as in Assignment 9. Assume up to 100 matches per word. The struct should hold the word itself, the matches, and any other information you need to store about the word.
  2. Matches will be per page rather than per line. We will define a “page” as being 60 lines in the file. If the number of lines in the file is not divisible by 60, then the lines left over at the end of the file will constitute the last page.
  3. Report only whether the word appears on the page. You do not need to include an asterisk for words that appear more than once on a page.
  4. Write your program using at least two C files and at least one header file. The header file should contain function prototypes and constant definitions. It can contain additional items, as appropriate to your solution.
  5. Include a Makefile that supports incremental compilation of your files. The Makefile will support the target: make match2. This will produce an executable named match2. The Makefile will also support the target: make clean. This will remove all .o files created by your program.
Turnin: Use turnin to turn in all the files for your program. This includes the Makefile, all the C program files, and the header file(s). The command is:
turnin 352assign10 Makefile ...
See the man page for the turnin program for details on what turnin can do and how you can confirm that your file was turned in.