|
|
1.1 ! root 1: /* @(#)setbuf.c 4.1 (Berkeley) 12/21/80 */ ! 2: #include <stdio.h> ! 3: ! 4: setbuf(iop, buf) ! 5: register struct _iobuf *iop; ! 6: char *buf; ! 7: { ! 8: extern _cleanup(); ! 9: extern _setcleanup; ! 10: ! 11: if(_setcleanup){ ! 12: _setcleanup = 0; ! 13: onexit(_cleanup); ! 14: } ! 15: if (iop->_base != NULL && iop->_flag&_IOMYBUF) ! 16: free(iop->_base); ! 17: iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF); ! 18: if ((iop->_base = (unsigned char *)buf) == NULL) ! 19: iop->_flag |= _IONBF; ! 20: else ! 21: iop->_ptr = iop->_base; ! 22: iop->_cnt = 0; ! 23: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.