bug-coreutils
[Top][All Lists]
Advanced

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

Re: wc annoyances


From: Paul Eggert
Subject: Re: wc annoyances
Date: 20 Jul 2003 14:04:42 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Jim Meyering <address@hidden> writes:

> Not that it matters, but in some unusual cases,
> the new widths are worse than the old:
> 
>   $ dd bs=1 seek=1G of=b < /dev/null 2> /dev/null
>   $ ./wc -lw b
>            0          0 b
>   $ wc -lw b
>         0       0 b

Yes, that's true.  The only way to print minimal widths is to run the
'wc' algorithm on all the input files, collect the outputs, and then
print them all at the end.  I've been meaning to do that with df at
some point (since df suffers from column overflow more), but it does
have some disconcerting effects, since zero output is printed until
it's all ready.

Anyway, I noticed on glitch in the merged version; here's a patch.

2003-07-20  Paul Eggert  <address@hidden>

        * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
        invoked with a null pointer when there were no file arguments.

--- wc.c.~1.88.~        Sun Jul 20 13:50:35 2003
+++ wc.c        Sun Jul 20 13:58:40 2003
@@ -554,7 +554,7 @@ get_input_fstatus (int nfiles, char * co
       int i;
 
       for (i = 0; i < nfiles; i++)
-       fstatus[i].failed = (file[i] && STREQ (file[i], "-")
+       fstatus[i].failed = (! file[i] || STREQ (file[i], "-")
                             ? fstat (STDIN_FILENO, &fstatus[i].st)
                             : stat (file[i], &fstatus[i].st));
     }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]