]> granicus.if.org Git - postgresql/commitdiff
pg_verify_checksums: Message style improvements and NLS support
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 28 Aug 2018 09:49:11 +0000 (11:49 +0200)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 28 Aug 2018 09:49:11 +0000 (11:49 +0200)
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 [new file with mode: 0644]
src/bin/pg_verify_checksums/pg_verify_checksums.c

diff --git a/src/bin/pg_verify_checksums/nls.mk b/src/bin/pg_verify_checksums/nls.mk
new file mode 100644 (file)
index 0000000..893efaf
--- /dev/null
@@ -0,0 +1,4 @@
+# src/bin/pg_verify_checksums/nls.mk
+CATALOG_NAME     = pg_verify_checksums
+AVAIL_LANGUAGES  =
+GETTEXT_FILES    = pg_verify_checksums.c
index 7cf3cf35c7aab3c53252adadc0557f064a21a8d5..938b92282a7f3fa99621f7306b32478ddda8e015 100644 (file)
@@ -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;