BSD 3 development
[unix-history] / usr / src / cmd / learn / makpipe.c
CommitLineData
42d6e430
BJ
1#include "stdio.h"
2
3makpipe()
4{
5 int f[2];
6
7 pipe(f);
8 if (fork()==0) {
9 close(f[1]);
10 close(0);
11 dup(f[0]);
12 close(f[0]);
13 execl ("/bin/sh", "sh", "-i", 0);
14 execl ("/usr/bin/sh", "sh", "-i", 0);
15 write(2,"Exec error\n",11);
16 }
17 close(f[0]);
18 sleep(2); /* so shell won't eat up too much input */
19 return(f[1]);
20}