Commit | Line | Data |
---|---|---|
41e01b3e | 1 | /* @(#)setbuf.c 4.3 (Berkeley) %G% */ |
59641075 BJ |
2 | #include <stdio.h> |
3 | ||
4 | setbuf(iop, buf) | |
41e01b3e | 5 | register FILE *iop; |
59641075 BJ |
6 | char *buf; |
7 | { | |
8 | if (iop->_base != NULL && iop->_flag&_IOMYBUF) | |
9 | free(iop->_base); | |
10 | iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF); | |
f4c06a32 | 11 | if ((iop->_base = buf) == NULL) { |
59641075 | 12 | iop->_flag |= _IONBF; |
f4c06a32 KM |
13 | iop->_bufsiz = NULL; |
14 | } else { | |
59641075 | 15 | iop->_ptr = iop->_base; |
f4c06a32 KM |
16 | iop->_bufsiz = BUFSIZ; |
17 | } | |
59641075 BJ |
18 | iop->_cnt = 0; |
19 | } |