Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 May 1995 05:24:09 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-bugs@FreeBSD.org (FreeBSD bugs list)
Subject:   Re: bin/386: *s field width specification doesn't seem to work for printf
Message-ID:  <199505070324.FAA06928@uriah.heep.sax.de>
In-Reply-To: <199505070209.TAA11643@gndrsh.aac.dev.com> from "Rodney W. Grimes" at May 6, 95 07:09:13 pm

next in thread | previous in thread | raw e-mail | index | archive | help
As Rodney W. Grimes wrote:
> 

> > 	Try this:  printf "%8*s" foobarblatt

> You are missing the required int arg for the * and foobarblatt is being
> used for this int.  foobarblatt is probably some rather very large int
> value and appears to loop forever, when infact it is outputing tons and
> tons of spaces to bad the width of the field.
> 
> Please close this bug report as programmer error.... 

Rod, did you actually try it?

"foobarblatt" ain't a valid int.  printf(1) misses an argument in that
case.  It expected two args (for the * and for the s) and got only
one.  The least one could expect is it loudly complains about this.

Furthermore, if you omit the asterisk, you'll be surprised that you
can still see a very nice "foobarblatt" instead of the expected
"foobarbl".  You can also replace the command by

	printf "%*s" 8 foobarblatt

to the same avail.

Seems there's more than just one bug... :-(

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505070324.FAA06928>