From owner-freebsd-bugs Sat May 6 19:09:38 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id TAA28265 for bugs-outgoing; Sat, 6 May 1995 19:09:38 -0700 Received: from gndrsh.aac.dev.com (gndrsh.aac.dev.com [198.145.92.241]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id TAA28244 for ; Sat, 6 May 1995 19:09:27 -0700 Received: (from rgrimes@localhost) by gndrsh.aac.dev.com (8.6.11/8.6.9) id TAA11643; Sat, 6 May 1995 19:09:13 -0700 From: "Rodney W. Grimes" Message-Id: <199505070209.TAA11643@gndrsh.aac.dev.com> Subject: Re: bin/386: *s field width specification doesn't seem to work for printf To: jkh@time.cdrom.com Date: Sat, 6 May 1995 19:09:13 -0700 (PDT) Cc: freebsd-bugs@freefall.cdrom.com In-Reply-To: <199505070150.SAA27670@freefall.cdrom.com> from "Jordan K. Hubbard" at May 6, 95 06:50:01 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1822 Sender: bugs-owner@FreeBSD.org Precedence: bulk > > > >Number: 386 > >Category: bin > >Synopsis: *s field width specification for printf seems to loop > >Confidential: no > >Severity: non-critical > >Priority: low > >Responsible: freebsd-bugs (FreeBSD bugs mailing list) > >State: open > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Sat May 6 18:50:00 1995 > >Originator: Jordan K. Hubbard > >Organization: > Walnut Creek CDROM > >Release: FreeBSD BUILT-19950425 i386 > >Environment: > > See Release > > >Description: > > Try this: printf "%8*s" foobarblatt > > It will loop forever. The man page would tend to indicate that it, > or perhaps rather %*8s, should print the arg truncated to 8 characters. > Either way, it shouldn't loop. I am not sure how you read that from the man page, from print(1): A field width or precision may be `*' instead of a digit string. In this case an argument supplies the field width or precision. and from print(3): A field width or precision, or both, may be indicated by an asterisk `*' instead of a digit string. In this case, an int argument supplies the field width or precision. A negative field width is treated as a left adjustment flag followed by a positive field width; a negative precision is treated as though it were missing. 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 Grimes rgrimes@gndrsh.aac.dev.com Accurate Automation Company Custom computers for FreeBSD