[Solved] NSYSP Homework 2

$25

File Name: NSYSP_Homework_2.zip
File Size: 150.72 KB

SKU: [Solved] NSYSP Homework 2 Category: Tag:
5/5 - (1 vote)

Part 1

  1. Edit the parse.c file to use strtok() and realloc( ) to implement the parse() and free_argv()

functions.

  1. Files provided: shell.h shell.c parse.c
  2. Example:

Part 2

  1. Add code to the builtin.c stub to recognize the echo, quit, exit, logout and bye commands. Write functions implementing these commands, and add a new line for

each command to table inbuilts[] just above the line {NULL, NULL}.

  1. File provided:

Builtin.c

  1. echo example:

echo print all strings echo -n N: print the specified string

  1. quit example: exit, quit, logout and bye terminate the program.

Part 3

  1. Edit the run_command.c file so a child process is created to run the command, and the parent waits for the child process to terminate. Check for builtin commands first, create a new process only for commands which are not built in. Use the parser from pervious labs to create from the command line the argv array passed to the child.

Hint: You can use exec()/execvp() function, waitpid() function and the fork() system call.

  1. File provided: run_command.c 3. Example:

Part 4

  1. Edit the is_background.c file to detect an &. Alter the run_command.c file so that if a task is running in the background, the parent does not wait. Do not worry about

background processes becoming zombies at this point; this will be addressed later.

  1. File provided: is_background.c 3. Example:

Reviews

There are no reviews yet.

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

Shopping Cart
[Solved] NSYSP Homework 2
$25