Annotation of researchv10dc/dist/man/v4/man3/printf.3, revision 1.1.1.1

1.1       root        1: .th PRINTF III 9/17/73
                      2: .sh NAME
                      3: printf \*- formatted print
                      4: .sh SYNOPSIS
                      5: .ft B
                      6: printf(format, arg\s6\d1\u\s10, ...);
                      7: .br
                      8: char *format;
                      9: .ft R
                     10: .sh DESCRIPTION
                     11: .it Printf
                     12: converts, formats, and prints its arguments after the first
                     13: under control of the first argument.
                     14: The first argument is a character string
                     15: which contains
                     16: two types of objects:
                     17: plain characters, which are simply copied to the
                     18: output stream,
                     19: and conversion specifications,
                     20: each of which causes conversion and printing
                     21: of the next successive argument to
                     22: .it printf.
                     23: .s3
                     24: Each conversion specification is introduced by
                     25: the character \fB%\fR.
                     26: Following the \fB%\fR, there may be
                     27: .s3
                     28: .lp +6 2
                     29: \*-    an optional minus sign `\*-' which specifies
                     30: .it "left adjustment"
                     31: of the converted argument
                     32: in the
                     33: indicated field;
                     34: .s3
                     35: .lp +6 2
                     36: \*-    an optional digit string specifying a
                     37: .it "field width;"
                     38: if the converted argument has fewer characters
                     39: than the field width
                     40: it will be blank-padded on the left (or right,
                     41: if the left-adjustment indicator has been
                     42: given) to make up the field width;
                     43: .s3
                     44: .lp +6 2
                     45: \*-    an optional period ``\fB.\fR'' which serves to
                     46: separate the field width from the
                     47: next digit string;
                     48: .s3
                     49: .lp +6 2
                     50: \*-    an optional digit string
                     51: .it "(precision)"
                     52: which specifies
                     53: the number of digits to appear after the
                     54: decimal point, for e- and f-conversion,
                     55: or the maximum number of characters
                     56: to be printed from a string;
                     57: .s3
                     58: .lp +6 2
                     59: \*-    a character which indicates the type of
                     60: conversion to be applied.
                     61: .s3
                     62: .i0
                     63: The conversion characters
                     64: and their meanings are
                     65: .s3
                     66: .lp +6 3
                     67: d      The argument is converted to decimal notation.
                     68: .s3
                     69: .lp +6 3
                     70: o      The argument is converted to octal notation.
                     71: ``0'' will always appear as the first digit.
                     72: .s3
                     73: .lp +6 3
                     74: f      The argument is converted to decimal notation
                     75: in the style ``[\fB\*-\fR]ddd.ddd''
                     76: where the number of d's after the decimal point
                     77: is equal to the precision specification
                     78: for the argument.
                     79: If the precision
                     80: is missing,
                     81: 6 digits are given;
                     82: if the precision is explicitly 0, no digits and
                     83: no decimal point are printed.
                     84: The argument should be
                     85: .it float
                     86: or
                     87: .it double.
                     88: .s3
                     89: .lp +6 3
                     90: e      The argument is converted in the style
                     91: ``[\fB\*-\fR]d\fB.\fRddd\fBe\fR\(+-dd''
                     92: where there is one digit before the decimal point and
                     93: the number after is equal to the
                     94: precision specification for the argument;
                     95: when the precision is missing,
                     96: 6 digits are produced.
                     97: The argument should be a
                     98: .it float
                     99: or
                    100: .it double
                    101: quantity.
                    102: .s3
                    103: .lp +6 3
                    104: c      The argument character or character-pair is printed if non-null.
                    105: .s3
                    106: .lp +6 3
                    107: s      The argument is taken to be a string (character pointer)
                    108: and characters from the string are printed until
                    109: a null character or until
                    110: the number of characters indicated by the precision
                    111: specification is reached;
                    112: however if the precision is 0 or missing
                    113: all characters up to a null are printed.
                    114: .s3
                    115: .lp +6 3
                    116: l      The argument is taken to be an unsigned
                    117: integer which is converted to decimal
                    118: and printed (the result will be in the
                    119: range 0 to 65535).
                    120: .s3
                    121: .i0
                    122: If no recognizable character appears after the \fB%\fR,
                    123: that character is printed;
                    124: thus \fb%\fR may be printed by use of the
                    125: string \fB%%\fR.
                    126: In no case does a non-existent or small field width
                    127: cause truncation of a field;
                    128: padding takes place only if the specified field
                    129: width exceeds the actual width.
                    130: Characters generated by
                    131: .it printf
                    132: are printed by calling
                    133: .it putchar.
                    134: .sh "SEE ALSO"
                    135: putchar (III)
                    136: .sh BUGS
                    137: Very wide fields (>128 characters) fail.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.