diff options
author | Magnus Hagander <magnus@hagander.net> | 2013-01-17 14:43:33 +0100 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2013-01-17 14:43:33 +0100 |
commit | 4eebf1309f07ada30b0338991cea848ed827ed64 (patch) | |
tree | 3ed1183afc0950a345dba08bc91283f37d686a91 /src/bin/pg_basebackup/pg_basebackup.c | |
parent | d7e9ca7ff7efac8b15d4348fd9480c12ed560ae7 (diff) | |
download | postgresql-4eebf1309f07ada30b0338991cea848ed827ed64.tar.gz postgresql-4eebf1309f07ada30b0338991cea848ed827ed64.zip |
Make size-output fixed length in pg_basebackup verbose mode
This way the line doesn't shift right as the amount of data processed
increases.
Diffstat (limited to 'src/bin/pg_basebackup/pg_basebackup.c')
-rw-r--r-- | src/bin/pg_basebackup/pg_basebackup.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 36f825e95c8..f77b9f68e29 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -432,9 +432,10 @@ progress_report(int tablespacenum, const char *filename) * call) */ fprintf(stderr, - ngettext("%s/%s kB (100%%), %d/%d tablespace %*s", - "%s/%s kB (100%%), %d/%d tablespaces %*s", + ngettext("%*s/%s kB (100%%), %d/%d tablespace %*s", + "%*s/%s kB (100%%), %d/%d tablespaces %*s", tablespacecount), + strlen(totalsize_str), totaldone_str, totalsize_str, tablespacenum, tablespacecount, VERBOSE_FILENAME_LENGTH + 5, ""); @@ -443,9 +444,10 @@ progress_report(int tablespacenum, const char *filename) bool truncate = (strlen(filename) > VERBOSE_FILENAME_LENGTH); fprintf(stderr, - ngettext("%s/%s kB (%d%%), %d/%d tablespace (%s%-*.*s)", - "%s/%s kB (%d%%), %d/%d tablespaces (%s%-*.*s)", + ngettext("%*s/%s kB (%d%%), %d/%d tablespace (%s%-*.*s)", + "%*s/%s kB (%d%%), %d/%d tablespaces (%s%-*.*s)", tablespacecount), + strlen(totalsize_str), totaldone_str, totalsize_str, percent, tablespacenum, tablespacecount, /* Prefix with "..." if we do leading truncation */ @@ -458,9 +460,10 @@ progress_report(int tablespacenum, const char *filename) } else fprintf(stderr, - ngettext("%s/%s kB (%d%%), %d/%d tablespace", - "%s/%s kB (%d%%), %d/%d tablespaces", + ngettext("%*s/%s kB (%d%%), %d/%d tablespace", + "%*s/%s kB (%d%%), %d/%d tablespaces", tablespacecount), + strlen(totalsize_str), totaldone_str, totalsize_str, percent, tablespacenum, tablespacecount); |