Link to home
Start Free TrialLog in
Avatar of capricious
capricious

asked on

Unix system calls

Hi,

Wonder if anyone can help me out with this.

Using fork(), execlp() and wait() only, how may I write a function in a C program that simulates the shell AND-list behaviour.
And how may I return the exit status of the last shell command executed from this function?

Any clue?
Thanks in advance.
Avatar of Sys_Prog
Sys_Prog
Flag of India image

Hi capricious,

I am sorry but I did not get you

BAsically what feature are u talking abt by saying " the shell AND-list behaviour."



Avatar of capricious
capricious

ASKER

oh, AND-list basically means

$ date && date && ls

and the output prints out the value of 'date', ignoring the rest of the list since date returns 0 as its exit status.

I would like to restrict myself to using the 3 system calls fork(), execlp() and wait() to simulate the AND-list behaviour in a C program. Is this possible?

Thanks for any advice..
ASKER CERTIFIED SOLUTION
Avatar of Sys_Prog
Sys_Prog
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial