Reference no: EM131666417
Computer Project Assignment
Assignment Overview
For this assignment, you are to design and implement a C/C++ program that will serve as a basic command-line interpreter (shell). You will design and implement additional functionality in subsequent projects.
Assignment Specifications
1. The program will repeatedly display a prompt containing the sequence number of the current command (starting at 1) and the username of the user executing the program. This information will be enclosed in the characters '<' and '>'. For example:
<1 mccullen>
The sequence number and username will be separated by a single space.
2. After displaying the prompt, the program will repeatedly read one line of input from the user and process it. An input line is defined as a sequence of zero or more tokens (character strings), separated by one or more delimiters (blanks and tabs), ending with a newline character. There will be no more than 128 characters in a line. If the first token is the name of a built-in command (listed below), then the program will take the appropriate action. Otherwise, the program will assume that it is an error.
3. The program will recognize the following built-in commands:
quit terminate the shell process
env display environment variables
date display current date and time
curr display absolute pathname of current working directory
cd manage current working directory
Built-in commands will be completely processed by the program (the program will not create a child process to perform the processing).
4. The command "date" will display the current date and time in a human-readable format.
5. The command "env" will display the user's environment variables in a format similar to "setenv" in the C shell.
6. The command "curr" will display the absolute pathname of the current working directory.
7. The command "cd" (without any other tokens) will reset the current working directory to be the user's home directory; the command "cd DIR" will reset the current working directory to be "DIR", where that token may be a relative or absolute pathname.
8. The program will perform appropriate error handling. It will display an appropriate message if the user's command fails in any way.
Assignment Notes
1. As stated above, your source code file will be named "proj03.student.c"; that source code file may contain C or C++ statements.
2. You must use "g++" to translate your source code file in the CSE Linux environment.
3. Information about system calls and library functions which might be useful for this project may be viewed using the "man" utility. For example:
man 2 time
man 3 ctime
man 3 getcwd
man 3 cuserid
man 3 string
4. As noted above, you will extend your program in subsequent projects, so you would be wise to properly structure and comment your source code.
Attachment:- Project.rar