f******k 发帖数: 26 | 1 int main(void)
{
int pid1,pid2,p1[2];
int p2[2];
int p3[2];int status;
pipe(p1);
pipe(p2);
if (fork() == 0) {
if((fork())==0) {
close(p1[0]);
dup2(p1[1],1);
close(p1[1]);
execlp("who","who",(char *)0);
}
else
{
if ((fork())==0){
close(p1[1]);
dup2(p1[0],0);
close(p1[0]);
close(p2[0]);
dup2(p2[1],1);
close(p2[1]);
execlp("sort","sort",( |
|