]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/printf.3
Automated addition of parentheses by add_parens_for_own_funcs.sh
[thirdparty/man-pages.git] / man3 / printf.3
index 5f7a5bd4027809d58d358b8481c685be3bf5b960..0517311d4094c15848c46224c13f02e094231681 100644 (file)
@@ -56,39 +56,39 @@ printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf \- fo
 .BI "int vsnprintf(char *" str ", size_t " size ", const char *" format ", va_list " ap );
 .SH DESCRIPTION
 The functions in the
-.B printf
+.BR printf ()
 family produce output according to a
 .I format
 as described below. The functions
-.B printf
+.BR printf ()
 and
-.B vprintf
+.BR vprintf ()
 write output to
 .IR stdout ,
 the standard output stream;
-.B fprintf
+.BR fprintf ()
 and
-.B vfprintf
+.BR vfprintf ()
 write output to the given output
 .IR stream ;
-.BR sprintf ,
-.BR snprintf , 
-.B vsprintf
+.BR sprintf (),
+.BR snprintf ()
+.BR vsprintf ()
 and
-.B vsnprintf
+.BR vsnprintf ()
 write to the character string
 .IR  str .
 .PP
 The functions
-.BR vprintf ,
-.BR vfprintf ,
-.BR vsprintf ,
-.B vsnprintf
+.BR vprintf (),
+.BR vfprintf (),
+.BR vsprintf (),
+.BR vsnprintf ()
 are equivalent to the functions
-.BR printf ,
-.BR fprintf ,
-.BR sprintf ,
-.BR snprintf ,
+.BR printf (),
+.BR fprintf (),
+.BR sprintf (),
+.BR snprintf (),
 respectively, except that they are called with a va_list instead
 of a variable number of arguments. These functions do not call the
 .I va_end
@@ -793,33 +793,33 @@ make_message(const char *fmt, ...) {
 
 .SH NOTES
 The glibc implementation of the functions
-.B snprintf
+.BR snprintf ()
 and
-.B vsnprintf
+.BR vsnprintf ()
 conforms to the C99 standard, i.e., behaves as described above,
 since glibc version 2.1. Until glibc 2.0.6 they would return \-1
 when the output was truncated.
 .SH "CONFORMING TO"
 The
-.BR fprintf ,
-.BR printf ,
-.BR sprintf ,
-.BR vprintf ,
-.BR vfprintf ,
+.BR fprintf (),
+.BR printf (),
+.BR sprintf (),
+.BR vprintf (),
+.BR vfprintf (),
 and
-.B vsprintf
+.BR vsprintf ()
 functions conform to ANSI X3.159-1989 (``ANSI C'') and ISO/IEC 9899:1999
 (``ISO C99'').
 The
-.B snprintf
+.BR snprintf ()
 and
-.B vsnprintf
+.BR vsnprintf ()
 functions conform to ISO/IEC 9899:1999.
 .PP
 Concerning the return value of
-.BR snprintf ,
+.BR snprintf (),
 the SUSv2 and the C99 standard contradict each other: when
-.B snprintf
+.BR snprintf ()
 is called with
 .IR size =0
 then SUSv2 stipulates an unspecified return value less than 1,
@@ -854,32 +854,32 @@ glibc 2.2 adds the conversion character F with C99 semantics, and the
 flag character I.
 .SH HISTORY
 Unix V7 defines the three routines 
-.BR printf ,
-.BR fprintf ,
-.BR sprintf ,
+.BR printf (),
+.BR fprintf (),
+.BR sprintf (),
 and has the flag \-, the width or precision *, the length modifier l,
 and the conversions doxfegcsu, and also D,O,U,X as synonyms for ld,lo,lu,lx.
 This is still true for 2.9.1BSD, but 2.10BSD has the flags
 #, + and <space> and no longer mentions D,O,U,X.
 2.11BSD has 
-.BR vprintf ,
-.BR vfprintf ,
-.BR vsprintf ,
+.BR vprintf (),
+.BR vfprintf (),
+.BR vsprintf (),
 and warns not to use D,O,U,X.
 4.3BSD Reno has the flag 0, the length modifiers h and L,
 and the conversions n, p, E, G, X (with current meaning)
 and deprecates D,O,U.
 4.4BSD introduces the functions
-.B snprintf
+.BR snprintf ()
 and
-.BR vsnprintf ,
+.BR vsnprintf (),
 and the length modifier q.
 FreeBSD also has functions
 .I asprintf
 and
 .IR vasprintf ,
 that allocate a buffer large enough for
-.BR sprintf .
+.BR sprintf ().
 In glibc there are functions
 .I dprintf
 and
@@ -887,32 +887,32 @@ and
 that print to a file descriptor instead of a stream.
 .SH BUGS
 Because
-.B sprintf
+.BR sprintf ()
 and
-.B vsprintf
+.BR vsprintf ()
 assume an arbitrarily long string, callers must be careful not to overflow
 the actual space; this is often impossible to assure. Note that the length
 of the strings produced is locale-dependent and difficult to predict.
 Use
-.B snprintf
+.BR snprintf ()
 and
-.B vsnprintf
+.BR vsnprintf ()
 instead (or
 .B asprintf
 and
 .BR vasprintf ).
 .PP
 Linux libc4.[45] does not have a
-.BR snprintf ,
+.BR snprintf (),
 but provides a libbsd that contains an
-.B snprintf
+.BR snprintf ()
 equivalent to
-.BR sprintf ,
+.BR sprintf (),
 i.e., one that ignores the
 .I size
 argument.
 Thus, the use of
-.B snprintf
+.BR snprintf ()
 with early libc4 leads to serious security problems.
 .PP
 Code such as
@@ -922,7 +922,7 @@ often indicates a bug, since
 may contain a % character.  If
 .I foo
 comes from untrusted user input, it may contain %n, causing the
-.B printf
+.BR printf ()
 call to write to memory and creating a security hole.
 .\" .PP
 .\" Some floating point conversions under early libc4