|
|
1.1 ! root 1: #include <stdio.h> ! 2: char *malloc(); ! 3: ! 4: _filbuf(iop) ! 5: register FILE *iop; ! 6: { ! 7: static char smallbuf[_NFILE]; ! 8: ! 9: if ((iop->_flag&_IOREAD) == 0) ! 10: return(EOF); ! 11: if (iop->_flag&_IOSTRG) ! 12: return(EOF); ! 13: tryagain: ! 14: if (iop->_base==NULL) { ! 15: if (iop->_flag&_IONBF) { ! 16: iop->_base = &smallbuf[fileno(iop)]; ! 17: goto tryagain; ! 18: } ! 19: if ((iop->_base = malloc(BUFSIZ)) == NULL) { ! 20: iop->_flag |= _IONBF; ! 21: goto tryagain; ! 22: } ! 23: iop->_flag |= _IOMYBUF; ! 24: } ! 25: iop->_ptr = iop->_base; ! 26: iop->_cnt = read(fileno(iop), iop->_ptr, iop->_flag&_IONBF?1:BUFSIZ); ! 27: if (--iop->_cnt < 0) { ! 28: if (iop->_cnt == -1) ! 29: iop->_flag |= _IOEOF; ! 30: else ! 31: iop->_flag |= _IOERR; ! 32: iop->_cnt = 0; ! 33: return(-1); ! 34: } ! 35: return(*iop->_ptr++&0377); ! 36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.