Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Question

Define promotion.

Answered: 1 week ago

Question

Write a note on transfer policy.

Answered: 1 week ago

Question

Discuss about training and development in India?

Answered: 1 week ago

Question

Explain the various techniques of training and development.

Answered: 1 week ago

Question

Explain the various techniques of Management Development.

Answered: 1 week ago