[SOLVED] C++ C shell CSE 325

$25

File Name: C++_C_shell_CSE_325.zip
File Size: 178.98 KB

5/5 - (1 vote)

CSE 325
Assignment Overview
Fall 2019
Computer Project #5
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 to extend a previous project.
It is worth 40 points (4% of course grade) and must be completed no later than 11:59 PM on Thursday, 10/10.
Assignment Deliverables
The deliverables for this assignment are the following files: proj05.makefile the makefile which produces proj05
proj05.student.c the source code file for your solution
Be sure to use the specified file names and to submit your files for grading via the CSE Handin system before the
project deadline.
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 external command.
3. The program will recognize the following built-in commands:
halt terminate the shell process
help display built-in commands
date display current date and time
env display environment variables
path display current search path
cwd display absolute pathname of current working directory cd manage current working directory
set manage environment variables import read commands from a file
Built-in commands will be completely processed by the program (the program will not create a child process to perform the processing).

4. Unless noted otherwise, built-in commands will behave as specified for Computer Project #4.
5. The command cd will update the users PWD environment variable, in addition to the behavior specified for Computer Project #4.
6. The command set will manage the users set of environment variables.
a) The command set VAR VALUE will set the environment variable VAR to the character string VALUE. If the environment variable VAR does not exist, it will be added to the users environment variables.
b) The command set VAR will remove the environment variable VAR from the users environment variables.
7. The command import FILE will input user commands from the file named FILE, instead of the standard input stream. For each line of the file, the program will echo print the line (without displaying a prompt), then process that line in the same manner as interactive user input. After the contents of the file have been processed, the program will resume accepting input from the standard input stream.
8. For external commands, the first token will be the name of a file containing an executable program. The program will create a new thread for each external command; that thread will use function system to execute the external command.
9. The program will perform appropriate error handling. It will display an appropriate message if the users command fails in any way.
Assignment Notes
1. As stated above, your source code file will be named proj05.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 3 system
man 3 setenv
man 3 unsetenv
man 3 pthread_create
man 3 pthread_join
man 3 pthread_exit
4. You must use the POSIX threads library and function system to process external commands. That is, your program will create a unique thread to process an external command. You may NOT call function fork in your program.
5. You must execute your program on the server cse410.cse.msu.edu. You may NOT execute your program on any other CSE server (such as arctic, black, xserver or xserver2). If you execute your program on any server except cse410 and you cause a system problem, you will receive a score of 0 on this assignment and sanctions from the Department with respect to your computer account.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] C++ C shell CSE 325
$25