Pádraig Brady <[email protected]> wrote: > 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.
I too would prefer not to introduce such new tests of POSIXLY_CORRECT. _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
