1*2032Swnj /* @(#)setbuf.c 4.1 (Berkeley) 12/21/80 */ 2*2032Swnj #include <stdio.h> 3*2032Swnj 4*2032Swnj setbuf(iop, buf) 5*2032Swnj register struct _iobuf *iop; 6*2032Swnj char *buf; 7*2032Swnj { 8*2032Swnj if (iop->_base != NULL && iop->_flag&_IOMYBUF) 9*2032Swnj free(iop->_base); 10*2032Swnj iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF); 11*2032Swnj if ((iop->_base = buf) == NULL) 12*2032Swnj iop->_flag |= _IONBF; 13*2032Swnj else 14*2032Swnj iop->_ptr = iop->_base; 15*2032Swnj iop->_cnt = 0; 16*2032Swnj } 17