121409Sdist /* 221409Sdist * Copyright (c) 1980 Regents of the University of California. 321409Sdist * All rights reserved. The Berkeley software License Agreement 421409Sdist * specifies the terms and conditions for redistribution. 521409Sdist */ 621409Sdist 7*26660Sdonn #if defined(LIBC_SCCS) && !defined(lint) 8*26660Sdonn static char sccsid[] = "@(#)setbuf.c 5.2 (Berkeley) 03/09/86"; 9*26660Sdonn #endif LIBC_SCCS and not lint 1021409Sdist 112032Swnj #include <stdio.h> 122032Swnj 132032Swnj setbuf(iop, buf) 1417951Sserge register FILE *iop; 152032Swnj char *buf; 162032Swnj { 172032Swnj if (iop->_base != NULL && iop->_flag&_IOMYBUF) 182032Swnj free(iop->_base); 192032Swnj iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF); 208326Smckusick if ((iop->_base = buf) == NULL) { 212032Swnj iop->_flag |= _IONBF; 228326Smckusick iop->_bufsiz = NULL; 238326Smckusick } else { 242032Swnj iop->_ptr = iop->_base; 258326Smckusick iop->_bufsiz = BUFSIZ; 268326Smckusick } 272032Swnj iop->_cnt = 0; 282032Swnj } 29