#include #include #include //ipc-shell-1.c main() { int pfd[2]; pipe(pfd); switch(fork()) { case -1:printf("error in fork"); exit(1); case 0: if (close(1) == -1) { printf("error in close(1)"); exit(1); } dup(pfd[1]); close(pfd[0]); close(pfd[1]); execlp("who", "who", NULL); printf("error in execl1"); exit(1); } switch(fork()) { case -1:printf("error in fork"); exit(1); case 0: if(close(0) == -1){ printf("error in close(0)"); exit(1); } dup(pfd[0]); close(pfd[0]); close(pfd[1]); execlp("wc", "wc", NULL); printf("error in execl2"); exit(1); } close(pfd[0]); close(pfd[1]); wait(NULL) ; }