fix "printf("%4.1f\n", (double)0.0);"
[unix-history] / usr / src / lib / libc / stdio / setbuf.c
... / ...
CommitLineData
1/*
2 * Copyright (c) 1980 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#if defined(LIBC_SCCS) && !defined(lint)
8static char sccsid[] = "@(#)setbuf.c 5.2 (Berkeley) %G%";
9#endif LIBC_SCCS and not lint
10
11#include <stdio.h>
12
13setbuf(iop, buf)
14register FILE *iop;
15char *buf;
16{
17 if (iop->_base != NULL && iop->_flag&_IOMYBUF)
18 free(iop->_base);
19 iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF);
20 if ((iop->_base = buf) == NULL) {
21 iop->_flag |= _IONBF;
22 iop->_bufsiz = NULL;
23 } else {
24 iop->_ptr = iop->_base;
25 iop->_bufsiz = BUFSIZ;
26 }
27 iop->_cnt = 0;
28}