From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Michael Banck <michael(dot)banck(at)credativ(dot)de>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Bernd Helmle <bernd(dot)helmle(at)credativ(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Progress reporting for pg_verify_checksums |
Date: | 2018-12-26 02:45:09 |
Message-ID: | 20181226024509.jokvzsbmgwjacvce@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2018-Dec-26, Michael Paquier wrote:
> + /*
> + * If we are reporting to a terminal, send a carriage return so that we
> + * stay on the same line. If not, send a newline.
> + */
> + if (isatty(fileno(stderr)))
> + fprintf(stderr, "\r");
> + else
> + fprintf(stderr, "\n");
> This bit is not really elegant, why not just '\r'?
Umm, this is established coding pattern in pg_basebackup.c.
Stylistically I'd change all those cases to "fprintf(stderr,
isatty(fileno(stderr)) ? "\r" : "\n")" but leave the string alone, since
AFAIR it took some time to figure out what to do. (I'd also make the
comment one line instead of four, say "Stay on the same line if
reporting to a terminal". That makes the whole stanza two lines rather
than eight, which is the appropriate amount of space for it).
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2018-12-26 02:47:36 | Re: Feature: triggers on materialized views |
Previous Message | Nagaura, Ryohei | 2018-12-26 02:20:43 | RE: Timeout parameters |