On Wed, Nov 04, 2015 at 01:05:38AM -0500, dan mclaughlin wrote:
> On Tue, 3 Nov 2015 21:01:36 -0800 Philip Guenther <[email protected]> wrote:
> > On Tue, Nov 3, 2015 at 8:35 PM, dan mclaughlin <[email protected]> 
> > wrote
> > > i was writing a script when i ran across this.
> > >
> > > $ echo "hello world" | wc
> > >        1       2      12
> > > $ echo -n "hello world" | wc
> > >        0       2      11
> > >
> > > the following patch corrects this:
> >
> > ...but it's not a bug.  wc's line count is required by POSIX to be a
> > count of the number of newline characters in the involved input.
> >
> >
> > Philip Guenther
> >
> 
> i had a suspicion that that was a possibility, but it didn't make sense
> to me. can't imagine that the last line wouldn't be a line...
> 
> out of curiosity, do you know why? some historic artifact?
> 
> either way, maybe a slight modification to the manpage is in order:
> 
> --- usr.bin/wc/wc.1.orig      Sat May  2 05:10:42 2015
> +++ usr.bin/wc/wc.1   Wed Nov  4 00:48:01 2015
> @@ -69,7 +69,7 @@ Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte,
>  Petabyte, and Exabyte in order to reduce the number of digits to four or 
> fewer
>  using powers of 2 for sizes (K=1024, M=1048576, etc.).
>  .It Fl l
> -The number of lines in each input file
> +The number of newlines in each input file
>  is written to the standard output.
>  .It Fl m
>  Intended to count characters instead of bytes;
> 
> 
> since other utilities (like tail, grep) will count that as a line (and i
> just have trouble wrapping my head around the idea that it's not a line.)
> 


the clarity is good, but i worry that you're making a clear sentence
harder to grasp. posix spec itself says -l counts "newline characters",
which i find easier to understand in itself, but as flag -l i find it
much easier to understand mentally that this option can count lines.

i guess we could leave the description as-is, but add a sentence to
qualift this statement.

jmc

Reply via email to