tech-userlevel archive

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

Re: non-POSIX behavior from wc(1)



On Mon, Jan 18, 2016 at 01:20:13PM -0500, Greg Troxel wrote:
> 
> On NetBSD 6, one gets wc output with pleasing spaces
> 
> $ wc -l unison.log cmake.diff
>        1 unison.log
>       58 cmake.diff
>       59 total
> $ wc unison.log cmake.diff
>        1       7      45 unison.log
>       58     168    2461 cmake.diff
>       59     175    2506 total
> $
> 
> But POSIX says:
> 
>    "%d %d %d %s\n", <newlines>, <words>, <bytes>, <file>
> 
> which does not have extra spaces.  This only matters if you write code
> to parse the output based on the spec:
> 
>   http://pubs.opengroup.org/onlinepubs/9699919799/utilities/wc.html
> 
> So it seems we should adjust wc(1) to note the extra spaces, since it
> seems unlikely that we would come to consensus on fixing it.

That sounds like a good candidate for POSIX_MISTAKES... Stripping white
spaces is one of the most obvious things to start from.

Joerg


Home | Main Index | Thread Index | Old Index