NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/57252: wc



The following reply was made to PR bin/57252; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: marc%fege.net@localhost, rvp%SDF.ORG@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/57252: wc
Date: Thu, 02 Mar 2023 20:03:11 +0700

     Date:        Thu,  2 Mar 2023 12:05:01 +0000 (UTC)
     From:        RVP <rvp%SDF.ORG@localhost>
     Message-ID:  <20230302120501.3D8491A923B%mollari.NetBSD.org@localhost>
 
   |  Following POSIX strictly then results in an ugly display, right?
 
 Wrong.
 
 What I didn't quote last time, because then it wasn't material, was
 the interpretation of %d in this (modified for use in the standard doc
 only) version of printf...
 
     The conversion specifiers and their meanings are:
 [...]
     d,i,o,u,x,X The integer argument shall be written as [...]
 
 		[we all know what they mean I expect -- it goes on
 		 to explain how the precision field (if given) works
 		 - irrelevant here, and then:]
 
 	If both the field width and precision are omitted [that's us],
 	the implementation may precede, follow, or precede and follow
 	numeric arguments of types d, i, and u with <blank> characters;
 	arguments of type o (octal) may be preceded with leading zeros.
 
 Our wc is 100% conformant to the standard.   If someone wants to make it
 omit the spaces in the case there is only one field, and only one file
 is being counted (don't drop them with more than one file, or the columns
 won't line up, that would be ugly), then by all means go ahead.   But there
 is nothing anywhere which requires that.
 
 Any number of space or tab chars, before or after, any of those integers.
 
 If you want to write any kind of portable script, you MUST deal with that.
 
 The only other (relevant to this) POSIX requirement is this one:
 
 	If no input file operands are specified, no name shall be written
 	and no <blank> characters preceding the pathname shall be written.
 
 That is, in that one case, no white space is permitted after the last
 integer output, the final digit of that value must immediately precede
 the newline.
 
 kre
 
 


Home | Main Index | Thread Index | Old Index