67%(3)2 out of 3 people found this document helpful
This preview shows page 5 - 7 out of 16 pages.
Finally you must not use any existing shell program to implement your shell (for example by calling a shell through the function system). That would defeat the purpose of this project.In the above, commands such as ls, cat, grep, sleep, ps and xterm are used as examples to illustrate the use of your shell program. However your shell must be able to handle anycommand or executable program. Note the commands prompt, pwd, cd and exit should be implemented as shell builtins, not as external commands.The syntax and behaviour of the built-in commands pwd, cd and exit should be similar to the corresponding commands under Bash shell.A major part of this shell is a command line parser. Please read the this notefor suggestions on implementing the parser.Definition of Command Line SyntaxThe following is the formal definition of the command line syntax for the shell, defined in Extended BNF:< command line > ::= < job >| < job > '&'| < job > '&' < command line >| < job > ';'| < job > ';' < command line >< job > ::= < command >
| < job > '|' < command >< command > ::= < simple command >| < simple command > '<' < filename >| < simple command > '>' < filename >< simple command > ::= < pathname >| < simple command > < token >An informal definition plus additional explanations of the syntax is given below:1.A command lineconsists of one or several jobsseparated by the special character "&" and/or ";". The last jobmay be followed by the character "&" or ";". If a jobis followed by the character "&", then it should be executed in the background.2.A jobconsists of one or more commands separated by pipeline characters "|";3.A commandis either a simple commandor a simple commandfollowed by an input redirection (< filename) or an output redirection (> filename);4.A simple commandconsists of a single pathnamefollowed by zero or more tokens;5.The following five characters are the special characters: &, ;, |, < , > ;6.The white space charactersare defined to be the space character and the tab character;7.A tokenis either a special character or a string that does not contain space charactersor special characters. In this project we do not consider quoted strings. Therefore if single quote or double quote characters appear in a string, they are treated just like any other non-special characters without its usually special meaning;8.Tokensmust be separated by one or more white spaces;9.A pathnameis either a file name, or an absolute pathname, or a relative pathname. Examples of pathnames are grep, /usr/bin/grep, bin/grepand ./grep;10. A command line must end with a newline character.Project 2: A Simple File Transfer Protocol (Back to Beginning)Design and implement a simple network protocol that can be used to download filesfrom a remote site and to upload files to a remote site, and a client and a server programs that communicate using that protocol. The protocol should use TCP as its transport layer protocol. The server must be able to serve multiple client requests simultaneously. For simplicity, do not consider any authentication process in this project, hence the server will provide its service to any client with the right site address and port number.