summaryrefslogtreecommitdiffstats
path: root/man3/stdin.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/stdin.3')
-rw-r--r--man3/stdin.346
1 files changed, 23 insertions, 23 deletions
diff --git a/man3/stdin.3 b/man3/stdin.3
index da8a52fa6..b43358989 100644
--- a/man3/stdin.3
+++ b/man3/stdin.3
@@ -30,11 +30,11 @@ for it when it starts up, one for input, one for output, and one for
printing diagnostic or error messages.
These are typically attached to
the user's terminal (see
-.BR tty (4))
+.MR tty 4 )
but might instead refer to files or other devices, depending on what
the parent process chose to set up.
(See also the "Redirection" section of
-.BR sh (1).)
+.MR sh 1 .)
.P
The input stream is referred to as "standard input"; the output stream is
referred to as "standard output"; and the error stream is referred to
@@ -47,22 +47,22 @@ and
.IR stderr .
.P
Each of these symbols is a
-.BR stdio (3)
+.MR stdio 3
macro of type pointer to
.IR FILE ,
and can be used with functions like
-.BR fprintf (3)
+.MR fprintf 3
or
-.BR fread (3).
+.MR fread 3 .
.P
Since
.IR FILE s
are a buffering wrapper around UNIX file descriptors, the
same underlying files may also be accessed using the raw UNIX file
interface, that is, the functions like
-.BR read (2)
+.MR read 2
and
-.BR lseek (2).
+.MR lseek 2 .
.P
On program startup, the integer file descriptors
associated with the streams
@@ -79,7 +79,7 @@ and
are defined with these values in
.IR <unistd.h> .
(Applying
-.BR freopen (3)
+.MR freopen 3
to one of these streams can change the file descriptor number
associated with the stream.)
.P
@@ -92,7 +92,7 @@ in detail how this interaction is supposed to work.)
A general rule is that file descriptors are handled in the kernel,
while stdio is just a library.
This means for example, that after an
-.BR exec (3),
+.MR exec 3 ,
the child inherits all open file descriptors, but all old streams
have become inaccessible.
.P
@@ -104,14 +104,14 @@ and
are specified to be macros, assigning to them is nonportable.
The standard streams can be made to refer to different files
with help of the library function
-.BR freopen (3),
+.MR freopen 3 ,
specially introduced to make it possible to reassign
.IR stdin ,
.IR stdout ,
and
.IR stderr .
The standard streams are closed by a call to
-.BR exit (3)
+.MR exit 3
and by normal program termination.
.SH STANDARDS
C11, POSIX.1-2008.
@@ -129,17 +129,17 @@ The stream
is line-buffered when it points to a terminal.
Partial lines will not
appear until
-.BR fflush (3)
+.MR fflush 3
or
-.BR exit (3)
+.MR exit 3
is called, or a newline is printed.
This can produce unexpected
results, especially with debugging output.
The buffering mode of the standard streams (or any other stream)
can be changed using the
-.BR setbuf (3)
+.MR setbuf 3
or
-.BR setvbuf (3)
+.MR setvbuf 3
call.
Note that in case
.I stdin
@@ -147,14 +147,14 @@ is associated with a terminal, there may also be input buffering
in the terminal driver, entirely unrelated to stdio buffering.
(Indeed, normally terminal input is line buffered in the kernel.)
This kernel input handling can be modified using calls like
-.BR tcsetattr (3);
+.MR tcsetattr 3 ;
see also
-.BR stty (1),
+.MR stty 1 ,
and
-.BR termios (3).
+.MR termios 3 .
.SH SEE ALSO
-.BR csh (1),
-.BR sh (1),
-.BR open (2),
-.BR fopen (3),
-.BR stdio (3)
+.MR csh 1 ,
+.MR sh 1 ,
+.MR open 2 ,
+.MR fopen 3 ,
+.MR stdio 3