Print this page
4023 - Typo in file(1) manpage and various others

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/printf.1
          +++ new/usr/src/man/man1/printf.1
↓ open down ↓ 630 lines elided ↑ open up ↑
 631  631  .sp
 632  632  .LP
 633  633  The \fBprintf\fR utility supports an alternative floating point representation
 634  634  (see \fBprintf\fR(3C) entry for the "\fB%a\fR"/"\fB%A\fR"), which allows the
 635  635  output of floating-point values in a format that avoids the usual base16 to
 636  636  base10 rounding errors.
 637  637  
 638  638  .sp
 639  639  .in +2
 640  640  .nf
 641      -example% printf "%a\n" 2 3.1 NaN
      641 +example% printf "%a\en" 2 3.1 NaN
 642  642  .fi
 643  643  .in -2
 644  644  .sp
 645  645  
 646  646  .sp
 647  647  .LP
 648  648  produces:
 649  649  
 650  650  .sp
 651  651  .in +2
↓ open down ↓ 8 lines elided ↑ open up ↑
 660  660  .LP
 661  661  \fBExample 7 \fRAlternative floating point representation 2
 662  662  .sp
 663  663  .LP
 664  664  The following example shows two different representations of the same
 665  665  floating-point value.
 666  666  
 667  667  .sp
 668  668  .in +2
 669  669  .nf
 670      -example% x=2 ; printf "%f == %a\n" x x
      670 +example% x=2 ; printf "%f == %a\en" x x
 671  671  .fi
 672  672  .in -2
 673  673  .sp
 674  674  
 675  675  .sp
 676  676  .LP
 677  677  produces:
 678  678  
 679  679  .sp
 680  680  .in +2
↓ open down ↓ 5 lines elided ↑ open up ↑
 686  686  
 687  687  .LP
 688  688  \fBExample 8 \fROutput of unicode values
 689  689  .sp
 690  690  .LP
 691  691  The following command will print the EURO unicode symbol (code-point 0x20ac).
 692  692  
 693  693  .sp
 694  694  .in +2
 695  695  .nf
 696      -example% LC_ALL=en_US.UTF-8 printf "\u[20ac]\n"
      696 +example% LC_ALL=en_US.UTF-8 printf "\u[20ac]\en"
 697  697  .fi
 698  698  .in -2
 699  699  .sp
 700  700  
 701  701  .sp
 702  702  .LP
 703  703  produces:
 704  704  
 705  705  .sp
 706  706  .in +2
↓ open down ↓ 10 lines elided ↑ open up ↑
 717  717  .LP
 718  718  \fBExample 9 \fRConvert unicode character to unicode code-point value
 719  719  .sp
 720  720  .LP
 721  721  The following command will print the hexadecimal value of a given character.
 722  722  
 723  723  .sp
 724  724  .in +2
 725  725  .nf
 726  726  example% export LC_ALL=en_US.UTF-8
 727      -example% printf "%x\n" "'<euro>"
      727 +example% printf "%x\en" "'<euro>"
 728  728  .fi
 729  729  .in -2
 730  730  .sp
 731  731  
 732  732  .sp
 733  733  .LP
 734  734  where "<euro>" represents the EURO currency symbol character (code-point
 735  735  0x20ac).
 736  736  
 737  737  .sp
↓ open down ↓ 6 lines elided ↑ open up ↑
 744  744  20ac
 745  745  .fi
 746  746  .in -2
 747  747  .sp
 748  748  
 749  749  .LP
 750  750  \fBExample 10 \fRPrint the numeric value of an ASCII character
 751  751  .sp
 752  752  .in +2
 753  753  .nf
 754      -example% printf "%d\n" "'A"
      754 +example% printf "%d\en" "'A"
 755  755  .fi
 756  756  .in -2
 757  757  .sp
 758  758  
 759  759  .sp
 760  760  .LP
 761  761  produces:
 762  762  
 763  763  .sp
 764  764  .in +2
↓ open down ↓ 30 lines elided ↑ open up ↑
 795  795  .in -2
 796  796  .sp
 797  797  
 798  798  .sp
 799  799  .LP
 800  800  For American usage, format could be the string:
 801  801  
 802  802  .sp
 803  803  .in +2
 804  804  .nf
 805      -"%s, %s %d, %d:%.2d\n"
      805 +"%s, %s %d, %d:%.2d\en"
 806  806  .fi
 807  807  .in -2
 808  808  .sp
 809  809  
 810  810  .sp
 811  811  .LP
 812  812  producing the message:
 813  813  
 814  814  .sp
 815  815  .in +2
↓ open down ↓ 3 lines elided ↑ open up ↑
 819  819  .in -2
 820  820  .sp
 821  821  
 822  822  .sp
 823  823  .LP
 824  824  Whereas for EU usage, format could be the string:
 825  825  
 826  826  .sp
 827  827  .in +2
 828  828  .nf
 829      -"%1$s, %3$d. %2$s, %4$d:%5$.2d\n"
      829 +"%1$s, %3$d. %2$s, %4$d:%5$.2d\en"
 830  830  .fi
 831  831  .in -2
 832  832  .sp
 833  833  
 834  834  .sp
 835  835  .LP
 836  836  Note that the '$' characters must be properly escaped, such as
 837  837  
 838  838  .sp
 839  839  .in +2
 840  840  .nf
 841      -"%1\$s, %3\$d. %2\$s, %4\$d:%5\$.2d\n" in this case
      841 +"%1\$s, %3\$d. %2\$s, %4\$d:%5\$.2d\en" in this case
 842  842  .fi
 843  843  .in -2
 844  844  .sp
 845  845  
 846  846  .sp
 847  847  .LP
 848  848  producing the message:
 849  849  
 850  850  .sp
 851  851  .in +2
↓ open down ↓ 71 lines elided ↑ open up ↑
 923  923  \fBawk\fR(1), \fBbc\fR(1), \fBdate\fR(1), \fBecho\fR(1), \fBksh93\fR(1),
 924  924  \fBprintf\fR(3C), \fBstrtod\fR(3C), \fBstrtol\fR(3C), \fBstrtoul\fR(3C),
 925  925  \fBattributes\fR(5), \fBenviron\fR(5), \fBformats\fR(5), \fBstandards\fR(5)
 926  926  .SH NOTES
 927  927  .sp
 928  928  .LP
 929  929  Using format specifiers (characters following '%') which are not listed in the
 930  930  \fBprintf\fR(3C) or this manual page will result in undefined behavior.
 931  931  .sp
 932  932  .LP
 933      -Using escape sequences (the character following a backslash ('\')) which are
      933 +Using escape sequences (the character following a backslash ('\e')) which are
 934  934  not listed in the \fBprintf\fR(3C) or this manual page will result in undefined
 935  935  behavior.
 936  936  .sp
 937  937  .LP
 938  938  Floating-point values follow C99, XPG6 and IEEE 754 standard behavior and can
 939  939  handle values the same way as the platform's |\fBlong double\fR| datatype.
 940  940  .sp
 941  941  .LP
 942  942  Floating-point values handle the sign separately which allows signs for values
 943  943  like NaN (for example, -nan), Infinite (for example, -inf) and zero (for
 944  944  example, -0.0).
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX