1: #include <stdio.h> 2: 3: setbuf(iop, buf) 4: register struct _iobuf *iop; 5: char *buf; 6: { 7: if (iop->_base != NULL && iop->_flag&_IOMYBUF) 8: free(iop->_base); 9: #ifndef UCB_LINEBUF 10: iop->_flag &= ~(_IOMYBUF|_IONBF); 11: #else UCB_LINEBUF 12: iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF); 13: #endif UCB_LINEBUF 14: if ((iop->_base = buf) == NULL) 15: iop->_flag |= _IONBF; 16: else 17: iop->_ptr = iop->_base; 18: iop->_cnt = 0; 19: }