From 3e2ceb231ef0bbd04bb98aa3d3b58ebcac88c00a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 28 Aug 2018 11:49:11 +0200 Subject: [PATCH] pg_verify_checksums: Message style improvements and NLS support The source code was already set up for NLS support, so just a nls.mk file needed to be added. Also, fix the old problem of putting the int64 format specifier right into the string, which breaks NLS. --- src/bin/pg_verify_checksums/nls.mk | 4 ++++ .../pg_verify_checksums/pg_verify_checksums.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 src/bin/pg_verify_checksums/nls.mk diff --git a/src/bin/pg_verify_checksums/nls.mk b/src/bin/pg_verify_checksums/nls.mk new file mode 100644 index 0000000000..893efaf0f0 --- /dev/null +++ b/src/bin/pg_verify_checksums/nls.mk @@ -0,0 +1,4 @@ +# src/bin/pg_verify_checksums/nls.mk +CATALOG_NAME = pg_verify_checksums +AVAIL_LANGUAGES = +GETTEXT_FILES = pg_verify_checksums.c diff --git a/src/bin/pg_verify_checksums/pg_verify_checksums.c b/src/bin/pg_verify_checksums/pg_verify_checksums.c index 7cf3cf35c7..938b92282a 100644 --- a/src/bin/pg_verify_checksums/pg_verify_checksums.c +++ b/src/bin/pg_verify_checksums/pg_verify_checksums.c @@ -177,7 +177,7 @@ scan_directory(char *basedir, char *subdir) segmentno = atoi(segmentpath); if (segmentno == 0) { - fprintf(stderr, _("%s: invalid segment number %d in filename \"%s\"\n"), + fprintf(stderr, _("%s: invalid segment number %d in file name \"%s\"\n"), progname, segmentno, fn); exit(1); } @@ -247,7 +247,7 @@ main(int argc, char *argv[]) case 'r': if (atoi(optarg) <= 0) { - fprintf(stderr, _("%s: invalid relfilenode: %s\n"), progname, optarg); + fprintf(stderr, _("%s: invalid relfilenode specification, must be numeric: %s\n"), progname, optarg); exit(1); } only_relfilenode = pstrdup(optarg); @@ -288,20 +288,20 @@ main(int argc, char *argv[]) ControlFile = get_controlfile(DataDir, progname, &crc_ok); if (!crc_ok) { - fprintf(stderr, _("%s: pg_control CRC value is incorrect.\n"), progname); + fprintf(stderr, _("%s: pg_control CRC value is incorrect\n"), progname); exit(1); } if (ControlFile->state != DB_SHUTDOWNED && ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY) { - fprintf(stderr, _("%s: cluster must be shut down to verify checksums.\n"), progname); + fprintf(stderr, _("%s: cluster must be shut down to verify checksums\n"), progname); exit(1); } if (ControlFile->data_checksum_version == 0) { - fprintf(stderr, _("%s: data checksums are not enabled in cluster.\n"), progname); + fprintf(stderr, _("%s: data checksums are not enabled in cluster\n"), progname); exit(1); } @@ -312,9 +312,9 @@ main(int argc, char *argv[]) printf(_("Checksum scan completed\n")); printf(_("Data checksum version: %d\n"), ControlFile->data_checksum_version); - printf(_("Files scanned: %" INT64_MODIFIER "d\n"), files); - printf(_("Blocks scanned: %" INT64_MODIFIER "d\n"), blocks); - printf(_("Bad checksums: %" INT64_MODIFIER "d\n"), badblocks); + printf(_("Files scanned: %s\n"), psprintf(INT64_FORMAT, files)); + printf(_("Blocks scanned: %s\n"), psprintf(INT64_FORMAT, blocks)); + printf(_("Bad checksums: %s\n"), psprintf(INT64_FORMAT, badblocks)); if (badblocks > 0) return 1; -- 2.40.0