|
|
1.1 root 1: #ifndef lint
2: static char *rcsid =
3: "$Header: /na/franz/franz/RCS/fpipe.c,v 1.1 83/01/29 12:49:40 jkf Exp $";
4: #endif
5:
6: /* -[Sat Jan 29 12:44:16 1983 by jkf]-
7: * fpipe.c $Locker: $
8: * pipe creation
9: *
10: * (c) copyright 1982, Regents of the University of California
11: */
12:
13:
14: #include "global.h"
15: #include <signal.h>
16: FILE *_dofpip(iodes)
17: int iodes;
18: {
19: register FILE *p;
20:
21: for(p=_iob; (p->_flag&(_IOWRT|_IOREAD))!=0; p++)
22: if (p >= _iob+_NFILE)
23: return(NULL);
24: p->_file = iodes;
25: p->_cnt = 0;
26: p->_base = p->_ptr = NULL;
27: return(p);
28: }
29:
30: FILE * fpipe(info)
31: FILE *info[2];
32: {
33: register FILE *p;
34: int descrips[2];
35:
36: if(0 > pipe(descrips)) return( (FILE *) -1);
37:
38: if(NULL==(p = _dofpip(descrips[0]))) return( (FILE *) -1);
39: p->_flag = (_IONBF|_IOREAD);
40: info[0] = p;
41:
42: if(NULL==(p = _dofpip(descrips[1]))) return( (FILE *) -1);
43: p->_flag = _IOWRT;
44: info[1] = p;
45: return((FILE *) 2); /*indicate sucess*/
46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.