Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

#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

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

Recommended Textbook for

Advances In Spatial And Temporal Databases 8th International Symposium Sstd 2003 Santorini Island Greece July 2003 Proceedings Lncs 2750

Authors: Thanasis Hadzilacos ,Yannis Manolopoulos ,John F. Roddick ,Yannis Theodoridis

2003rd Edition

3540405356, 978-3540405351

More Books

Students also viewed these Databases questions