Question: solve missing statement in program in c language 4.The following program user unnamed pipes to implements commands such as last | sort | more in

solve missing statement in program in c language

4.The following program user unnamed pipes to implements commands such as last | sort | more in a general way so that a user can provide the program with any three commands from commands line. For example ./a.out last sort more. The program requires exactly three command line arguments. If less or more than three, it exits by showing message "Three commands are required from command line."Some statements or parts of the statements are missing in the program. Please add necessary (parts of)statements to complete it (25 pts).

#include

solve missing statement in program in c language 4.The following program user

#include include steilb.ha int mpinlint arke, cha areva o, dala o ommond orornar int f desl21, fDes(2); if (plpef des) perrorf Pipe exit(2) switch (fork case -: perror Fork"exit(4); case 0: /'In the 1 child process dup2(f des1], filenol(stdout): cloself desclosf des close(fDesl0l]; closeDes[1]; execlplargv1 rv, (char 0) exit(S) default: switch (fork)) case-1: perrorrexitl6) case 0: In the 2nd child process eno (Sfd out)) exit(7h default: dup2 fDes(ol, fileno(stdin)) cloself desl0]1: cloself des(1 close(fDestol): closelfDesi1) execlpfargvi, argvl3, (char 0) exit(8); return O

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!