Commit Graph

26 Commits

Author SHA1 Message Date
David Malone
f4ac32def2 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
Tim J. Robbins
12e8db4067 Fix duplicate % in %b format introduced in rev 1.22. 2002-06-19 09:42:20 +00:00
Tim J. Robbins
98dd638658 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
Tim J. Robbins
5f19035b04 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
Tim J. Robbins
37fd459046 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
Tim J. Robbins
bacab7d655 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
Juli Mallett
ab5a295bdc - 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
Warner Losh
d3cb5ded92 remove __P 2002-03-22 01:33:25 +00:00
David Malone
45af1a4cbd Warns cleanups. 2001-12-03 21:27:45 +00:00
Andrey A. Chernov
dc7d8c99d0 Localize it (LC_NUMERIC) 2001-02-10 06:49:53 +00:00
Ben Smithurst
3c6e4a5c16 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
Warner Losh
c9e0534901 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
Stefan Eßer
62a721e79c Extend to deal with 64 bit numeric arguments. 2000-07-10 21:32:41 +00:00
Martin Cracauer
1ea7321b72 Remove redundat extern declaration 2000-04-20 09:31:54 +00:00
Bruce Evans
3b53d3803e Fixed warnx format errors in printf and csh, and snprintf format errors
in sh, by using separate macros for the 1, 2 and 3-arg calls to warnx.
(The 3-arg warnx macro in sh/bltin/bltin.h used to require bogus dummy
args.)
1998-12-07 12:14:04 +00:00
John Polstra
b0c9a86d12 Back out revision 1.10. It broke the build of sh, which compiles
this file with warnx() defined as a macro.
1997-11-18 15:23:23 +00:00
John Polstra
c8a2e15007 Fix: too many arguments for format string in 4 calls to warnx(). 1997-11-18 05:45:19 +00:00
Steve Price
9d19feb501 #include <unistd.h> for getopt(3) call. 1997-08-07 21:47:31 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Steve Price
3ec30b7943 -Wall cleaning. 1996-12-14 05:32:27 +00:00
Steve Price
e6068a345f Remove annoying -Wall warning. 1996-10-06 02:40:39 +00:00
Peter Wemm
d72f654c65 When used as a shell builtin, this program decoded a subset of arguments
known to printf(3) and then used printf() to format it... The only
problem what the #define printf out1fmt.  The code was behaving differently
when run as a shell builtin since out1fmt() isn't printf(3).

Simple hack.  Print to a buffer and fputs (also #defined for sh) the
result.  This should fix the printf builtin problem in PR#1673, rather
than leaving the call commented out.  (printf.o was being statically linked
in anyway, we might as well use it)
1996-10-01 04:56:59 +00:00
Joerg Wunsch
d9f9371008 Move out some of the shell builtin bogosity from printf's source to
sh's builtin/bltin.h.
1995-12-10 15:40:42 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Joerg Wunsch
d867cefdcb Make the syntax checks for the format string more strict. The string
"%8*s" is no longer considered to be a valid format description.

This closes PR bin/386.
1995-05-07 07:00:18 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00