The goal of this project is to complete the implementation of a program that performs a simple glossary analysis. In particular, the program extracts "words" from a text file and prints to the console a mapping of the words found in the provided text file and their associated frequencies. You can download a bunch of example book text files to help with your implementation. For example, a working implementation will produce the following output (assuming your compiled program is called wordfreak ) given a sequence of text files from the command line:
$ ./wordfreak aladdin.txt holmes.txt newton.txt
THE : 1
ADVENTURES : 1
OF : 1
ALADDIN : 1
Once : 1
upon : 1
a : 47
time : 1
widow : 5
had : 21
an : 6
only : 4
son : 6
...
A working implementation must also accept text files from standard input. For example, this is an alternate way a correct implementation can be executed (for more details on the bash pipe | operator see this tutorial ):
$ cat aladdin.txt holmes.txt newton.txt | ./wordfreak
THE : 1
ADVENTURES : 1
OF : 1
ALADDIN : 1
Once : 1
upon : 1
a : 47
time : 1
widow : 5
had : 21
an : 6
only : 4
son : 6
...
A working implementation must also accept an environment variable called WORD_FREAK set to a single file from the command line to be analyzed:
$ WORD_FREAK=aladdin.txt ./wordfreak
THE : 1
ADVENTURES : 1
OF : 1
ALADDIN : 1
Once : 1
upon : 1
a : 47
time : 1
widow : 5
had : 21
an : 6
only : 4
son : 6
...
Furthermore, your submission is restricted to only using the following system calls: open() , close() , read() , write() , and lseek() for performing I/O. You are allowed to use other C library calls (e.g., malloc() , free() ), however, all I/O is restricted to the Linux kernel's direct API support for I/O.