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