@@ -79,9 +79,9 @@ fatal_error(const char *fmt,...)
79
79
80
80
fflush (stdout );
81
81
82
- fprintf (stderr , "%s: FATAL: " , progname );
82
+ fprintf (stderr , _ ( "%s: FATAL: " ) , progname );
83
83
va_start (args , fmt );
84
- vfprintf (stderr , fmt , args );
84
+ vfprintf (stderr , _ ( fmt ) , args );
85
85
va_end (args );
86
86
fputc ('\n' , stderr );
87
87
@@ -670,27 +670,27 @@ XLogDumpDisplayStats(XLogDumpConfig *config, XLogDumpStats *stats)
670
670
static void
671
671
usage (void )
672
672
{
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" ) ,
674
674
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" ) );
694
694
}
695
695
696
696
int
@@ -725,6 +725,7 @@ main(int argc, char **argv)
725
725
int option ;
726
726
int optindex = 0 ;
727
727
728
+ set_pglocale_pgservice (argv [0 ], PG_TEXTDOMAIN ("pg_xlogdump" ));
728
729
progname = get_progname (argv [0 ]);
729
730
730
731
memset (& private , 0 , sizeof (XLogDumpPrivate ));
@@ -748,7 +749,7 @@ main(int argc, char **argv)
748
749
749
750
if (argc <= 1 )
750
751
{
751
- fprintf (stderr , "%s: no arguments specified\n" , progname );
752
+ fprintf (stderr , _ ( "%s: no arguments specified\n" ) , progname );
752
753
goto bad_argument ;
753
754
}
754
755
@@ -763,7 +764,7 @@ main(int argc, char **argv)
763
764
case 'e' :
764
765
if (sscanf (optarg , "%X/%X" , & xlogid , & xrecoff ) != 2 )
765
766
{
766
- fprintf (stderr , "%s: could not parse end log position \"%s\"\n" ,
767
+ fprintf (stderr , _ ( "%s: could not parse end log position \"%s\"\n" ) ,
767
768
progname , optarg );
768
769
goto bad_argument ;
769
770
}
@@ -779,7 +780,7 @@ main(int argc, char **argv)
779
780
case 'n' :
780
781
if (sscanf (optarg , "%d" , & config .stop_after_records ) != 1 )
781
782
{
782
- fprintf (stderr , "%s: could not parse limit \"%s\"\n" ,
783
+ fprintf (stderr , _ ( "%s: could not parse limit \"%s\"\n" ) ,
783
784
progname , optarg );
784
785
goto bad_argument ;
785
786
}
@@ -808,7 +809,7 @@ main(int argc, char **argv)
808
809
809
810
if (config .filter_by_rmgr == -1 )
810
811
{
811
- fprintf (stderr , "%s: resource manager \"%s\" does not exist\n" ,
812
+ fprintf (stderr , _ ( "%s: resource manager \"%s\" does not exist\n" ) ,
812
813
progname , optarg );
813
814
goto bad_argument ;
814
815
}
@@ -817,7 +818,7 @@ main(int argc, char **argv)
817
818
case 's' :
818
819
if (sscanf (optarg , "%X/%X" , & xlogid , & xrecoff ) != 2 )
819
820
{
820
- fprintf (stderr , "%s: could not parse start log position \"%s\"\n" ,
821
+ fprintf (stderr , _ ( "%s: could not parse start log position \"%s\"\n" ) ,
821
822
progname , optarg );
822
823
goto bad_argument ;
823
824
}
@@ -827,7 +828,7 @@ main(int argc, char **argv)
827
828
case 't' :
828
829
if (sscanf (optarg , "%d" , & private .timeline ) != 1 )
829
830
{
830
- fprintf (stderr , "%s: could not parse timeline \"%s\"\n" ,
831
+ fprintf (stderr , _ ( "%s: could not parse timeline \"%s\"\n" ) ,
831
832
progname , optarg );
832
833
goto bad_argument ;
833
834
}
@@ -839,7 +840,7 @@ main(int argc, char **argv)
839
840
case 'x' :
840
841
if (sscanf (optarg , "%u" , & config .filter_by_xid ) != 1 )
841
842
{
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" ) ,
843
844
progname , optarg );
844
845
goto bad_argument ;
845
846
}
@@ -854,7 +855,7 @@ main(int argc, char **argv)
854
855
config .stats_per_record = true;
855
856
else if (strcmp (optarg , "rmgr" ) != 0 )
856
857
{
857
- fprintf (stderr , "%s: unrecognised argument to --stats: %s\n" ,
858
+ fprintf (stderr , _ ( "%s: unrecognised argument to --stats: %s\n" ) ,
858
859
progname , optarg );
859
860
goto bad_argument ;
860
861
}
@@ -868,7 +869,7 @@ main(int argc, char **argv)
868
869
if ((optind + 2 ) < argc )
869
870
{
870
871
fprintf (stderr ,
871
- "%s: too many command-line arguments (first is \"%s\")\n" ,
872
+ _ ( "%s: too many command-line arguments (first is \"%s\")\n" ) ,
872
873
progname , argv [optind + 2 ]);
873
874
goto bad_argument ;
874
875
}
@@ -879,7 +880,7 @@ main(int argc, char **argv)
879
880
if (!verify_directory (private .inpath ))
880
881
{
881
882
fprintf (stderr ,
882
- "%s: path \"%s\" cannot be opened: %s\n" ,
883
+ _ ( "%s: path \"%s\" cannot be opened: %s\n" ) ,
883
884
progname , private .inpath , strerror (errno ));
884
885
goto bad_argument ;
885
886
}
@@ -917,7 +918,7 @@ main(int argc, char **argv)
917
918
else if (!XLByteInSeg (private .startptr , segno ))
918
919
{
919
920
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" ) ,
921
922
progname ,
922
923
(uint32 ) (private .startptr >> 32 ),
923
924
(uint32 ) private .startptr ,
@@ -961,7 +962,7 @@ main(int argc, char **argv)
961
962
private .endptr != (segno + 1 ) * XLogSegSize )
962
963
{
963
964
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" ) ,
965
966
progname ,
966
967
(uint32 ) (private .endptr >> 32 ),
967
968
(uint32 ) private .endptr ,
@@ -973,7 +974,7 @@ main(int argc, char **argv)
973
974
/* we don't know what to print */
974
975
if (XLogRecPtrIsInvalid (private .startptr ))
975
976
{
976
- fprintf (stderr , "%s: no start log position given.\n" , progname );
977
+ fprintf (stderr , _ ( "%s: no start log position given.\n" ) , progname );
977
978
goto bad_argument ;
978
979
}
979
980
@@ -998,7 +999,7 @@ main(int argc, char **argv)
998
999
* a segment (e.g. we were used in file mode).
999
1000
*/
1000
1001
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" ) ,
1002
1003
(uint32 ) (private .startptr >> 32 ), (uint32 ) private .startptr ,
1003
1004
(uint32 ) (first_record >> 32 ), (uint32 ) first_record ,
1004
1005
(uint32 ) (first_record - private .startptr ));
@@ -1057,6 +1058,6 @@ main(int argc, char **argv)
1057
1058
return EXIT_SUCCESS ;
1058
1059
1059
1060
bad_argument :
1060
- fprintf (stderr , "Try \"%s --help\" for more information.\n" , progname );
1061
+ fprintf (stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname );
1061
1062
return EXIT_FAILURE ;
1062
1063
}
0 commit comments