Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Iinclude #include #include #include /* needed for getchar, putchar, NULL /* needed for exit) */ /* /* needed needed for fork ( ) for wait()
Iinclude #include #include #include /* needed for getchar, putchar, NULL /* needed for exit) */ /* /* needed needed for fork ( ) for wait() */ */ char command [100]: char "argv[100]: void getcommand (0 ( char ch; int i- 0: putchar do f chgetchar command [ i ]-ch: } while (ch != " "); commandi1]10 void splitargv) int i-0; int j-0; for (;;) { while (command[j]-- . .) j++; if (command [j] .\0.) break; argv]&command [51 while ((command [j] (command [j] *) 0')) - !- { if (command [j]-,\0') command [1]-.\0'; break; argv [1]NULL: void launch ) it (tork00) /child-/ execve( argyI], argv, NULL printf"no such commandln"): exit( EXIT FAILURE ) else t /"parent. wait( NULL int main ) f for () t getcommand 0: splitargv ); launch )
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started