Loading...
stdio/FreeBSD/printf.3 Libc-825.26 Libc-320
--- Libc/Libc-825.26/stdio/FreeBSD/printf.3
+++ Libc/Libc-320/stdio/FreeBSD/printf.3
@@ -13,6 +13,10 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"	This product includes software developed by the University of
+.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -30,14 +34,14 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)printf.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.64 2009/12/02 07:51:25 brueffer Exp $
+.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.55 2003/01/06 06:19:19 tjr Exp $
 .\"
-.Dd December 2, 2009
+.Dd January 4, 2003
 .Dt PRINTF 3
 .Os
 .Sh NAME
-.Nm printf , fprintf , sprintf , snprintf , asprintf , dprintf ,
-.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf, vdprintf
+.Nm printf , fprintf , sprintf , snprintf , asprintf ,
+.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf
 .Nd formatted output conversion
 .Sh LIBRARY
 .Lb libc
@@ -53,8 +57,6 @@
 .Fn snprintf "char * restrict str" "size_t size" "const char * restrict format" ...
 .Ft int
 .Fn asprintf "char **ret" "const char *format" ...
-.Ft int
-.Fn dprintf "int fd" "const char * restrict format" ...
 .In stdarg.h
 .Ft int
 .Fn vprintf "const char * restrict format" "va_list ap"
@@ -66,8 +68,6 @@
 .Fn vsnprintf "char * restrict str" "size_t size" "const char * restrict format" "va_list ap"
 .Ft int
 .Fn vasprintf "char **ret" "const char *format" "va_list ap"
-.Ft int
-.Fn vdprintf "int fd" "const char * restrict format" "va_list ap"
 .Sh DESCRIPTION
 The
 .Fn printf
@@ -87,29 +87,19 @@
 .Fn vfprintf
 write output to the given output
 .Fa stream ;
-.Fn dprintf
-and
-.Fn vdprintf
-write output to the given file descriptor;
 .Fn sprintf ,
 .Fn snprintf ,
 .Fn vsprintf ,
 and
 .Fn vsnprintf
 write to the character string
-.Fa s ;
+.Fa str ;
 and
 .Fn asprintf
 and
 .Fn vasprintf
 dynamically allocate a new string with
 .Xr malloc 3 .
-.Pp
-Extended locale versions of these functions are documented in
-.Xr printf_l 3 .
-See
-.Xr xlocale 3
-for more information.
 .Pp
 These functions write the output under the control of a
 .Fa format
@@ -127,7 +117,7 @@
 and
 .Fn vsnprintf ,
 which return the number of characters that would have been printed if the
-.Fa n
+.Fa size
 were unlimited
 (again, not including the final
 .Ql \e0 ) .
@@ -159,14 +149,14 @@
 .Fn vsnprintf
 functions
 will write at most
-.Fa n Ns \-1
+.Fa size Ns \-1
 of the characters printed into the output string
 (the
-.Fa n Ns \'th
+.Fa size Ns 'th
 character then gets the terminating
 .Ql \e0 ) ;
 if the return value is greater than or equal to the
-.Fa n
+.Fa size
 argument, the string was too short
 and some of the printed characters were discarded.
 The output is always null-terminated.
@@ -177,11 +167,7 @@
 .Fn vsprintf
 functions
 effectively assume an infinite
-.Fa n .
-.Pp
-For those routines that write to a user-provided character string,
-that string and the format strings should not overlap, as the
-behavior is undefined.
+.Fa size .
 .Pp
 The format string is composed of zero or more directives:
 ordinary
@@ -225,7 +211,8 @@
 For
 .Cm o
 conversions, the precision of the number is increased to force the first
-character of the output string to a zero.
+character of the output string to a zero (except if a zero value is printed
+with an explicit precision of zero).
 For
 .Cm x
 and
@@ -300,20 +287,6 @@
 .Xr localeconv 3 .
 .El
 .It
-An optional separator character (
-.Cm \ , | \;  | \ : | _
-) used for separating multiple values when printing an AltiVec or SSE vector,
-or other multi-value unit.
-.Pp
-NOTE: This is an extension to the
-.Fn printf
-specification.
-Behaviour of these values for
-.Fn printf 
-is only defined for operating systems conforming to the 
-AltiVec Technology Programming Interface Manual.
-(At time of writing this includes only Mac OS X 10.2 and later.)
-.It
 An optional decimal digit string specifying a minimum field width.
 If the converted value has fewer characters than the field width, it will
 be padded with spaces on the left (or right, if the left-adjustment
@@ -392,8 +365,6 @@
 conversion:
 .Bl -column ".Sy Modifier" ".Cm a , A , e , E , f , F , g , G"
 .It Sy Modifier Ta Cm a , A , e , E , f , F , g , G
-.It Cm l No (ell) Ta Vt double
-(ignored, same behavior as without it)
 .It Cm L Ta Vt "long double"
 .El
 .Pp
@@ -405,34 +376,6 @@
 .Bl -column ".Sy Modifier" ".Vt wint_t" ".Vt wchar_t *"
 .It Sy Modifier Ta Cm c Ta Cm s
 .It Cm l No (ell) Ta Vt wint_t Ta Vt "wchar_t *"
-.El
-.Pp
-The AltiVec Technology Programming Interface Manual also defines five additional length modifiers
-which can be used (in place of the conventional length modifiers) for the printing of AltiVec or SSE vectors:
-.Bl -tag -compact
-.It Cm v
-Treat the argument as a vector value, unit length will be determined by the conversion
-specifier (default = 16 8-bit units for all integer conversions, 
-4 32-bit units for floating point conversions).
-.It Cm vh, hv
-Treat the argument as a vector of 8 16-bit units.
-.It Cm vl, lv
-Treat the argument as a vector of 4 32-bit units.
-.El
-.Pp
-NOTE: The vector length specifiers are extensions to the
-.Fn printf
-specification.
-Behaviour of these values for
-.Fn printf 
-is only defined for operating systems conforming to the 
-AltiVec Technology Programming Interface Manual.
-(At time of writing this includes only Mac OS X 10.2 and later.)
-.Pp
-As a further extension, for SSE2 64-bit units:
-.Bl -tag -compact
-.It Cm vll, llv
-Treat the argument as a vector of 2 64-bit units.
 .El
 .It
 A character that specifies the type of conversion to be applied.
@@ -574,21 +517,30 @@
 .It Cm aA
 The
 .Vt double
-argument is rounded and converted to hexadecimal notation in the style
+argument is converted to hexadecimal notation in the style
 .Sm off
 .Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \\*[Pm] Oc Ar d ,
 .Sm on
 where the number of digits after the hexadecimal-point character
 is equal to the precision specification.
-If the precision is missing, it is taken as enough to represent
-the floating-point number exactly, and no rounding occurs.
-If the precision is zero, no hexadecimal-point character appears.
+If the precision is missing, it is taken as enough to exactly
+represent the floating-point number; if the precision is
+explicitly zero, no hexadecimal-point character appears.
+This is an exact conversion of the mantissa+exponent internal
+floating point representation; the
+.Sm off
+.Oo \- Oc Li 0x Ar h Li \&. Ar hhh
+.Sm on
+portion represents exactly the mantissa; only denormalized
+mantissas have a zero value to the left of the hexadecimal
+point.
 The
 .Cm p
 is a literal character
-.Ql p ,
-and the exponent consists of a positive or negative sign
-followed by a decimal number representing an exponent of 2.
+.Ql p ;
+the exponent is preceded by a positive or negative sign
+and is represented in decimal, using only enough characters
+to represent the exponent.
 The
 .Cm A
 conversion uses the prefix
@@ -604,21 +556,6 @@
 (rather than
 .Ql p )
 to separate the mantissa and exponent.
-.Pp
-Note that there may be multiple valid ways to represent floating-point
-numbers in this hexadecimal format.
-For example,
-.Li 0x1.92p+1 , 0x3.24p+0 , 0x6.48p-1 ,
-and
-.Li 0xc.9p-2
-are all equivalent.
-The format chosen depends on the internal representation of the
-number, but the implementation guarantees that the length of the
-mantissa will be minimized.
-Zeroes are always represented with a mantissa of 0 (preceded by a
-.Ql -
-if appropriate) and an exponent of
-.Li +0 .
 .It Cm C
 Treated as
 .Cm c
@@ -830,29 +767,6 @@
 Always use the proper secure idiom:
 .Pp
 .Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);"
-.Sh COMPATIBILITY
-The conversion formats
-.Cm \&%D , \&%O ,
-and
-.Cm %U
-are not standard and
-are provided only for backward compatibility.
-The effect of padding the
-.Cm %p
-format with zeros (either by the
-.Cm 0
-flag or by specifying a precision), and the benign effect (i.e., none)
-of the
-.Cm #
-flag on
-.Cm %n
-and
-.Cm %p
-conversions, as well as other
-nonsensical combinations such as
-.Cm %Ld ,
-are not standard; such combinations
-should be avoided.
 .Sh ERRORS
 In addition to the errors documented for the
 .Xr write 2
@@ -867,12 +781,15 @@
 .El
 .Sh SEE ALSO
 .Xr printf 1 ,
-.Xr printf_l 3 ,
 .Xr fmtcheck 3 ,
 .Xr scanf 3 ,
 .Xr setlocale 3 ,
-.Xr stdarg 3 ,
 .Xr wprintf 3
+.Rs
+.%T "The FreeBSD Security Architecture"
+.Re
+(See
+.Pa "/usr/share/doc/{to be determined}" . )
 .Sh STANDARDS
 Subject to the caveats noted in the
 .Sx BUGS
@@ -894,13 +811,7 @@
 and
 .Fn vsnprintf
 functions conform to
-.St -isoC-99 ,
-while
-.Fn dprintf
-and
-.Fn vdprintf
-conform to
-.St -p1003.1-2008 .
+.St -isoC-99 .
 .Sh HISTORY
 The functions
 .Fn asprintf
@@ -918,13 +829,50 @@
 .An Todd C. Miller Aq Todd.Miller@courtesan.com
 for
 .Ox 2.3 .
-The
-.Fn dprintf
-and
-.Fn vdprintf
-functions were added in
-.Fx 8.0 .
 .Sh BUGS
+The conversion formats
+.Cm \&%D , \&%O ,
+and
+.Cm %U
+are not standard and
+are provided only for backward compatibility.
+The effect of padding the
+.Cm %p
+format with zeros (either by the
+.Cm 0
+flag or by specifying a precision), and the benign effect (i.e., none)
+of the
+.Cm #
+flag on
+.Cm %n
+and
+.Cm %p
+conversions, as well as other
+nonsensical combinations such as
+.Cm %Ld ,
+are not standard; such combinations
+should be avoided.
+.Pp
+The
+.Nm
+family of functions currently lack the ability to use the
+.Cm '
+flag in conjunction with the
+.Cm f
+conversion specifier.
+The
+.Cm a
+and
+.Cm A
+conversion specifiers have not yet been implemented.
+The
+.Cm L
+modifier for floating point formats simply round the
+.Vt "long double"
+argument to
+.Vt double ,
+providing no additional precision.
+.Pp
 The
 .Nm
 family of functions do not correctly handle multibyte characters in the