Commit Graph

69 Commits

Author SHA1 Message Date
stefanf
8a5d448587 Prefer {u,}intmax_t over the deprecated {u_,}quad_t. 2005-08-05 08:18:00 +00:00
ru
19aa3916e2 Markup and wording fixes.
Approved by:	re (blanket)
2005-06-14 11:50:53 +00:00
ru
0491ba1f63 Sync program's usage() with manpage's SYNOPSIS. 2005-05-21 09:55:10 +00:00
stefanf
15966b5041 Update the bugs section, null characters in the format string are now handled. 2005-04-14 18:29:59 +00:00
stefanf
2fed363379 Handle null characters in the format string. A \0 in the argument passed to %b
still results in trucation but this is be much harder to fix.
2005-04-14 17:02:34 +00:00
stefanf
0a2e28c772 No reason to write \a and \v as octal escape sequences. 2005-04-14 15:32:21 +00:00
stefanf
ff75aa6dbd Printf(1) is WARNS 6 clean. 2005-04-14 08:43:36 +00:00
stefanf
0d769accf3 - Move parts of the long main() function into a new function doformat().
- Rewrite the loop in main() to be more understandable.
2005-04-14 08:40:28 +00:00
stefanf
fd79e6a683 Assign 0.0 to the variable passed to getfloating() if the argument is missing.
MFC after:	1 week
2005-04-13 19:54:03 +00:00
stefanf
aed8bcfc2b Replace buggy for-loops to skip certain character with strspn(). If *fmt was
'\0' (eg in the invocation 'printf %'), the for-loop would miss the terminating
null character.

MFC after:	1 week
2005-04-11 10:57:54 +00:00
das
f5e55fd604 Support the L modifier for floating-point values as an extension.
When L is omitted, double precision is used, so printf(1) gives
reproducable results.  When L is specified, long double precision is
used, which may improve precision, depending on the machine.
2005-03-21 08:01:09 +00:00
ru
6cc4b6c220 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
keramida
23afcbf88f Allow %' to be used as a format flag by printf(1). This makes it
possible to print the thousands separator in the locale setups that
have one, by something like this:

    $ env -i LC_NUMERIC=en_US.ISO8859-1 ./printf "%'0.2f\n" 12345
    12,345.00

Reviewed by:	das
2004-09-24 18:20:43 +00:00
tjr
687462c4b8 Fix a markup nit and a misplaced full stop in previous.
Noticed by:	ru
2004-07-03 07:07:11 +00:00
tjr
c9e47db057 Document missing multibyte character support in utilities specified
by POSIX.
2004-07-03 01:28:21 +00:00
ru
ee5b7e52fa Deal with double whitespace. 2004-07-03 00:24:45 +00:00
ru
fb1d8b3724 Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
das
a6d089f2e7 s/latter/former/ 2004-06-05 09:35:44 +00:00
das
7bf85668ce - Document the %a, %A, and %F format specifiers.
- Document the way infinity and NaN are printed.
- Un-document the non-existent %w specifier.
2004-06-05 09:32:27 +00:00
das
56a075674a Enable support for the %a, %A, and %F format specifiers. 2004-06-05 09:32:17 +00:00
cperciva
41b17057ef Make it possible for the %[eEfgG] formats to not result in an error
being reported by /usr/bin/printf.

This bug has been around for 22 months... either nobody uses printf
with floating-point values, or people are forgetting to check their
return codes.

Approved by:	rwatson (mentor)
2004-03-07 22:22:13 +00:00
dwmalone
b4339b74ad ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
keramida
bfae74eab6 Kill excessive whitespace between macro arguments. 2002-07-15 07:35:36 +00:00
tjr
aff5678b6e Fix duplicate % in %b format introduced in rev 1.22. 2002-06-19 09:42:20 +00:00
tjr
80af7bc382 Let printf(1) tell the difference between zero width/precision and
unspecified width/precision.

PR:		39116
Submitted by:	Egil Brendsdal <egilb@ife.no>
MFC after:	1 week
2002-06-19 09:24:30 +00:00
tjr
2b21f1a948 Allow format strings containing "%%" to be reused.
PR:		39116
Submitted by:	Egil Brendsdal <egilb@ife.no>
MFC after:	1 week
2002-06-19 08:18:37 +00:00
tjr
95dac58041 Allow `%' to be written out with an octal escape (\45 or \045).
PR:		39116
Submitted by:	Egil Brendsdal <egilb@ife.no>
MFC after:	1 week
2002-06-19 08:16:14 +00:00
keramida
2040c65feb Typo: characer -> character 2002-05-31 00:33:40 +00:00
ru
4334e7515f mdoc(7) police: lint. 2002-05-30 05:59:25 +00:00
tjr
12a8faa64a Handle numbers larger than QUAD_MAX for unsigned conversions correctly.
Exit with nonzero status if a conversion failed.
Play nice if used as a shell builtin (currently disabled).

Submitted by:	bde (partially)
Approved by:	mike
2002-04-25 01:10:11 +00:00
jmallett
d1fecdf4b5 - printf shouldn't bail out if a conversion fails, it should just keep
processing them.
 - \c escape to immediately stop output (similar to echo's \c)
 - \0NNN should be allowed for octal character escapes (instead of just \NNN)
 - %b conversion, which is like %s but interprets \n \t etc. inside the
   string is missing.

And I may not be any poet, but in lieu of an in-tree regression test:
ref5% ./printf '%s%b%b%c%s%d\n' 'PR' '\0072' '\t' '3' '56' 0x10
PR:     35616

Submitted by:	tjr
MFC after:	1 week
2002-04-23 02:56:16 +00:00
charnier
ad8a79e6a5 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
imp
1698cb216e remove __P 2002-03-22 01:33:25 +00:00
markm
ae2558974f Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
ru
40760c8180 Replace reference to ANSI C draft with standard.
PR:		docs/30731
2002-01-16 14:55:18 +00:00
dwmalone
d9613ea383 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
dwmalone
71a3cce2f6 Warns cleanups. 2001-12-03 21:27:45 +00:00
dd
4ee088e5a0 The RETURN VALUES section is not appropriate for section 1 manual
pages; rename it to DIAGNOSTICS.  Also use the .Ex macro while I'm
here.
2001-11-23 14:40:35 +00:00
knu
96265e088e Remove the printf builtin command from sh(1), which command is not
used so often that it's worth keeping it as a builtin.

Now that all the printf invocations from within the system startup
scripts, we can safely remove it.

Urged by:	sheldonh  :)

No MFC is planned so far because it may break compatibility and
violate POLA.
2001-11-20 18:33:59 +00:00
dd
911ca14c87 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
ru
05e503d80a mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2). 2001-07-06 16:46:48 +00:00
ru
491030fdcc mdoc(7) police: mark LC_NUMERIC with .Dv. 2001-02-10 10:26:52 +00:00
ache
1f66809615 Localize it (LC_NUMERIC) 2001-02-10 06:49:53 +00:00
ben
fde2e04b05 Fix printf(1) for cases where a long string with no format specifiers is
followed by a %d (probably others too) format specifier.

Reviewed by:	audit
2000-12-21 22:21:38 +00:00
ru
e6cfc0711d Prepare for mdoc(7)NG. 2000-12-19 16:00:12 +00:00
imp
01ea63e213 When we have both a rcsid and sccsid, ifdef 0 the sccsid. This
appears to be the standard FreeBSD way to do this.  style(9) is silent
about this, however.
2000-09-04 06:11:25 +00:00
chris
d0352e3c5f Revert to 1.8. I misread the sentence and its context. 2000-07-21 20:18:50 +00:00
chris
2f75b144c5 Properly document %.0f behavior. 2000-07-21 20:04:58 +00:00
se
26c685c42a Extend to deal with 64 bit numeric arguments. 2000-07-10 21:32:41 +00:00
cracauer
582b546eb7 Remove redundat extern declaration 2000-04-20 09:31:54 +00:00