-
- iov = iobglue;
- while (*iov != NULL && active(*iov))
- if (++iov >= endglue) {
- errno = EMFILE;
- return (NULL);
- }
-
- if (*iov == NULL)
- *iov = (FILE *)malloc(sizeof **iov);
- if (*iov)
- bzero((char *)*iov, sizeof(**iov));
-
- return (*iov);
-}
-
-_f_morefiles()
-{
- register FILE **iov;
- register FILE *fp;
- register char *cp;
- int nfiles;
-
- nfiles = getdtablesize();
-
- iobglue = (FILE **)malloc(nfiles * sizeof *iobglue);
- if (iobglue == NULL)
- return (0);
-
- bzero((char *)iobglue, nfiles * sizeof(*iobglue));
- endglue = iobglue + nfiles;
-
- for (fp = _iob, iov = iobglue; fp < &_iob[NSTATIC]; /* void */)
- *iov++ = fp++;
-
- _smallbuf = malloc(nfiles * sizeof(*_smallbuf));
- return (1);
+ return (NULL);
+found:
+ fp->_flags = 1; /* reserve this slot; caller sets real flags */
+ fp->_p = NULL; /* no current pointer */
+ fp->_w = 0; /* nothing to read or write */
+ fp->_r = 0;
+ fp->_bf._base = NULL; /* no buffer */
+ fp->_bf._size = 0;
+ fp->_lbfsize = 0; /* not line buffered */
+ fp->_file = -1; /* no file */
+/* fp->_cookie = <any>; */ /* caller sets cookie, _read/_write etc */
+ fp->_ub._base = NULL; /* no ungetc buffer */
+ fp->_ub._size = 0;
+ fp->_lb._base = NULL; /* no line buffer */
+ fp->_lb._size = 0;
+ return (fp);