diff options
Diffstat (limited to 'newlib/libc/stdio/setbuffer.c')
-rw-r--r-- | newlib/libc/stdio/setbuffer.c | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/newlib/libc/stdio/setbuffer.c b/newlib/libc/stdio/setbuffer.c index e88187446..c74c7fce1 100644 --- a/newlib/libc/stdio/setbuffer.c +++ b/newlib/libc/stdio/setbuffer.c @@ -14,6 +14,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ + /* Modified copy of setbuf.c to support the setbuffer function defined as part of BSD. @@ -65,17 +66,53 @@ This function comes from BSD not ANSI or POSIX. Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, <<lseek>>, <<read>>, <<sbrk>>, <<write>>. + + +FUNCTION + +<<setlinebuf>>---specify line buffering for a file or stream + +INDEX + setlinebuf + +ANSI_SYNOPSIS + #include <stdio.h> + void setlinebuf(FILE *<[fp]>); + +TRAD_SYNOPSIS + #include <stdio.h> + void setlinebuf(<[fp]>) + FILE *<[fp]>; + +DESCRIPTION +<<setlinebuf>> specifies that output to the file or stream identified by +<[fp]> should be line buffered. This causes the file or stream to pass +on output to the host system at every newline, as well as when the +buffer is full, or when an input operation intervenes. + +WARNINGS +You may only use <<setlinebuf>> before performing any file operation +other than opening the file. + +RETURNS +<<setlinebuf>> returns as per setvbuf. + +PORTABILITY +This function comes from BSD not ANSI or POSIX. + +Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, +<<lseek>>, <<read>>, <<sbrk>>, <<write>>. */ #include <_ansi.h> #include <stdio.h> #include "local.h" -_VOID -_DEFUN(setbuffer, (fp, buf, size), - FILE * fp _AND - char *buf _AND - int size) +void +_DEFUN (setbuffer, (fp, buf, size), + FILE * fp _AND + char *buf _AND + int size) { - _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size); + (void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size); } |