date and time created 80/12/21 16:50:56 by wnj
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Mon, 22 Dec 1980 08:50:56 +0000 (00:50 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Mon, 22 Dec 1980 08:50:56 +0000 (00:50 -0800)
SCCS-vsn: lib/libc/stdio/setbuf.c 4.1

usr/src/lib/libc/stdio/setbuf.c [new file with mode: 0644]

diff --git a/usr/src/lib/libc/stdio/setbuf.c b/usr/src/lib/libc/stdio/setbuf.c
new file mode 100644 (file)
index 0000000..c90a33a
--- /dev/null
@@ -0,0 +1,16 @@
+/* @(#)setbuf.c        4.1 (Berkeley) %G% */
+#include       <stdio.h>
+
+setbuf(iop, buf)
+register struct _iobuf *iop;
+char *buf;
+{
+       if (iop->_base != NULL && iop->_flag&_IOMYBUF)
+               free(iop->_base);
+       iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF);
+       if ((iop->_base = buf) == NULL)
+               iop->_flag |= _IONBF;
+       else
+               iop->_ptr = iop->_base;
+       iop->_cnt = 0;
+}