[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] shred: --verbose output to stdout
From: |
Jim Meyering |
Subject: |
Re: [RFC] shred: --verbose output to stdout |
Date: |
Sat, 12 Jan 2008 16:44:46 +0100 |
Steven Schubiger <address@hidden> wrote:
> After skimming through a bit of code from shred, I was eager
> to see how easy it would be to change the corresponding calls
> of error() that are relevant to verbosity output to call some
> "equivalent" function, which outputs to stdout, i.e.
>
> static void
> output (const char const *fmt, ...)
> {
> va_list ap;
> va_start (ap, fmt);
> fprintf (stdout, "%s: ", program_name);
> vfprintf (stdout, fmt, ap);
> fprintf (stdout, "\n");
> va_end (ap);
> }
>
> This is a bit more terse than it ought to be, but it illustrates
> that it can be easily implemented for shred itself required that
> 3 non-fatal calls to error() are to be replaced with calls to output().
>
> It is also questionable whether the code should reside in some library and
> thus may also be used by mkdir and split or whether each program has its
> own piece of customized code.
shred uses stdout when FILE is "-", so its verbose output
must continue to go to stderr.
For mkdir.c and split.c, the above might work, assuming you add a call to
fflush (stdout).
Thanks for looking at this.