#include #include #include #include #include #include #include int main(void) { int fd[2], p; char c; p = pipe(fd); assert(p != -1); pid_t pr = fork(); assert(pr != -1); switch (pr) { case 0: close(fd[0]); dup2(fd[1], 1); execl("/usr/bin/ls", "ls", ".", NULL); exit(0); default: close(fd[1]); dup2(fd[0], 0); execl("/usr/bin/wc", "wc", "-l", NULL); } close(fd[0]); return 0; }