Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i just post this question more than 1 0 times and all the answers is incorrect and just do copy paste from chatgpt, why i

i just post this question more than 10 times and all the answers is incorrect and just do copy paste from chatgpt, why i spent my money for this app if you just ask chatgpt and all the answers in incorect this make me soooo angry, the answers is just repeated and all the answers incorrect. this app is realy bad, they even not read my question can you image i spent money for nothing. please please please do not answer silly answer or get answer from chatgpt, sorry to say if you do i will put dislike and do report for your answer. this code in c for linux that make a simple shell that apply: semicolon, enviroment variable, and pipe. you have to edit the code and the code have to run perfectly with trying it and add the test that you check the code with your answer but have to answer full answer for all the requermnts and all the commands. In this exercise, the following elements must be added to the last exercise : 1. Pipe support - one or more 2. Support for 3. Support for <4. Support for ctrl-Z, bg 5. Additional edge case support Exercise definition: * In this exercise the following elements must be added: (1) Support for a pipe or a thread of several. 1. We saw the explanation for the implementation and initial code in the lesson -2. On the edge of a fork: for example, an explanation for a pipe board when the command "left | right" is entered, a pipe and 2 processes must be created. When the first process will route the standard output into the pipe and run the "left" command. The second process will route the standard input from the pipe and run the command "right" ... and the rest in induction. Remarks: * The character "|" must be supported One or more separators between different commands. * Commands can contain hyphens. echo "hi os"| wc -c 6_* Any number of spaces may appear between the commands and the character, and there may be no spaces at all. For example: ls -l|wc for example: ls -l | wc -l 28 ls -l|wc -l 28*When using PIPE it is not possible to assume that the commands are correct and exist. (ie, for example, not a situation of aaaaaa | sort program will issue an error message *For the avoidance of doubt - there may of course be no pipes at all. That is, a single command must also be supported, as in the previous exercise. And in combinations with;..... in general, all the things that worked in exercise 1 should work. (2) support for We talked about the implementation of in the lecture it is not complicated basically all that is required to change from exercise 2 is to cancel the wait in the parent when it is recognized that the user has pressed at the end of the command. and allow the loop to receive more commands from the user... where do you have to do the wait! (3) Support for ctrl-Z, bg We also talked about the implementation of ctrl-Z, bg in the lecture it's not complicated we need to support only one such process of Ctrl-Z and bg in sequence. (Relief - for example twice in a row Ctrl-Z and Ctrl-Z and then bg and bg it is possible to assume that you will not receive)* Remember to free processes from "zombie" mode (when does this happen!)(4) support for < As we discussed in the lesson, support for threading should be added to the file thread. (5) Edge case If you did not support the following edge case in exercise 1,) then check that they are Working. 1. Semicolon inside commas 2. Quotation marks (only quotation marks) immediately after a variable name echo VAR john echoVAR"adf" johnadf echo " asdf ; asdf" ; ls asdf ; asdf A1 A2 A3 A4 B BB1 C CC1 DD1 F1 FI Home VAR=john echoVAR"adf" johnadf ****Remember to check for memory leaks with valgrind. the code: #include #include #include #include #include #define MAX_CMD_LEN 510 #define MAX_ARGS 10 #define MAX_PROMPT_SIZE 1024 int main() int enter_count =0; // Counter for empty commands int cmd_count =0; // Counter for total commands executed int arg_count =0; // Counter for total arguments passed to commands char cmd[MAX_CMD_LEN]; // Buffer to hold user input command char *args[MAX_ARGS +1]; // Array to store parsed arguments char cwd[MAX_PROMPT_SIZE]; // Buffer to hold current working directory char prompt[MAX_PROMPT_SIZE]; // Buffer to hold the shell prompt while (1)// Display prompt getcwd(cwd, sizeof(cwd)); // Get current working directory snprintf(prompt, sizeof(prompt),"#cmd:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions