fflush(stdout);
- fprintf(stderr, "%s: FATAL: ", progname);
+ fprintf(stderr, _("%s: FATAL: "), progname);
va_start(args, fmt);
- vfprintf(stderr, fmt, args);
+ vfprintf(stderr, _(fmt), args);
va_end(args);
fputc('\n', stderr);
static void
usage(void)
{
- printf("%s decodes and displays PostgreSQL transaction logs for debugging.\n\n",
+ printf(_("%s decodes and displays PostgreSQL transaction logs for debugging.\n\n"),
progname);
- printf("Usage:\n");
- printf(" %s [OPTION]... [STARTSEG [ENDSEG]] \n", progname);
- printf("\nOptions:\n");
- printf(" -b, --bkp-details output detailed information about backup blocks\n");
- printf(" -e, --end=RECPTR stop reading at log position RECPTR\n");
- printf(" -f, --follow keep retrying after reaching end of WAL\n");
- printf(" -n, --limit=N number of records to display\n");
- printf(" -p, --path=PATH directory in which to find log segment files\n");
- printf(" (default: ./pg_wal)\n");
- printf(" -r, --rmgr=RMGR only show records generated by resource manager RMGR\n");
- printf(" use --rmgr=list to list valid resource manager names\n");
- printf(" -s, --start=RECPTR start reading at log position RECPTR\n");
- printf(" -t, --timeline=TLI timeline from which to read log records\n");
- printf(" (default: 1 or the value used in STARTSEG)\n");
- printf(" -V, --version output version information, then exit\n");
- printf(" -x, --xid=XID only show records with TransactionId XID\n");
- printf(" -z, --stats[=record] show statistics instead of records\n");
- printf(" (optionally, show per-record statistics)\n");
- printf(" -?, --help show this help, then exit\n");
+ printf(_("Usage:\n"));
+ printf(_(" %s [OPTION]... [STARTSEG [ENDSEG]] \n"), progname);
+ printf(_("\nOptions:\n"));
+ printf(_(" -b, --bkp-details output detailed information about backup blocks\n"));
+ printf(_(" -e, --end=RECPTR stop reading at log position RECPTR\n"));
+ printf(_(" -f, --follow keep retrying after reaching end of WAL\n"));
+ printf(_(" -n, --limit=N number of records to display\n"));
+ printf(_(" -p, --path=PATH directory in which to find log segment files\n"
+ " (default: ./pg_wal)\n"));
+ printf(_(" -r, --rmgr=RMGR only show records generated by resource manager RMGR\n"
+ " use --rmgr=list to list valid resource manager names\n"));
+ printf(_(" -s, --start=RECPTR start reading at log position RECPTR\n"));
+ printf(_(" -t, --timeline=TLI timeline from which to read log records\n"
+ " (default: 1 or the value used in STARTSEG)\n"));
+ printf(_(" -V, --version output version information, then exit\n"));
+ printf(_(" -x, --xid=XID only show records with TransactionId XID\n"));
+ printf(_(" -z, --stats[=record] show statistics instead of records\n"
+ " (optionally, show per-record statistics)\n"));
+ printf(_(" -?, --help show this help, then exit\n"));
}
int
int option;
int optindex = 0;
+ set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_xlogdump"));
progname = get_progname(argv[0]);
memset(&private, 0, sizeof(XLogDumpPrivate));
if (argc <= 1)
{
- fprintf(stderr, "%s: no arguments specified\n", progname);
+ fprintf(stderr, _("%s: no arguments specified\n"), progname);
goto bad_argument;
}
case 'e':
if (sscanf(optarg, "%X/%X", &xlogid, &xrecoff) != 2)
{
- fprintf(stderr, "%s: could not parse end log position \"%s\"\n",
+ fprintf(stderr, _("%s: could not parse end log position \"%s\"\n"),
progname, optarg);
goto bad_argument;
}
case 'n':
if (sscanf(optarg, "%d", &config.stop_after_records) != 1)
{
- fprintf(stderr, "%s: could not parse limit \"%s\"\n",
+ fprintf(stderr, _("%s: could not parse limit \"%s\"\n"),
progname, optarg);
goto bad_argument;
}
if (config.filter_by_rmgr == -1)
{
- fprintf(stderr, "%s: resource manager \"%s\" does not exist\n",
+ fprintf(stderr, _("%s: resource manager \"%s\" does not exist\n"),
progname, optarg);
goto bad_argument;
}
case 's':
if (sscanf(optarg, "%X/%X", &xlogid, &xrecoff) != 2)
{
- fprintf(stderr, "%s: could not parse start log position \"%s\"\n",
+ fprintf(stderr, _("%s: could not parse start log position \"%s\"\n"),
progname, optarg);
goto bad_argument;
}
case 't':
if (sscanf(optarg, "%d", &private.timeline) != 1)
{
- fprintf(stderr, "%s: could not parse timeline \"%s\"\n",
+ fprintf(stderr, _("%s: could not parse timeline \"%s\"\n"),
progname, optarg);
goto bad_argument;
}
case 'x':
if (sscanf(optarg, "%u", &config.filter_by_xid) != 1)
{
- fprintf(stderr, "%s: could not parse \"%s\" as a valid xid\n",
+ fprintf(stderr, _("%s: could not parse \"%s\" as a valid xid\n"),
progname, optarg);
goto bad_argument;
}
config.stats_per_record = true;
else if (strcmp(optarg, "rmgr") != 0)
{
- fprintf(stderr, "%s: unrecognised argument to --stats: %s\n",
+ fprintf(stderr, _("%s: unrecognised argument to --stats: %s\n"),
progname, optarg);
goto bad_argument;
}
if ((optind + 2) < argc)
{
fprintf(stderr,
- "%s: too many command-line arguments (first is \"%s\")\n",
+ _("%s: too many command-line arguments (first is \"%s\")\n"),
progname, argv[optind + 2]);
goto bad_argument;
}
if (!verify_directory(private.inpath))
{
fprintf(stderr,
- "%s: path \"%s\" cannot be opened: %s\n",
+ _("%s: path \"%s\" cannot be opened: %s\n"),
progname, private.inpath, strerror(errno));
goto bad_argument;
}
else if (!XLByteInSeg(private.startptr, segno))
{
fprintf(stderr,
- "%s: start log position %X/%X is not inside file \"%s\"\n",
+ _("%s: start log position %X/%X is not inside file \"%s\"\n"),
progname,
(uint32) (private.startptr >> 32),
(uint32) private.startptr,
private.endptr != (segno + 1) * XLogSegSize)
{
fprintf(stderr,
- "%s: end log position %X/%X is not inside file \"%s\"\n",
+ _("%s: end log position %X/%X is not inside file \"%s\"\n"),
progname,
(uint32) (private.endptr >> 32),
(uint32) private.endptr,
/* we don't know what to print */
if (XLogRecPtrIsInvalid(private.startptr))
{
- fprintf(stderr, "%s: no start log position given.\n", progname);
+ fprintf(stderr, _("%s: no start log position given.\n"), progname);
goto bad_argument;
}
* a segment (e.g. we were used in file mode).
*/
if (first_record != private.startptr && (private.startptr % XLogSegSize) != 0)
- printf("first record is after %X/%X, at %X/%X, skipping over %u bytes\n",
+ printf(_("first record is after %X/%X, at %X/%X, skipping over %u bytes\n"),
(uint32) (private.startptr >> 32), (uint32) private.startptr,
(uint32) (first_record >> 32), (uint32) first_record,
(uint32) (first_record - private.startptr));
return EXIT_SUCCESS;
bad_argument:
- fprintf(stderr, "Try \"%s --help\" for more information.\n", progname);
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
return EXIT_FAILURE;
}