home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
TOP
/
USR
/
MAN
/
printf.man
< prev
next >
Wrap
Text File
|
2009-11-06
|
3KB
|
151 lines
Page 1 (printed 1/10/89)
PRINTF(1) OS9/68000 V2.1 (8-Jan-1987) PRINTF(1)
NAME
printf - formatted output at shell command level
SYNOPSIS
pprriinnttff _f_o_r_m_a_t-_s_t_r_i_n_g [ _a_r_g_1 ] [ _a_r_g_2 ] ...
DESCRIPTION
_P_r_i_n_t_f duplicates (as far as possible) the standard C
library routine of the same name, at the shell command
level. It is similar to _e_c_h_o, except that it formats its
arguments according to conversion specifications given in
the _f_o_r_m_a_t-_s_t_r_i_n_g before writing them to the standard
output. For a thorough explanation of format
specifications, see _p_r_i_n_t_f(3s).
For the sake of perversity, _p_r_i_n_t_f implements one format
conversion nnoott supported by the standard printf subroutine:
the %_r and %_R conversions, which print integers as Roman
numerals. The first format produces lowercase, and the
second uppercase.
As a convenience, within the _f_o_r_m_a_t-_s_t_r_i_n_g and any string or
character arguments, _p_r_i_n_t_f converts ``backslash notation''
- as defined in the draft proposed ANSI C Standard X3J11 -
into the appropriate control characters. The Standard
provides for hexadecimal escapes as ``\x1a2F3c4...'', in
which the only way to terminate the escape is with a non-
hexadecimal character. This is not always suitable outside
the C language, so _p_r_i_n_t_f provides one additional escape,
\\&&, which expands to nothing, but in so doing serves to
terminate a hexadecimal escape.
EXAMPLES
% printf 'Today is %s the %d of %s.\n' Monday 1 April
Today is Monday the 1 of April.
% printf 'Interesting Numbers\n\n\tPie: %*.*f\n\tFoo: %g\n' \
6 4 3.14159265 42
Interesting Numbers
Pie: 3.1416
Foo: 42
% printf '%s %d, %R\n' July 4 1776
July 4, MDCCLXXVI
% printf 'in ASCII this prints dd: \x64\&d.\n'
in ASCII this prints dd: dd.
AUTHORS
Page 1 (printed 1/10/89)
PRINTF(1) OS9/68000 V2.1 (8-Jan-1987) PRINTF(1)
Fred Blonder <fred@mimsy.umd.edu>
Chris Torek <chris@mimsy.umd.edu>
SEE ALSO
echo(1), printf(3s)
BUGS
The Roman conversions are not strictly correct. Zero
produces no text; very large values give the complaint
``abortive Roman numeral''. Negative Roman numerals are
printed with a leading minus sign. It is unclear what the
Romans did in such cases, although zero could perhaps be
written as ``nihil''. Values in the millions were sometimes
written using an M with an overbar, but there is no bar-M
character in ASCII.
The ``%n'' conversion is unimplementable. The number of
characters written is not returned. Long double formats are
not supported.
Page 2 (printed 1/10/89)