date and time created 82/10/05 22:47:01 by mckusick
[unix-history] / usr / src / lib / libc / stdio / setbuffer.c
CommitLineData
30b0fd94
KM
1/* @(#)setbuffer.c 4.1 (Berkeley) %G% */
2#include <stdio.h>
3
4setbuffer(iop, buf, size)
5 register struct _iobuf *iop;
6 char *buf;
7 int size;
8{
9 if (iop->_base != NULL && iop->_flag&_IOMYBUF)
10 free(iop->_base);
11 iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF);
12 if ((iop->_base = buf) == NULL) {
13 iop->_flag |= _IONBF;
14 iop->_bufsiz = NULL;
15 } else {
16 iop->_ptr = iop->_base;
17 iop->_bufsiz = size;
18 }
19 iop->_cnt = 0;
20}