Re: Adding a --quiet option to initdb

Поиск
Список
Период
Сортировка
Искать
От
Andrew Dunstan
Тема
Re: Adding a --quiet option to initdb
Дата
Msg-id
1138199284.3268.11.camel@swithin
Ответ на
Список
Дерево обсуждения
Adding a --quiet option to initdb Devrim GUNDUZ <devrim@commandprompt.com>
Re: Adding a --quiet option to initdb Andrew Dunstan <andrew@dunslane.net>
Re: [HACKERS] Adding a --quiet option to initdb Devrim GUNDUZ <devrim@commandprompt.com>
Re: [HACKERS] Adding a --quiet option to initdb Devrim GUNDUZ <devrim@commandprompt.com>
Re: [HACKERS] Adding a --quiet option to initdb Peter Eisentraut <peter_e@gmx.net>
Re: [HACKERS] Adding a --quiet option to initdb Devrim GUNDUZ <devrim@commandprompt.com>
Re: [HACKERS] Adding a --quiet option to initdb Bruce Momjian <pgman@candle.pha.pa.us>
Re: [HACKERS] Adding a --quiet option to initdb Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Adding a --quiet option to initdb Devrim GUNDUZ <devrim@commandprompt.com>
Re: [HACKERS] Adding a --quiet option to initdb Bruce Momjian <pgman@candle.pha.pa.us>
Re: [HACKERS] Adding a --quiet option to initdb Greg Stark <gsstark@mit.edu>
Re: [HACKERS] Adding a --quiet option to initdb Tom Lane <tgl@sss.pgh.pa.us>
On Wed, 2006-01-25 at 16:08 +0200, Devrim GUNDUZ wrote:
> Hi,
> 
> Attached is a patch which adds --quiet and --q option to initdb. I
> personally needed this option while writing a document and taking
> screenshot :) It only shows the error and warning messages, as well as
> the last lines.
> 
> I've updated the docs. Regression tests pass.
> 
> This is my first patch to PostgreSQL source, so please guide me if I
> have done something wrong.
> 

Devrim,

What's wrong with just sending stdout to /dev/null? If that eats error
messages too then we should probably fix initdb to send those to stderr.

But if we are going to do this, then I also noticed a couple of things:

. you should explicitly initialize the quiet variable, in keeping with
the style of the others nearby.

. the idiom

   if (! quiet) 
   {
      fputs(_("some message"),stdout);
      fflush(stdout);
   }

should not be endlessly repeated. Make it a macro or a function.

I wonder if we can just set rid of all those fflush() calls by
unbuffering stdout with a single call to setbuf() or setvbuf()?



cheers

andrew



В списке pgsql-patches по дате отправления
От: Devrim GUNDUZ
Дата:
От: Devrim GUNDUZ
Дата:
FAQ