xref: /original-bsd/usr.bin/learn/learn/makpipe.c (revision 4f485440)
1 #ifndef lint
2 static char sccsid[] = "@(#)makpipe.c	4.2	(Berkeley)	04/25/83";
3 #endif not lint
4 
5 #include "stdio.h"
6 
7 makpipe()
8 {
9 	int f[2];
10 
11 	pipe(f);
12 	if (fork()==0) {
13 		close(f[1]);
14 		close(0);
15 		dup(f[0]);
16 		close(f[0]);
17 #if vax
18 		execl ("/bin/sh", "sh", "-i", 0);
19 		execl ("/usr/ucb/bin/sh", "sh", "-i", 0);
20 #else
21 		execlp("/bin/csh", "csh", "-if", 0);
22 		/*execl ("/usr/ucb/bin/csh", "csh", "-if", 0);*/
23 #endif
24 		write(2, "Exec error\n", 11);
25 	}
26 	close(f[0]);
27 	sleep(2);	/* so shell won't eat up too much input */
28 	return(f[1]);
29 }
30