HTML SRC List
HTML SRC List
The purposes of this assignment are to become familiar with the use of pointers to access data in an array.
Functional Requirements
2. Gets the url of the HTML document to analyze from the standard input.
4. Note that the fgets() in this code fragment just reads the first line from the HTML file into buffer.
You will need to write a loop that fgets() a line and strcat()'s it to the end of a big string containing
all lines of the HTML source code.
4. While the quit command has not been received:
1. Prints "Ready\n" to the stdout.
2. Gets a command to execute from the standard input. The command will be one of the following
(followed by a '\n'):
1. c = count. Prints the number of valid src attributes found in the HTML document to the
standard output. "Valid" src attributes are described below under non-functional
requirements.
2. t = tags. Each time a valid src attribute is found, print the associated tag name plus a "\n" to
the standard output.
3. u = urls. Each time a valid src attribute is found, print the associated URL plus a "\n" to the
standard output.
4. f = frequencies. Extra Credit. Write a list of tag names and tag counts (as with other
commands only include tags with valid src attributes) to the standard output. Separate the
names and counts by a \t; one tag+count combo per line. The order of the tag names in the
file must match the order in which tags are first encountered in the HTML source file (top to
bottom).
5. q = quit.
Non-Functional Requirements
1. Your project name must follow the pattern: {FLname}HtmlSrcList, where {FLname} is replaced by the
first letter of your first name plus your last name. E.g. if your name is Maria Marciano, your project name
must be MMarcianoHtmlSrcList. If your project name does not follow this pattern, it will not be graded.
The largest HTML source string your program needs to be able to handle is 256kB.
4. An acceptable solution for finding the tag that a src attribute belongs to is:
1. Starting at the src attribute, back up until you find a <.
2. Parse the word following the <.
7. The first executable line of your program must turn off output buffering. This is a requirement for
automated testing. The following line will do the trick:
2. In a terminal window, use cd to navigate to your project directory. Type grade to grade your program.
Scoring
testCount: 30 pts
testTags: 5 pts
testUrls: 5 pts
testMultipleCommands: 5pts
testSourceCode: 5 pts
testFrequencies: 5 pts extra credit