Re: Fw: Patch to 'tr' utility

Jim Meyering <[email protected]>
Newsgroups gmane.comp.gnu.textutils.bugs
Message-ID <[email protected]>
"Matthew Smith" <[email protected]> wrote:
>     Here is a patch from John Sumsion on the cygwin list, for your perusal:

Thanks, but what is the motivation for this?
Does this mean that every text-filtering program
(e.g., sort, cut, fold, join, etc.) should to do something similar?

>> Here is a patch that ensures that tr console output is NOT buffered.  I
>> only use cygwin, so I have no idea if this builds right on linux or any
>> other platform.
>>
>> diff -u -r textutils-2.0.21/src/tr.c textutils-2.0.21.jgs/src/tr.c
>> --- textutils-2.0.21/src/tr.c 2002-02-11 01:34:16.000000000 -0700
>> +++ textutils-2.0.21.jgs/src/tr.c 2002-06-25 15:41:28.000000000 -0600
>> @@ -1894,6 +1894,9 @@
>>        by text-mode reads (like CR and ^Z).  */
>>     SET_BINARY2 (STDIN_FILENO, STDOUT_FILENO);
>>
>> +  /* Do not buffer console output. */
>> +  if (isatty((int) stdout)) SETVBUF (stdout, NULL, _IONBF, 0);
>> +
>>     if (squeeze_repeats && non_option_args == 1)
>>       {
>>         set_initialize (s1, complement, in_squeeze_set);
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.