1*8326Smckusick /* @(#)setbuf.c 4.2 (Berkeley) 10/05/82 */ 22032Swnj #include <stdio.h> 32032Swnj 42032Swnj setbuf(iop, buf) 52032Swnj register struct _iobuf *iop; 62032Swnj char *buf; 72032Swnj { 82032Swnj if (iop->_base != NULL && iop->_flag&_IOMYBUF) 92032Swnj free(iop->_base); 102032Swnj iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF); 11*8326Smckusick if ((iop->_base = buf) == NULL) { 122032Swnj iop->_flag |= _IONBF; 13*8326Smckusick iop->_bufsiz = NULL; 14*8326Smckusick } else { 152032Swnj iop->_ptr = iop->_base; 16*8326Smckusick iop->_bufsiz = BUFSIZ; 17*8326Smckusick } 182032Swnj iop->_cnt = 0; 192032Swnj } 20