xref: /csrg-svn/lib/libc/stdio/setbuffer.c (revision 56988)
146104Sbostic /*-
246104Sbostic  * Copyright (c) 1990 The Regents of the University of California.
346104Sbostic  * All rights reserved.
446104Sbostic  *
546104Sbostic  * This code is derived from software contributed to Berkeley by
646104Sbostic  * Chris Torek.
746104Sbostic  *
846104Sbostic  * %sccs.include.redist.c%
921410Sdist  */
1021410Sdist 
1126661Sdonn #if defined(LIBC_SCCS) && !defined(lint)
12*56988Storek static char sccsid[] = "@(#)setbuffer.c	5.6 (Berkeley) 12/04/92";
1346104Sbostic #endif /* LIBC_SCCS and not lint */
1421410Sdist 
1546104Sbostic #include <stdio.h>
168327Smckusick 
1746104Sbostic void
1846104Sbostic setbuffer(fp, buf, size)
1946104Sbostic 	register FILE *fp;
208327Smckusick 	char *buf;
218327Smckusick 	int size;
228327Smckusick {
2347550Storek 
24*56988Storek 	(void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, size);
258327Smckusick }
2611307Smckusick 
2711307Smckusick /*
2846104Sbostic  * set line buffering
2911307Smckusick  */
30*56988Storek int
3146104Sbostic setlinebuf(fp)
3246104Sbostic 	FILE *fp;
3311307Smckusick {
3447550Storek 
35*56988Storek 	return (setvbuf(fp, (char *)NULL, _IOLBF, (size_t)0));
3611307Smckusick }
37