~/man
directory tree is to contain
a man page for the executable program. You may also leave a
README
file in the project directory if you think that one
is needed, but I neither expect nor require you to do so.
struct parsedURL { char* protocol; char* hostname; char* portNumber; char* pathName; };When the struct is returned, the
protocol
field will
normally point to the string "http" or "file". However, it will be a
NULL pointer if the string begins with a different protocol name or if
there is an error in the string that makes it impossible to parse. If
the protocol is http, the hostname and portNumber fields must be
defined, although the portNumber field will be be defined as NULL if
the URL does not specify a port number. If protocol field is a
non-NULL pointer, pathName must be a non-NULL pointer too. If the
pathname part of the URL string is missing, make the pathName member
point to the string "/".
Write a main program that accepts a URL string as a command line
argument. (If no command line argument is given, the program simply
terminates.) Pass the command line argument to parseURL() and
use ddd
to verify that the string is parsed correctly. Try
different URL strings to test your program fully. Have the program
exit when parseURL() returns.
At this point, your project directory should have the following files:
Makefile
parseURL.h
parseURL.cc
.cc
extension instead of .c
.)
main.cc
USER_INTERFACE
to determine which user interface
to use. Recognize "curses" and "motif," and use a dispatch table to
call the appropriate initialization code for the selected interface.
Pass a pointer to argc
and argv
as
parameters to the interface initialization routine. You may use
"curses" as the default value if USER_INTERFACE
is not set.
The interface initialization function will not return to
main().
processURL
module. This handler puts the
address of the other function in the urlInfo_t
structure
for the URL.
processURL
module.
struct urlInfo_t { // The original URL string. const char* urlString; // Parsed Substrings of the URL string. char* protocolName; char* hostName; char* portNumber; char* pathName; // Raw Document Information. caddr_t rawStart; size_t rawLength; freeDoc_f* freeDoc; // Parsed Document Information. paraInfo_t *firstPara; };When you have this program working, check in all files, including the Makefile, as version 2.1 of your project.
'q'
- Exit the program.
KEY_DOWN
- Scroll down one line in the displayed
document.
KEY_UP
- Scroll up one line in the displayed
document.
KEY_NPAGE
- Scroll down one screenful.
KEY_PPAGE
- Scroll up one page.
'g'
command to your Curses user interface that
prompts for a URL string and processes it. This is version 4.1 of the
project.
<P>
and <Hn> pairs to divide the
document into paragraphs. Modify your Curses renderer to display
paragraphs properly. This is version 6.1 of the project.