Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3e2ceb2

Browse files
committed
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.
1 parent ee0e274 commit 3e2ceb2

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/bin/pg_verify_checksums/nls.mk

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# src/bin/pg_verify_checksums/nls.mk
2+
CATALOG_NAME = pg_verify_checksums
3+
AVAIL_LANGUAGES =
4+
GETTEXT_FILES = pg_verify_checksums.c

src/bin/pg_verify_checksums/pg_verify_checksums.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ scan_directory(char *basedir, char *subdir)
177177
segmentno = atoi(segmentpath);
178178
if (segmentno == 0)
179179
{
180-
fprintf(stderr, _("%s: invalid segment number %d in filename \"%s\"\n"),
180+
fprintf(stderr, _("%s: invalid segment number %d in file name \"%s\"\n"),
181181
progname, segmentno, fn);
182182
exit(1);
183183
}
@@ -247,7 +247,7 @@ main(int argc, char *argv[])
247247
case 'r':
248248
if (atoi(optarg) <= 0)
249249
{
250-
fprintf(stderr, _("%s: invalid relfilenode: %s\n"), progname, optarg);
250+
fprintf(stderr, _("%s: invalid relfilenode specification, must be numeric: %s\n"), progname, optarg);
251251
exit(1);
252252
}
253253
only_relfilenode = pstrdup(optarg);
@@ -288,20 +288,20 @@ main(int argc, char *argv[])
288288
ControlFile = get_controlfile(DataDir, progname, &crc_ok);
289289
if (!crc_ok)
290290
{
291-
fprintf(stderr, _("%s: pg_control CRC value is incorrect.\n"), progname);
291+
fprintf(stderr, _("%s: pg_control CRC value is incorrect\n"), progname);
292292
exit(1);
293293
}
294294

295295
if (ControlFile->state != DB_SHUTDOWNED &&
296296
ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY)
297297
{
298-
fprintf(stderr, _("%s: cluster must be shut down to verify checksums.\n"), progname);
298+
fprintf(stderr, _("%s: cluster must be shut down to verify checksums\n"), progname);
299299
exit(1);
300300
}
301301

302302
if (ControlFile->data_checksum_version == 0)
303303
{
304-
fprintf(stderr, _("%s: data checksums are not enabled in cluster.\n"), progname);
304+
fprintf(stderr, _("%s: data checksums are not enabled in cluster\n"), progname);
305305
exit(1);
306306
}
307307

@@ -312,9 +312,9 @@ main(int argc, char *argv[])
312312

313313
printf(_("Checksum scan completed\n"));
314314
printf(_("Data checksum version: %d\n"), ControlFile->data_checksum_version);
315-
printf(_("Files scanned: %" INT64_MODIFIER "d\n"), files);
316-
printf(_("Blocks scanned: %" INT64_MODIFIER "d\n"), blocks);
317-
printf(_("Bad checksums: %" INT64_MODIFIER "d\n"), badblocks);
315+
printf(_("Files scanned: %s\n"), psprintf(INT64_FORMAT, files));
316+
printf(_("Blocks scanned: %s\n"), psprintf(INT64_FORMAT, blocks));
317+
printf(_("Bad checksums: %s\n"), psprintf(INT64_FORMAT, badblocks));
318318

319319
if (badblocks > 0)
320320
return 1;

0 commit comments

Comments
 (0)