coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] tee: add option for outputting to stderr


From: Peter Berbec
Subject: Re: [PATCH] tee: add option for outputting to stderr
Date: Wed, 18 Jan 2017 18:34:02 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

I made a stupid error and posted an old version of this patch. My apologies.

Peter Berbec

47a48,50
> /* If true, output to stderr as well */
> static bool out_to_error;
>
61a65
>   {"error", no_argument, NULL, 'e'},
92a97
>   -e, --error               also output to stderr. negates -p\n\
132a138
>   out_to_error = false;
134c140
< while ((optc = getopt_long (argc, argv, "aip", long_options, NULL)) != -1)
---
> while ((optc = getopt_long (argc, argv, "aeip", long_options, NULL)) != -1)
137a144,147
>       case 'e':
>         out_to_error = true;
>         break;
>
162a173,175
>   if (out_to_error && output_error)
>     output_error = output_error_sigpipe;
>
207c220
<   descriptors = xnmalloc (nfiles + 1, sizeof *descriptors);
---
> descriptors = xnmalloc (nfiles + (out_to_error?2:1), sizeof *descriptors);
231a245,253
>   if (out_to_error)
>     {
>       descriptors[i] = stderr;
>       files[i] = bad_cast (_("standard error"));
>       setvbuf (stderr, NULL, _IONBF, 0);
>       n_outputs++;
>       nfiles++;
>     }
>
250a273,274
>             if (descriptors[i] == stderr)
> clearerr (stdout); /* Avoid redundant close_stderr diagnostic. */



reply via email to

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