Question: #include /* needed for getchar, putchar, NULL */ #include /* needed for exit() */ #include /* needed for fork() */ #include /* needed for wait()

 #include  /* needed for getchar, putchar, NULL */ #include  /* needed for exit() */ #include  /* needed for fork() */ #include  /* needed for wait() */ #include  /* needed for strcmp() */ #define LINE_LENGTH 73 char command[LINE_LENGTH]; #define MAX_ARGS ((LINE_LENGTH/2)+1) char *argv[MAX_ARGS]; /* the definition of MAX_ARGS means we never need to do any bounds checking on argv; each arg is at least 1 character followed by a NUL, and we allow a trailing NULL at the end of the argument list. */ void getcommand() /* Read a command line from stdin, the standard input file global: command, filled with the null-terminated text of the line note: this is never called when feof(stdin) is true */ { int ch; /* this must be into because EOF is outside the char range */ int i = 0; putchar( '>' ); /* the prompt */ do { /* get the line */ ch = getchar(); command[i] = ch; i++; } while ((ch != ' ') && (ch != EOF) && (i  

 #include /* needed for getchar, putchar, NULL */ #include /* needed

for exit() */ #include /* needed for fork() */ #include /* needed

for wait() */ #include /* needed for strcmp() */ #define LINE_LENGTH 73

char command[LINE_LENGTH]; #define MAX_ARGS ((LINE_LENGTH/2)+1) char *argv[MAX_ARGS]; /* the definition of MAX_ARGS

Please have the solution in a file named launch.c

a) Break it up into multiple source files. You will probably want to use a Makefile to compile it, but this will not be turned in, so you are free to compile it by hand if you want. The defined constants LINE_LENGTH and MAX_ARGs, plus the arrays command and argv should be declared in a file called globals.h. The function launch must be in a file called launch.c. It would be sensible to put other functions in other source files, but this is not required. It would be sensible to build your project in its own project directory, but this is not required. Each sourc file should have include directives for the files it relies on, and none others. For example, don't write # include in a file that does not rely on any of the definitions in the standard I/O library Each source file should have header comments that indicate what it is, its provenance, etc. a) Break it up into multiple source files. You will probably want to use a Makefile to compile it, but this will not be turned in, so you are free to compile it by hand if you want. The defined constants LINE_LENGTH and MAX_ARGs, plus the arrays command and argv should be declared in a file called globals.h. The function launch must be in a file called launch.c. It would be sensible to put other functions in other source files, but this is not required. It would be sensible to build your project in its own project directory, but this is not required. Each sourc file should have include directives for the files it relies on, and none others. For example, don't write # include in a file that does not rely on any of the definitions in the standard I/O library Each source file should have header comments that indicate what it is, its provenance, etc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!