printf.1 (100045) | printf.1 (130116) |
---|---|
1.\" Copyright (c) 1989, 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the Institute of Electrical and Electronics Engineers, Inc. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" @(#)printf.1 8.1 (Berkeley) 6/6/93 | 1.\" Copyright (c) 1989, 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the Institute of Electrical and Electronics Engineers, Inc. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" @(#)printf.1 8.1 (Berkeley) 6/6/93 |
36.\" $FreeBSD: head/usr.bin/printf/printf.1 100045 2002-07-15 07:35:36Z keramida $ | 36.\" $FreeBSD: head/usr.bin/printf/printf.1 130116 2004-06-05 09:32:27Z das $ |
37.\" 38.Dd June 6, 1993 39.Dt PRINTF 1 40.Os 41.Sh NAME 42.Nm printf 43.Nd formatted output 44.Sh SYNOPSIS --- 138 unchanged lines hidden (view full) --- 183.Cm e 184and 185.Cm f 186formats, or the maximum number of characters to be printed 187from a string; if the digit string is missing, the precision is treated 188as zero; 189.It Format: 190A character which indicates the type of format to use (one of | 37.\" 38.Dd June 6, 1993 39.Dt PRINTF 1 40.Os 41.Sh NAME 42.Nm printf 43.Nd formatted output 44.Sh SYNOPSIS --- 138 unchanged lines hidden (view full) --- 183.Cm e 184and 185.Cm f 186formats, or the maximum number of characters to be printed 187from a string; if the digit string is missing, the precision is treated 188as zero; 189.It Format: 190A character which indicates the type of format to use (one of |
191.Cm diouxXfwEgGcsb ) . | 191.Cm diouxXfFeEgGaAcsb ) . 192The uppercase formats differ from their lowercase counterparts only in 193that the output of the latter is entirely in uppercase. |
192.El 193.Pp 194A field width or precision may be 195.Sq Cm \&* 196instead of a digit string. 197In this case an 198.Ar argument 199supplies the field width or precision. 200.Pp 201The format characters and their meanings are: 202.Bl -tag -width Fl 203.It Cm diouXx 204The 205.Ar argument 206is printed as a signed decimal (d or i), unsigned octal, unsigned decimal, 207or unsigned hexadecimal (X or x), respectively. | 194.El 195.Pp 196A field width or precision may be 197.Sq Cm \&* 198instead of a digit string. 199In this case an 200.Ar argument 201supplies the field width or precision. 202.Pp 203The format characters and their meanings are: 204.Bl -tag -width Fl 205.It Cm diouXx 206The 207.Ar argument 208is printed as a signed decimal (d or i), unsigned octal, unsigned decimal, 209or unsigned hexadecimal (X or x), respectively. |
208.It Cm f | 210.It Cm fF |
209The 210.Ar argument 211is printed in the style `[\-]ddd.ddd' where the number of d's 212after the decimal point is equal to the precision specification for 213the argument. 214If the precision is missing, 6 digits are given; if the precision 215is explicitly 0, no digits and no decimal point are printed. | 211The 212.Ar argument 213is printed in the style `[\-]ddd.ddd' where the number of d's 214after the decimal point is equal to the precision specification for 215the argument. 216If the precision is missing, 6 digits are given; if the precision 217is explicitly 0, no digits and no decimal point are printed. |
218The values \*[If] and \*[Na] are printed as 219.Ql inf 220and 221.Ql nan , 222respectively. |
|
216.It Cm eE 217The 218.Ar argument 219is printed in the style 220.Cm e 221.Sm off 222.Sq Op - Ar d.ddd No \(+- Ar dd 223.Sm on 224where there 225is one digit before the decimal point and the number after is equal to 226the precision specification for the argument; when the precision is 227missing, 6 digits are produced. | 223.It Cm eE 224The 225.Ar argument 226is printed in the style 227.Cm e 228.Sm off 229.Sq Op - Ar d.ddd No \(+- Ar dd 230.Sm on 231where there 232is one digit before the decimal point and the number after is equal to 233the precision specification for the argument; when the precision is 234missing, 6 digits are produced. |
228An upper-case E is used for an `E' format. | 235The values \*[If] and \*[Na] are printed as 236.Ql inf 237and 238.Ql nan , 239respectively. |
229.It Cm gG 230The 231.Ar argument 232is printed in style 233.Cm f | 240.It Cm gG 241The 242.Ar argument 243is printed in style 244.Cm f |
245.Pq Cm F |
|
234or in style 235.Cm e 236.Pq Cm E 237whichever gives full precision in minimum space. | 246or in style 247.Cm e 248.Pq Cm E 249whichever gives full precision in minimum space. |
250.It Cm aA 251The 252.Ar argument 253is printed in style 254.Sm off 255.Sq Op - Ar h.hhh No \(+- Li p Ar d 256.Sm on 257where there is one digit before the hexadecimal point and the number 258after is equal to the precision specification for the argument; 259when the precision is missing, enough digits are produced to convey 260the argument's exact double-precision floating-point representation. 261The values \*[If] and \*[Na] are printed as 262.Ql inf 263and 264.Ql nan , 265respectively. |
|
238.It Cm c 239The first character of 240.Ar argument 241is printed. 242.It Cm s 243Characters from the string 244.Ar argument 245are printed until the end is reached or until the number of characters --- 58 unchanged lines hidden --- | 266.It Cm c 267The first character of 268.Ar argument 269is printed. 270.It Cm s 271Characters from the string 272.Ar argument 273are printed until the end is reached or until the number of characters --- 58 unchanged lines hidden --- |