Loading...
--- Libc/Libc-262.3.2/stdio/stdio.3
+++ Libc/Libc-583/stdio/stdio.3
@@ -30,9 +30,9 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)stdio.3 8.7 (Berkeley) 4/19/94
-.\" $FreeBSD: src/lib/libc/stdio/stdio.3,v 1.18 2001/10/01 16:08:59 ru Exp $
+.\" $FreeBSD: src/lib/libc/stdio/stdio.3,v 1.26 2004/07/02 23:52:12 ru Exp $
.\"
-.Dd April 19, 1994
+.Dd January 10, 2003
.Dt STDIO 3
.Os
.Sh NAME
@@ -45,6 +45,20 @@
.Vt FILE *stdin ;
.Vt FILE *stdout ;
.Vt FILE *stderr ;
+.Pp
+Note:
+The current implementation does not allow these variables
+to be evaluated at C compile/link time.
+That is, a runtime calculation must be performed, such as:
+.Bd -literal -offset indent
+#include <stdio.h>
+
+static FILE *var;
+
+int main() {
+ var = stdout;
+}
+.Ed
.Sh DESCRIPTION
The standard
.Tn I/O
@@ -92,15 +106,19 @@
.Pp
A file may be subsequently reopened, by the same or another program
execution, and its contents reclaimed or modified (if it can be repositioned
-at the start). If the main function returns to its original caller, or
+at the start).
+If the main function returns to its original caller, or
the
.Xr exit 3
function is called, all open files are closed (hence all output
-streams are flushed) before program termination. Other methods
+streams are flushed) before program termination.
+Other methods
of program termination may not close files properly and hence
-buffered output may be lost. In particular,
+buffered output may be lost.
+In particular,
.Xr _exit 2
-does not flush stdio files. Neither does an exit due to a signal.
+does not flush stdio files.
+Neither does an exit due to a signal.
Buffers are flushed by
.Xr abort 3
as required by POSIX, although previous implementations did not.
@@ -127,9 +145,9 @@
(for writing diagnostic output).
.El
These streams are abbreviated
-.Em stdin , stdout
+.Dv stdin , stdout
and
-.Em stderr .
+.Dv stderr .
Initially, the standard error stream
is unbuffered; the standard input and output streams are
fully buffered if and only if the streams do not refer to
@@ -172,13 +190,13 @@
The following are defined as macros;
these names may not be re-used
without first removing their current definitions with
-.Dv #undef :
+.Ic #undef :
.Dv BUFSIZ ,
.Dv EOF ,
.Dv FILENAME_MAX ,
.Dv FOPEN_MAX ,
+.Dv L_ctermid ,
.Dv L_cuserid ,
-.Dv L_ctermid ,
.Dv L_tmpnam ,
.Dv NULL ,
.Dv P_tmpdir ,
@@ -187,36 +205,62 @@
.Dv SEEK_SET ,
.Dv TMP_MAX ,
.Dv clearerr ,
+.Dv clearerr_unlocked ,
.Dv feof ,
+.Dv feof_unlocked ,
.Dv ferror ,
+.Dv ferror_unlocked ,
.Dv fileno ,
+.Dv fileno_unlocked ,
.Dv fropen ,
.Dv fwopen ,
.Dv getc ,
+.Dv getc_unlocked ,
.Dv getchar ,
+.Dv getchar_unlocked ,
.Dv putc ,
+.Dv putc_unlocked ,
.Dv putchar ,
+.Dv putchar_unlocked ,
.Dv stderr ,
-.Dv stdin ,
-.Dv stdout ,
-.Dv vfscanf .
+.Dv stdin
+and
+.Dv stdout .
Function versions of the macro functions
-.Fn clearerr ,
-.Fn feof ,
-.Fn ferror ,
-.Fn fileno ,
-.Fn getc ,
-.Fn getchar ,
-.Fn putc ,
+.Dv clearerr ,
+.Dv clearerr_unlocked ,
+.Dv feof ,
+.Dv feof_unlocked ,
+.Dv ferror ,
+.Dv ferror_unlocked ,
+.Dv fileno ,
+.Dv fileno_unlocked ,
+.Dv getc ,
+.Dv getc_unlocked ,
+.Dv getchar ,
+.Dv getchar_unlocked ,
+.Dv putc ,
+.Dv putc_unlocked ,
+.Dv putchar ,
and
-.Fn putchar
+.Dv putchar_unlocked
exist and will be used if the macro
definitions are explicitly removed.
+.Sh LEGACY SYNOPSIS
+The -D_NONSTD_SOURCE flag can be used
+to allow stdin, stdout, and/or stderr
+to be evaluated at compile/link time, as:
+.Bd -literal -offset indent
+#include <stdio.h>
+
+static FILE *var = stdout;
+.Ed
.Sh SEE ALSO
.Xr close 2 ,
.Xr open 2 ,
.Xr read 2 ,
-.Xr write 2
+.Xr write 2 ,
+.Xr compat 5
.Sh BUGS
The standard buffered functions do not interact well with certain other
library and system functions, especially
@@ -225,12 +269,14 @@
The
.Nm
library conforms to
-.St -isoC .
+.St -isoC-99 .
.Sh LIST OF FUNCTIONS
.Bl -column "Description"
.It Sy "Function Description"
.It "asprintf formatted output conversion"
+.It ""
.It "clearerr check and reset stream status"
+.It ""
.It "fclose close a stream"
.It "fdopen stream open functions"
.It "feof check and reset stream status"
@@ -240,12 +286,16 @@
.It "fgetln get a line from a stream"
.It "fgetpos reposition a stream"
.It "fgets get a line from a stream"
+.It "fgetwc get next wide character from input stream"
+.It "fgetws get a line of wide characters from a stream"
.It "fileno check and reset stream status"
.It "fopen stream open functions"
.It "fprintf formatted output conversion"
.It "fpurge flush a stream"
.It "fputc output a character or word to a stream"
.It "fputs output a line to a stream"
+.It "fputwc output a wide character to a stream"
+.It "fputws output a line of wide characters to a stream"
.It "fread binary stream input/output"
.It "freopen stream open functions"
.It "fropen open a stream"
@@ -254,23 +304,34 @@
.It "fsetpos reposition a stream"
.It "ftell reposition a stream"
.It "funopen open a stream"
+.It "fwide set/get orientation of stream"
.It "fwopen open a stream"
+.It "fwprintf formatted wide character output conversion"
.It "fwrite binary stream input/output"
+.It ""
.It "getc get next character or word from input stream"
.It "getchar get next character or word from input stream"
.It "gets get a line from a stream"
.It "getw get next character or word from input stream"
-.It "mkdtemp create unique temporary file"
+.It "getwc get next wide character from input stream"
+.It "getwchar get next wide character from input stream"
+.It ""
+.It "mkdtemp create unique temporary directory"
.It "mkstemp create unique temporary file"
.It "mktemp create unique temporary file"
+.It ""
.It "perror system error messages"
.It "printf formatted output conversion"
.It "putc output a character or word to a stream"
.It "putchar output a character or word to a stream"
.It "puts output a line to a stream"
.It "putw output a character or word to a stream"
+.It "putwc output a wide character to a stream"
+.It "putwchar output a wide character to a stream"
+.It ""
.It "remove remove directory entry"
.It "rewind reposition a stream"
+.It ""
.It "scanf input format conversion"
.It "setbuf stream buffering operations"
.It "setbuffer stream buffering operations"
@@ -280,18 +341,28 @@
.It "sprintf formatted output conversion"
.It "sscanf input format conversion"
.It "strerror system error messages"
+.It "swprintf formatted wide character output conversion"
.It "sys_errlist system error messages"
.It "sys_nerr system error messages"
+.It ""
.It "tempnam temporary file routines"
.It "tmpfile temporary file routines"
.It "tmpnam temporary file routines"
+.It ""
.It "ungetc un-get character from input stream"
+.It "ungetwc un-get wide character from input stream"
+.It ""
.It "vasprintf formatted output conversion"
.It "vfprintf formatted output conversion"
.It "vfscanf input format conversion"
+.It "vfwprintf formatted wide character output conversion"
.It "vprintf formatted output conversion"
.It "vscanf input format conversion"
.It "vsnprintf formatted output conversion"
.It "vsprintf formatted output conversion"
.It "vsscanf input format conversion"
+.It "vswprintf formatted wide character output conversion"
+.It "vwprintf formatted wide character output conversion"
+.It ""
+.It "wprintf formatted wide character output conversion"
.El