[Top][All Lists]

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

Re: wc command

From: Pádraig Brady
Subject: Re: wc command
Date: Mon, 22 Dec 2008 13:43:31 +0000
User-agent: Thunderbird (X11/20071008)

Eric Blake wrote:
> According to Andrew McGill on 12/22/2008 1:38 AM:
>> My guess is that while it would be friendly to provide a similar message for 
>> wc (od, head, tail, etc), it would violate something posixy (and is 
>> therefore 
>> imposixable).
> It would be possible to add a conditional check, where if POSIXLY_CORRECT
> is not defined in the environment and a filter app is started with a tty
> as stdin and stderr (ie. the same criteria for what POSIX requires bash to
> use for whether a shell is interactive), then we issue a warning to
> stderr.  Normally, we don't like adding additional uses of
> POSIXLY_CORRECT, but this particular idea may help stave off confusion.
> Care to write such a patch?  It would need to be applied to all of the
> coreutils that can act as a filter, not just wc.

So you're proposing something like:

if (!POSIXLY_CORRECT && isatty(0) & isatty(2))
    fprintf(stderr,"Please enter your text now, or Ctrl-d to end\n");

While logically correct, I'm not sure such a patch would
be that useful/desired. More code and more translations,
for something that should be quite obvious.

The OP entered `wc` accidentally, so it's not as if
they were confused about the way the filter operated.
99.999999999999999% of cases like this would be users
wait a while, and go "oops", Ctrl-c.

I'm all for helping new users, and giving meaningful
error messages, but I'm not sure the gain is worth the
effort of updating all filters.

I'm 40:60 for this proposal.


reply via email to

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