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