Loading...
stdio/setbuf.3 Libc-262 Libc-498
--- Libc/Libc-262/stdio/setbuf.3
+++ Libc/Libc-498/stdio/setbuf.3
@@ -34,7 +34,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setbuf.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/setbuf.3,v 1.10 2001/10/01 16:08:59 ru Exp $
+.\" $FreeBSD: src/lib/libc/stdio/setbuf.3,v 1.15 2004/08/24 21:48:21 alfred Exp $
 .\"
 .Dd June 4, 1993
 .Dt SETBUF 3
@@ -50,41 +50,57 @@
 .Sh SYNOPSIS
 .In stdio.h
 .Ft void
-.Fn setbuf "FILE *stream" "char *buf"
+.Fo setbuf
+.Fa "FILE *restrict stream"
+.Fa "char *restrict buf"
+.Fc
 .Ft void
-.Fn setbuffer "FILE *stream" "char *buf" "int size"
+.Fo setbuffer
+.Fa "FILE *stream"
+.Fa "char *buf"
+.Fa "int size"
+.Fc
 .Ft int
-.Fn setlinebuf "FILE *stream"
+.Fo setlinebuf
+.Fa "FILE *stream"
+.Fc
 .Ft int
-.Fn setvbuf "FILE *stream" "char *buf" "int mode" "size_t size"
+.Fo setvbuf
+.Fa "FILE *restrict stream"
+.Fa "char *restrict buf"
+.Fa "int type"
+.Fa "size_t size"
+.Fc
 .Sh DESCRIPTION
-The three types of buffering available are unbuffered, block buffered,
-and line buffered.
+Three types of buffering are available:
+unbuffered, block buffered, and line buffered.
 When an output stream is unbuffered, information appears on the
 destination file or terminal as soon as written;
-when it is block buffered many characters are saved up and written as a block;
-when it is line buffered characters are saved up until a newline is
-output or input is read from any stream attached to a terminal device
-(typically stdin).
+when it is block buffered,
+many characters are saved up and written as a block;
+when it is line buffered,
+characters are saved up until a newline is output
+or input is read from any stream attached to a terminal device
+(typically
+.Dv stdin ) .
 The function
 .Xr fflush 3
 may be used to force the block out early.
 (See
 .Xr fclose 3 . )
 .Pp
-Normally all files are block buffered.
+Normally, all files are block buffered.
 When the first
 .Tn I/O
 operation occurs on a file,
 .Xr malloc 3
-is called,
-and an optimally-sized buffer is obtained.
+is called and an optimally-sized buffer is obtained.
 If a stream refers to a terminal
 (as
-.Em stdout
-normally does) it is line buffered.
+.Dv stdout
+normally does), it is line buffered.
 The standard error stream
-.Em stderr
+.Dv stderr
 is always unbuffered.
 .Pp
 The
@@ -92,8 +108,8 @@
 function
 may be used to alter the buffering behavior of a stream.
 The
-.Fa mode
-parameter must be one of the following three macros:
+.Fa type
+argument must be one of the following three macros:
 .Bl -tag -width _IOFBF -offset indent
 .It Dv _IONBF
 unbuffered
@@ -105,7 +121,7 @@
 .Pp
 The
 .Fa size
-parameter may be given as zero
+argument may be given as zero
 to obtain deferred optimal-size buffer allocation as usual.
 If it is not zero,
 then except for unbuffered files, the
@@ -114,6 +130,11 @@
 .Fa size
 bytes long;
 this buffer will be used instead of the current buffer.
+If
+.Fa buf
+is not NULL, it is the caller's responsibility to
+.Xr free 3
+this buffer after closing the stream.
 (If the
 .Fa size
 argument