Question: #include #include #include #include #include #include #include int readLine(int, char *, int); int main(int argc, char *argv[]){ // To execute int status=0, n; // commands

#include#include #include #include #include #include #include int readLine(int, char *, int); int main(int argc, char *argv[]){ // To execute int status=0, n; // commands with no arguments char line[255]; char prompt[30]="Enter your command here> "; while(1){ write(STDIN_FILENO, prompt, 25); n=readLine(STDIN_FILENO, line, 255); if( n Question 4: Compile and test the program below. Then, add what is needed to make it capable to run commands with arguments (A line will contain a command name and its possible arguments). #include #include #include #include #include #include #include int readLine (int, char *, int): int main(int argc, char *argv[]) { // To execute int status=0, n: Il commands with no arguments char line (255): char prompt [30]="Enter your command here>"; while(1) { write (STDIN_FILENO, prompt, 25): n-readLine (STDIN_FILENO, line, 255); if(n + 0) // read a comand break; line (n-1]='\0'; // get rid of and add '\0' 11 for string manipulation if (!fork) execlp (line, line, NULL): wait (&status); if (n=--1) perror ("Reading error"): exit(0); int readLine(int fd, char *buff, int n) { int i=0, m; while(i #include #include #include #include #include #include int readLine (int, char *, int): int main(int argc, char *argv[]) { // To execute int status=0, n: Il commands with no arguments char line (255): char prompt [30]="Enter your command here>"; while(1) { write (STDIN_FILENO, prompt, 25): n-readLine (STDIN_FILENO, line, 255); if(n + 0) // read a comand break; line (n-1]='\0'; // get rid of and add '\0' 11 for string manipulation if (!fork) execlp (line, line, NULL): wait (&status); if (n=--1) perror ("Reading error"): exit(0); int readLine(int fd, char *buff, int n) { int i=0, m; while(i
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
