diff --git a/usr.bin/printf/printf.1 b/usr.bin/printf/printf.1 index 40f4dee2d7c1..76afe0c3dc27 100644 --- a/usr.bin/printf/printf.1 +++ b/usr.bin/printf/printf.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: printf.1,v 1.18 2003/04/28 09:26:34 augustss Exp $ +.\" $NetBSD: printf.1,v 1.19 2003/04/28 09:38:19 wiz Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -65,7 +65,7 @@ after the first are treated as strings if the corresponding format is either .Cm b , .Cm B , -.Cm c +.Cm c , or .Cm s ; otherwise it is evaluated as a C constant, with the following extensions: @@ -89,25 +89,45 @@ Character escape sequences are in backslash notation as defined in The characters and their meanings are as follows: .Bl -tag -width Ds -offset indent .It Cm \ee -Write an \*[Lt]escape\*[Gt] character. +Write an +.Aq escape +character. .It Cm \ea -Write a \*[Lt]bell\*[Gt] character. +Write a +.Aq bell +character. .It Cm \eb -Write a \*[Lt]backspace\*[Gt] character. +Write a +.Aq backspace +character. .It Cm \ef -Write a \*[Lt]form-feed\*[Gt] character. +Write a +.Aq form-feed +character. .It Cm \en -Write a \*[Lt]new-line\*[Gt] character. +Write a +.Aq new-line +character. .It Cm \er -Write a \*[Lt]carriage return\*[Gt] character. +Write a +.Aq carriage return +character. .It Cm \et -Write a \*[Lt]tab\*[Gt] character. +Write a +.Aq tab +character. .It Cm \ev -Write a \*[Lt]vertical tab\*[Gt] character. +Write a +.Aq vertical tab +character. .It Cm \e\' -Write a \*[Lt]single quote\*[Gt] character. +Write a +.Aq single quote +character. .It Cm \e" -Write a \*[Lt]double quote\*[Gt] character. +Write a +.Aq double quote +character. .It Cm \e\e Write a backslash character. .It Cm \e Ns Ar num @@ -123,15 +143,17 @@ value is the 1\- or 2\-digit hexadecimal number .El .Pp Each format specification is introduced by the percent character -(``%''). +.Pq Dq \&% . The remainder of the format specification includes, in the following order: .Bl -tag -width Ds -.It "Zero or more of the following flags:" +.It Zero or more of the following flags : .Bl -tag -width Ds .It Cm # -A `#' character -specifying that the value should be printed in an ``alternative form''. +A +.Sq # +character specifying that the value should be printed in an +.Dq alternative form . For .Cm b , .Cm c , @@ -151,9 +173,9 @@ format, a non-zero result has the string .Pq Li 0X prepended to it. For -.Cm e , +.Cm e , .Cm E , -.Cm f , +.Cm f , .Cm g , and .Cm G @@ -171,22 +193,32 @@ would otherwise be. .\" .Cm B .\" format, backslash-escape sequences are expanded first; .It Cm \&\- -A minus sign `\-' which specifies +A minus sign +.Sq \- +which specifies .Em left adjustment of the output in the indicated field; .It Cm \&+ -A `+' character specifying that there should always be +A +.Sq \&+ +character specifying that there should always be a sign placed before the number when using signed formats. .It Sq \&\ \& A space specifying that a blank should be left before a positive number for a signed format. -A `+' overrides a space if both are used; +A +.Sq \&+ +overrides a space if both are used; .It Cm \&0 A zero `0' character indicating that zero-padding should be used rather than blank-padding. -A `\-' overrides a `0' if both are used; +A +.Sq \- +overrides a +.Sq \&0 +if both are used; .El -.It "Field Width:" +.It Field Width : An optional digit string specifying a .Em field width ; if the output string has fewer characters than the field width it will @@ -195,7 +227,7 @@ has been given) to make up the field width (note that a leading zero is a flag, but an embedded zero is part of a field width); .It Precision : An optional period, -.Sq Cm \&.\& , +.Sq Cm \&. , followed by an optional digit string giving a .Em precision which specifies the number of digits to appear after the decimal point, @@ -206,9 +238,9 @@ and formats, or the maximum number of characters to be printed from a string .Sm off -.Pf ( Cm b No , +.Pf ( Cm b , .Sm on -.Cm B +.Cm B , and .Cm s formats); if the digit string is missing, the precision is treated @@ -255,7 +287,9 @@ where there is one digit before the decimal point and the number after is equal to the precision specification for the argument; when the precision is missing, 6 digits are produced. -An upper-case E is used for an `E' format. +An upper-case E is used for an +.Sq E +format. .It Cm gG The .Ar argument @@ -285,16 +319,16 @@ value is the 1\-, 2\-, or 3\-digit octal number .Ar num . .It Cm \e^ Ns Ar c -Write the control character +Write the control character .Ar c . Generates characters `\e000' through `\e037`, and `\e177' (from `\e^?'). .It Cm \eM\- Ns Ar c -Write the character +Write the character .Ar c with the 8th bit set. Generates characters `\e241' through `\e376`. .It Cm \eM^ Ns Ar c -Write the control character +Write the control character .Ar c with the 8th bit set. Generates characters `\e000' through `\e037`, and `\e177' (from `\eM^?'). @@ -334,8 +368,8 @@ exits 0 on success, 1 on failure. .Sh SEE ALSO .Xr echo 1 , .Xr printf 3 , -.Xr printf 9 , -.Xr vis 3 +.Xr vis 3 , +.Xr printf 9 .Sh STANDARDS The .Nm @@ -354,5 +388,6 @@ to floating-point and then back again, floating-point precision may be lost. .Pp Hexadecimal character constants are restricted to, and should be specified -as, two character constants. This is contrary to the ISO C standard but +as, two character constants. +This is contrary to the ISO C standard but does guarantee detection of the end of the constant.