Limited Offer Get 25% off — use code BESTW25
No AI No Plagiarism On-Time Delivery Free Revisions
Claim Now
Prices start at $5 per page · plagiarism-free papers · free revisions for 14 days 24/7 support: support@bestwriters.com
Uncategorized

TCSS 422 Operating Systems

  • Posted
  • Authoradmin
  • Length742 words
  • Reading time4 min
Write My Assignment FREE

TCSS 422 Operating Systems Instructor: Juhua Hu Spring 2020
1
Assignment 2
MyShell
The purpose of this assignment is to use the fork, wait, and execvp to write a simple Linux shell.
This shell is called “MyShell”, and the goal of MyShell is to continually prompt the user to supply a
command, execute that command, and show the next prompt, once the command is executed.
The file MyShell.c is already given to you. The file contains the functions shown in the below table. You
should NOT change the method signatures. You should implement the missing portions of the program as
per the guidelines given below. You may add additional functions if necessary.

int main(int argc, char** argv) Parameters: int argc, char **argv
Return: EXIT_SUCCESS
char** parse(void) Parameters: none
Return: char** pointer
int execute(char** args) Parameters: char** args
Return: 0/1

int main(int argc, char** argv)
• The main function should display the MyShell> prompt. You should not change the name of the
prompt.
• The main function should indefinitely run until terminated by CTRL+C or when the user types the
exit command in the MyShell> prompt.
• It should call the parse() function in order to accept and process the command the user enters
• It should call the execute() function to actually execute the command
char** parse(void)
• Gets the input typed by the use in the MyShell> prompt in the form of a line
• Splits the line into tokens
• The tokens are used to create a char** pointer which will serve as an argument for execvp
int execute(char** args)
• char** args is obtained from the parse function
• You should fork a child and execute the command typed in by the user using EXECVP. You should
only use execvp and not other versions.
• When fork fails, an error message should be printed. However, the next MyShell> prompt should
be shown.
• When execvp is not successful, an error message should be printed, and the child should terminate.
However, the next MyShell> prompt should be shown.
TCSS 422 Operating Systems Instructor: Juhua Hu Spring 2020
2
• When an empty command is entered, the next MyShell> prompt should be shown.
• When the command exit is entered by the user, the main program must exit [You may or may not
fork in order to implement the exit command].
• The parent should wait for the child to terminate before it accepts another command. You can use
wait or waitpid for this.
Other guidelines:
• User command plus arguments will not exceed 255 characters
• Only one command should be typed at the MyShell> prompt, no pipelining of commands
• Commands run in MyShell> will assume the user’s original path: Type “echo $PATH” to see the
current path variable setting. Myshell is not responsible for finding the path for the commands or
files.
• If the user makes a mistake typing a command and/or its arguments, execvp should simply fail to
run the command. A simple error should be shown, but next MyShell> prompt should be displayed.
• Please note that commands like “cd” may not work as shown in the sample output.
What you should submit: A single, completed file MyShell.c to canvas
Sample Output:
TCSS 422 Operating Systems Instructor: Juhua Hu Spring 2020
3
Grading Rubric
This assignment will be scored out of 100* points. (100/100)=100%
110 points are possible.
External Correctness:
• MyShell> is displayed correctly 5
• MyShell> accepts user input 5
• MyShell> is displayed after executing a command 10
• MyShell> is displayed after execvp fails 5
• MyShell> is not displayed after the exit command 5
• The command user types are executed 10
• The command user types are executed, and the results are displayed 10
• When the user types an empty command, no error message is printed and the next MyShell> prompt
is displayed 10
• When the user types exit the program terminates 10
• When the user presses CTRL+C, the program terminates 10
Internal Correctness:
• The execvp command is appropriately implemented with the correct arguments 5
• After fork, the parent waits for the child to terminate 5
• The user input is parsed and tokenized to suit the execvp arguments 5
• There is code to display MyShell> prompt infinitely, except when exit command or CTRL+C is
given 5
Extra Credit:
• If your program accepts user input (with unlimited length including unlimited number of
arguments) you will receive additional 10 points

The post TCSS 422 Operating Systems appeared first on My Assignment Online.

Plagiarism Free Assignment Help

Expert Help With This Assignment — On Your Terms

✓ Native UK, USA & Australia writers ✓ Deadline from 3 hours ✓ 100% Plagiarism-Free — Turnitin included ✓ Unlimited free revisions ✓ Free to submit — compare quotes

admin

Academic writer and editor at BestWriters.

Get your paper off your plate tonight

Post your instructions for free. Prices start at $5 per page.

Place an order