summaryrefslogtreecommitdiff
path: root/usr.bin/printf/printf.1
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>1998-11-30 01:48:03 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>1998-11-30 01:48:03 +0000
commit88a1d5b7471e69e60bf090a6131abd8803f3bf28 (patch)
tree8bc3f4e5ca5683aee03caf858aaf9853629a6711 /usr.bin/printf/printf.1
parent9794a5ea4dc5a36c127d8e449600b6afc8793dd3 (diff)
cleanup; also note that ``0'' flag is ignored when used with a precision
specifier and any of the d, i, o, u, or x (X) formats, as per gcc warnings
Diffstat (limited to 'usr.bin/printf/printf.1')
-rw-r--r--usr.bin/printf/printf.164
1 files changed, 43 insertions, 21 deletions
diff --git a/usr.bin/printf/printf.1 b/usr.bin/printf/printf.1
index 0779c2d03e2..e40af5bb4d3 100644
--- a/usr.bin/printf/printf.1
+++ b/usr.bin/printf/printf.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: printf.1,v 1.5 1998/09/27 16:57:50 aaron Exp $
+.\" $OpenBSD: printf.1,v 1.6 1998/11/30 01:48:02 aaron Exp $
.\" Copyright (c) 1989, 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
@@ -61,7 +61,6 @@ each of which causes printing of the next successive
The
.Ar arguments
after the first are treated as strings if the corresponding format is
-either
.Cm b ,
.Cm c
or
@@ -115,24 +114,25 @@ octal number
.Ar num .
.El
.Pp
-Each format specification is introduced by the percent character
-(``%'').
+Each format specification is introduced by the percent
+.Pq Sq \&%
+character.
The remainder of the format specification includes,
in the following order:
.Bl -tag -width Ds
.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 ``alternate form''.
-For
+Specifies that the value should be printed in an
+.Dq alternate form .
+For the
.Cm c ,
.Cm d ,
and
.Cm s
formats, this option has no effect. For the
.Cm o
-formats the precision of the number is increased to force the first
+format the precision of the number is increased to force the first
character of the output string to a zero. For the
.Cm x
.Pq Cm X
@@ -155,18 +155,30 @@ and
formats, trailing zeros are not removed from the result as they
would otherwise be.
.It Cm \&\-
-A minus sign `\-' which specifies
+Specifies the
.Em left adjustment
of the output in the indicated field.
.It Cm \&+
-A `+' character specifying that there should always be
+Specifies 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 space specifies that a blank should be left before a positive number
+for a signed format. A
+.Dq +
+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 zero character specifies that zero-padding should be used
+rather than blank-padding. This flag is ignored if used with a precision
+specifier and any of the
+.Cm d , i , o , u ,
+or
+.Cm x
+.Pq Cm X
+formats. A
+.Dq \&-
+overrides a
+.Dq \&0
+if both are used.
.El
.It "Field Width:"
An optional digit string specifying a
@@ -176,8 +188,8 @@ be blank-padded on the left (or right, if the left-adjustment indicator
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 \&.\& ,
+An optional period
+.Pq Sq \&. ,
followed by an optional digit string giving a
.Em precision
which specifies the number of digits to appear after the decimal point,
@@ -194,7 +206,7 @@ A character which indicates the type of format to use (one of
.El
.Pp
A field width or precision may be
-.Sq Cm \&*
+.Dq \&*
instead of a digit string.
In this case an
.Ar argument
@@ -205,8 +217,12 @@ The format characters and their meanings are:
.It Cm diouXx
The
.Ar argument
-is printed as a signed decimal (d or i), unsigned octal, unsigned decimal,
-or unsigned hexadecimal (X or x), respectively.
+is printed as a signed decimal
+.Pq Cm d No or Cm i ,
+unsigned octal, unsigned decimal,
+or unsigned hexadecimal
+.Pq Cm x No or Cm X ,
+respectively.
.It Cm f
The
.Ar argument
@@ -230,7 +246,11 @@ 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
+.Dq E
+is used for an
+.Cm E
+format.
.It Cm gG
The
.Ar argument
@@ -255,7 +275,9 @@ are printed until the end is reached or until the number of characters
indicated by the precision specification is reached; however if the
precision is 0 or missing, all characters in the string are printed.
.It Cm \&%
-Print a `%'; no argument is used.
+Print a
+.Dq \&% ;
+no argument is used.
.El
.Pp
In no case does a non-existent or small field width cause truncation of