@@ -79,9 +79,9 @@ fatal_error(const char *fmt,...)
7979
8080 fflush (stdout );
8181
82- fprintf (stderr , "%s: FATAL: " , progname );
82+ fprintf (stderr , _ ( "%s: FATAL: " ) , progname );
8383 va_start (args , fmt );
84- vfprintf (stderr , fmt , args );
84+ vfprintf (stderr , _ ( fmt ) , args );
8585 va_end (args );
8686 fputc ('\n' , stderr );
8787
@@ -670,27 +670,27 @@ XLogDumpDisplayStats(XLogDumpConfig *config, XLogDumpStats *stats)
670670static void
671671usage (void )
672672{
673- printf ("%s decodes and displays PostgreSQL transaction logs for debugging.\n\n" ,
673+ printf (_ ( "%s decodes and displays PostgreSQL transaction logs for debugging.\n\n" ) ,
674674 progname );
675- printf ("Usage:\n" );
676- printf (" %s [OPTION]... [STARTSEG [ENDSEG]] \n" , progname );
677- printf ("\nOptions:\n" );
678- printf (" -b, --bkp-details output detailed information about backup blocks\n" );
679- printf (" -e, --end=RECPTR stop reading at log position RECPTR\n" );
680- printf (" -f, --follow keep retrying after reaching end of WAL\n" );
681- printf (" -n, --limit=N number of records to display\n" );
682- printf (" -p, --path=PATH directory in which to find log segment files\n" );
683- printf ( " (default: ./pg_wal)\n" );
684- printf (" -r, --rmgr=RMGR only show records generated by resource manager RMGR\n" );
685- printf ( " use --rmgr=list to list valid resource manager names\n" );
686- printf (" -s, --start=RECPTR start reading at log position RECPTR\n" );
687- printf (" -t, --timeline=TLI timeline from which to read log records\n" );
688- printf ( " (default: 1 or the value used in STARTSEG)\n" );
689- printf (" -V, --version output version information, then exit\n" );
690- printf (" -x, --xid=XID only show records with TransactionId XID\n" );
691- printf (" -z, --stats[=record] show statistics instead of records\n" );
692- printf ( " (optionally, show per-record statistics)\n" );
693- printf (" -?, --help show this help, then exit\n" );
675+ printf (_ ( "Usage:\n" ) );
676+ printf (_ ( " %s [OPTION]... [STARTSEG [ENDSEG]] \n" ) , progname );
677+ printf (_ ( "\nOptions:\n" ) );
678+ printf (_ ( " -b, --bkp-details output detailed information about backup blocks\n" ) );
679+ printf (_ ( " -e, --end=RECPTR stop reading at log position RECPTR\n" ) );
680+ printf (_ ( " -f, --follow keep retrying after reaching end of WAL\n" ) );
681+ printf (_ ( " -n, --limit=N number of records to display\n" ) );
682+ printf (_ ( " -p, --path=PATH directory in which to find log segment files\n"
683+ " (default: ./pg_wal)\n" ) );
684+ printf (_ ( " -r, --rmgr=RMGR only show records generated by resource manager RMGR\n"
685+ " use --rmgr=list to list valid resource manager names\n" ) );
686+ printf (_ ( " -s, --start=RECPTR start reading at log position RECPTR\n" ) );
687+ printf (_ ( " -t, --timeline=TLI timeline from which to read log records\n"
688+ " (default: 1 or the value used in STARTSEG)\n" ) );
689+ printf (_ ( " -V, --version output version information, then exit\n" ) );
690+ printf (_ ( " -x, --xid=XID only show records with TransactionId XID\n" ) );
691+ printf (_ ( " -z, --stats[=record] show statistics instead of records\n"
692+ " (optionally, show per-record statistics)\n" ) );
693+ printf (_ ( " -?, --help show this help, then exit\n" ) );
694694}
695695
696696int
@@ -725,6 +725,7 @@ main(int argc, char **argv)
725725 int option ;
726726 int optindex = 0 ;
727727
728+ set_pglocale_pgservice (argv [0 ], PG_TEXTDOMAIN ("pg_xlogdump" ));
728729 progname = get_progname (argv [0 ]);
729730
730731 memset (& private , 0 , sizeof (XLogDumpPrivate ));
@@ -748,7 +749,7 @@ main(int argc, char **argv)
748749
749750 if (argc <= 1 )
750751 {
751- fprintf (stderr , "%s: no arguments specified\n" , progname );
752+ fprintf (stderr , _ ( "%s: no arguments specified\n" ) , progname );
752753 goto bad_argument ;
753754 }
754755
@@ -763,7 +764,7 @@ main(int argc, char **argv)
763764 case 'e' :
764765 if (sscanf (optarg , "%X/%X" , & xlogid , & xrecoff ) != 2 )
765766 {
766- fprintf (stderr , "%s: could not parse end log position \"%s\"\n" ,
767+ fprintf (stderr , _ ( "%s: could not parse end log position \"%s\"\n" ) ,
767768 progname , optarg );
768769 goto bad_argument ;
769770 }
@@ -779,7 +780,7 @@ main(int argc, char **argv)
779780 case 'n' :
780781 if (sscanf (optarg , "%d" , & config .stop_after_records ) != 1 )
781782 {
782- fprintf (stderr , "%s: could not parse limit \"%s\"\n" ,
783+ fprintf (stderr , _ ( "%s: could not parse limit \"%s\"\n" ) ,
783784 progname , optarg );
784785 goto bad_argument ;
785786 }
@@ -808,7 +809,7 @@ main(int argc, char **argv)
808809
809810 if (config .filter_by_rmgr == -1 )
810811 {
811- fprintf (stderr , "%s: resource manager \"%s\" does not exist\n" ,
812+ fprintf (stderr , _ ( "%s: resource manager \"%s\" does not exist\n" ) ,
812813 progname , optarg );
813814 goto bad_argument ;
814815 }
@@ -817,7 +818,7 @@ main(int argc, char **argv)
817818 case 's' :
818819 if (sscanf (optarg , "%X/%X" , & xlogid , & xrecoff ) != 2 )
819820 {
820- fprintf (stderr , "%s: could not parse start log position \"%s\"\n" ,
821+ fprintf (stderr , _ ( "%s: could not parse start log position \"%s\"\n" ) ,
821822 progname , optarg );
822823 goto bad_argument ;
823824 }
@@ -827,7 +828,7 @@ main(int argc, char **argv)
827828 case 't' :
828829 if (sscanf (optarg , "%d" , & private .timeline ) != 1 )
829830 {
830- fprintf (stderr , "%s: could not parse timeline \"%s\"\n" ,
831+ fprintf (stderr , _ ( "%s: could not parse timeline \"%s\"\n" ) ,
831832 progname , optarg );
832833 goto bad_argument ;
833834 }
@@ -839,7 +840,7 @@ main(int argc, char **argv)
839840 case 'x' :
840841 if (sscanf (optarg , "%u" , & config .filter_by_xid ) != 1 )
841842 {
842- fprintf (stderr , "%s: could not parse \"%s\" as a valid xid\n" ,
843+ fprintf (stderr , _ ( "%s: could not parse \"%s\" as a valid xid\n" ) ,
843844 progname , optarg );
844845 goto bad_argument ;
845846 }
@@ -854,7 +855,7 @@ main(int argc, char **argv)
854855 config .stats_per_record = true;
855856 else if (strcmp (optarg , "rmgr" ) != 0 )
856857 {
857- fprintf (stderr , "%s: unrecognised argument to --stats: %s\n" ,
858+ fprintf (stderr , _ ( "%s: unrecognised argument to --stats: %s\n" ) ,
858859 progname , optarg );
859860 goto bad_argument ;
860861 }
@@ -868,7 +869,7 @@ main(int argc, char **argv)
868869 if ((optind + 2 ) < argc )
869870 {
870871 fprintf (stderr ,
871- "%s: too many command-line arguments (first is \"%s\")\n" ,
872+ _ ( "%s: too many command-line arguments (first is \"%s\")\n" ) ,
872873 progname , argv [optind + 2 ]);
873874 goto bad_argument ;
874875 }
@@ -879,7 +880,7 @@ main(int argc, char **argv)
879880 if (!verify_directory (private .inpath ))
880881 {
881882 fprintf (stderr ,
882- "%s: path \"%s\" cannot be opened: %s\n" ,
883+ _ ( "%s: path \"%s\" cannot be opened: %s\n" ) ,
883884 progname , private .inpath , strerror (errno ));
884885 goto bad_argument ;
885886 }
@@ -917,7 +918,7 @@ main(int argc, char **argv)
917918 else if (!XLByteInSeg (private .startptr , segno ))
918919 {
919920 fprintf (stderr ,
920- "%s: start log position %X/%X is not inside file \"%s\"\n" ,
921+ _ ( "%s: start log position %X/%X is not inside file \"%s\"\n" ) ,
921922 progname ,
922923 (uint32 ) (private .startptr >> 32 ),
923924 (uint32 ) private .startptr ,
@@ -961,7 +962,7 @@ main(int argc, char **argv)
961962 private .endptr != (segno + 1 ) * XLogSegSize )
962963 {
963964 fprintf (stderr ,
964- "%s: end log position %X/%X is not inside file \"%s\"\n" ,
965+ _ ( "%s: end log position %X/%X is not inside file \"%s\"\n" ) ,
965966 progname ,
966967 (uint32 ) (private .endptr >> 32 ),
967968 (uint32 ) private .endptr ,
@@ -973,7 +974,7 @@ main(int argc, char **argv)
973974 /* we don't know what to print */
974975 if (XLogRecPtrIsInvalid (private .startptr ))
975976 {
976- fprintf (stderr , "%s: no start log position given.\n" , progname );
977+ fprintf (stderr , _ ( "%s: no start log position given.\n" ) , progname );
977978 goto bad_argument ;
978979 }
979980
@@ -998,7 +999,7 @@ main(int argc, char **argv)
998999 * a segment (e.g. we were used in file mode).
9991000 */
10001001 if (first_record != private .startptr && (private .startptr % XLogSegSize ) != 0 )
1001- printf ("first record is after %X/%X, at %X/%X, skipping over %u bytes\n" ,
1002+ printf (_ ( "first record is after %X/%X, at %X/%X, skipping over %u bytes\n" ) ,
10021003 (uint32 ) (private .startptr >> 32 ), (uint32 ) private .startptr ,
10031004 (uint32 ) (first_record >> 32 ), (uint32 ) first_record ,
10041005 (uint32 ) (first_record - private .startptr ));
@@ -1057,6 +1058,6 @@ main(int argc, char **argv)
10571058 return EXIT_SUCCESS ;
10581059
10591060bad_argument :
1060- fprintf (stderr , "Try \"%s --help\" for more information.\n" , progname );
1061+ fprintf (stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname );
10611062 return EXIT_FAILURE ;
10621063}
0 commit comments