Finally you must not use any existing shell program to implement your shell for

Finally you must not use any existing shell program

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 any command 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 note for suggestions on implementing the parser. Definition of Command Line Syntax The 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 >
Image of page 5
| < 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 line consists of one or several jobs separated by the special character "&" and/or ";". The last job may be followed by the character "&" or ";". If a job is followed by the character "&", then it should be executed in the background. 2. A job consists of one or more command s separated by pipeline characters "|"; 3. A command is either a simple command or a simple command followed by an input redirection (< filename) or an output redirection (> filename); 4. A simple command consists of a single pathname followed by zero or more tokens; 5. The following five characters are the special characters : &, ;, |, < , > ; 6. The white space characters are defined to be the space character and the tab character; 7. A token is either a special character or a string that does not contain space characters or 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. Tokens must be separated by one or more white spaces; 9. A pathname is either a file name, or an absolute pathname, or a relative pathname. Examples of pathnames are grep , /usr/bin/grep , bin/grep and ./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 files from 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.
Image of page 6
Image of page 7

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture