All input to the browser will be via standard input. If a user enters minibrowse at a UNIX prompt, then the user should be able to enter commands at the keyboard. Alternatively, the user can have the commands already present in a flat file, and enter minibrowse < filename at the UNIX prompt to process all the commands at once. All output should be directed to standard output.
It is important that your program work both interactively and via redirecting standard input.
Minibrowse can accept the following commands. After every command, it should display the full URL for the web page which would be showing in the browser window if we had implemented a full-fledged browser.
Commands:
Command: | Description | Output |
Web page location (i.e. http://www.mathcs.carleton.edu) | Navigate to the indicated web page | Display the new web page URL. |
back | Navigate back one page | Display the appropriate URL. If none available, indicate accordingly. |
forward | Navigate forward one page | Display the appropriate URL. If none available, indicate accordingly. |
integer from 1 through 30 | Switch to window with ID number as indicated | Display the current URL in the new window. |
exit | Exit minibrowse |
You should make your program as robust as possible. If the user enters something that is not one of the standard commands, you may assume that it is a web page application. However, if the user does not say "exit" and you are redirecting standard input from a file, your program should handle this gracefully (e.g., it does not go into an infinite loop).
http://www.mathcs.carleton.edu
http://www.mathcs.carleton.edu
http://www.yahoo.com
http://www.yahoo.com
http://www.lycos.com
http://www.lycos.com
back
http://www.yahoo.com
back
http://www.mathcs.carleton.edu
forward
http://www.yahoo.com
forward
http://www.lycos.com
forward
No page found.
2
New window.
http://www.palmgear.com/support
http://www.palmgear.com/support
http://www.hotbot.com
http://www.hotbot.com
http://www.deja.com
http://www.deja.com
back
http://www.hotbot.com
1
http://www.lycos.com
back
http://www.yahoo.com
http://www.slashdot.com
http://www.slashdot.com
forward
No page found.
back
http://www.yahoo.com
back
http://www.mathcs.carleton.edu
back
No page found.
exit
string x = "21234";
int y = atoi(x.c_str());
cout << y << endl;