Break up the long usage messages in pg_dump and pg_restore and

unify the wording, to make life easier for translators.

from Dennis Bjorklund
This commit is contained in:
Peter Eisentraut 2002-08-28 20:57:22 +00:00
parent 03d39ce080
commit d54caa6b34
3 changed files with 161 additions and 164 deletions

View File

@ -22,7 +22,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.293 2002/08/27 21:04:58 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.294 2002/08/28 20:57:22 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -65,6 +65,7 @@
#include "pg_backup_archiver.h" #include "pg_backup_archiver.h"
#include "dumputils.h" #include "dumputils.h"
#define _(x) gettext((x))
typedef struct _dumpContext typedef struct _dumpContext
{ {
@ -420,9 +421,9 @@ main(int argc, char **argv)
else else
{ {
fprintf(stderr, fprintf(stderr,
gettext("%s: invalid -X option -- %s\n"), _("%s: invalid -X option -- %s\n"),
progname, optarg); progname, optarg);
fprintf(stderr, gettext("Try '%s --help' for more information.\n"), progname); fprintf(stderr, _("Try '%s --help' for more information.\n"), progname);
exit(1); exit(1);
} }
break; break;
@ -433,7 +434,7 @@ main(int argc, char **argv)
#ifndef HAVE_GETOPT_LONG #ifndef HAVE_GETOPT_LONG
case '-': case '-':
fprintf(stderr, fprintf(stderr,
gettext("%s was compiled without support for long options.\n" _("%s was compiled without support for long options.\n"
"Use --help for help on invocation options.\n"), "Use --help for help on invocation options.\n"),
progname); progname);
exit(1); exit(1);
@ -444,7 +445,7 @@ main(int argc, char **argv)
break; break;
#endif #endif
default: default:
fprintf(stderr, gettext("Try '%s --help' for more information.\n"), progname); fprintf(stderr, _("Try '%s --help' for more information.\n"), progname);
exit(1); exit(1);
} }
} }
@ -452,7 +453,7 @@ main(int argc, char **argv)
if (optind < (argc - 1)) if (optind < (argc - 1))
{ {
fprintf(stderr, fprintf(stderr,
gettext("%s: too many command line options (first is '%s')\n" _("%s: too many command line options (first is '%s')\n"
"Try '%s --help' for more information.\n"), "Try '%s --help' for more information.\n"),
progname, argv[optind + 1], progname); progname, argv[optind + 1], progname);
exit(1); exit(1);
@ -649,82 +650,80 @@ main(int argc, char **argv)
static void static void
help(const char *progname) help(const char *progname)
{ {
printf(gettext("%s dumps a database as a text file or to other formats.\n\n"), progname); printf(_("%s dumps a database as a text file or to other formats.\n\n"), progname);
puts(gettext("Usage:")); printf(_("Usage:\n"));
printf(gettext(" %s [options] dbname\n\n"), progname); printf(_(" %s [OPTIONS] DBNAME\n\n"), progname);
puts(gettext("Options:")); printf(_("Options:\n"));
#ifdef HAVE_GETOPT_LONG #ifdef HAVE_GETOPT_LONG
puts(gettext( printf(_( " -a, --data-only dump only the data, not the schema\n"));
" -a, --data-only dump only the data, not the schema\n" printf(_( " -b, --blobs include large objects in dump\n"));
" -b, --blobs include large objects in dump\n" printf(_( " -c, --clean clean (drop) schema prior to create\n"));
" -c, --clean clean (drop) schema prior to create\n" printf(_( " -C, --create include commands to create database in dump\n"));
" -C, --create include commands to create database in dump\n" printf(_( " -d, --inserts dump data as INSERT, rather than COPY, commands\n"));
" -d, --inserts dump data as INSERT, rather than COPY, commands\n" printf(_( " -D, --column-inserts dump data as INSERT commands with column names\n"));
" -D, --column-inserts dump data as INSERT commands with column names\n" printf(_( " -f, --file=FILENAME output file name\n"));
" -f, --file=FILENAME output file name\n" printf(_( " -F, --format {c|t|p} output file format (custom, tar, plain text)\n"));
" -F, --format {c|t|p} output file format (custom, tar, plain text)\n" printf(_( " -h, --host=HOSTNAME database server host name\n"));
" -h, --host=HOSTNAME database server host name\n" printf(_( " -i, --ignore-version proceed even when server version mismatches\n"
" -i, --ignore-version proceed even when server version mismatches\n" " pg_dump version\n"));
" pg_dump version\n" printf(_( " -o, --oids include OIDs in dump\n"));
" -o, --oids include OIDs in dump\n" printf(_( " -O, --no-owner do not output \\connect commands in plain\n"
" -O, --no-owner do not output \\connect commands in plain\n" " text format\n"));
" text format\n" printf(_( " -p, --port=PORT database server port number\n"));
" -p, --port=PORT database server port number\n" printf(_( " -R, --no-reconnect disable ALL reconnections to the database in\n"
" -R, --no-reconnect disable ALL reconnections to the database in\n" " plain text format\n"));
" plain text format\n" printf(_( " -s, --schema-only dump only the schema, no data\n"));
" -s, --schema-only dump only the schema, no data\n" printf(_( " -S, --superuser=NAME specify the superuser user name to use in\n"
" -S, --superuser=NAME specify the superuser user name to use in\n" " plain text format\n"));
" plain text format\n" printf(_( " -t, --table=TABLE dump this table only (* for all)\n"));
" -t, --table=TABLE dump this table only (* for all)\n" printf(_( " -U, --username=NAME connect as specified database user\n"));
" -U, --username=NAME connect as specified database user\n" printf(_( " -v, --verbose verbose mode\n"));
" -v, --verbose verbose mode\n" printf(_( " -W, --password force password prompt (should happen automatically)\n"));
" -W, --password force password prompt (should happen automatically)\n" printf(_( " -x, --no-privileges do not dump privileges (grant/revoke)\n"));
" -x, --no-privileges do not dump privileges (grant/revoke)\n" printf(_( " -X use-set-session-authorization, --use-set-session-authorization\n"
" -X use-set-session-authorization, --use-set-session-authorization\n" " output SET SESSION AUTHORIZATION commands rather\n"
" output SET SESSION AUTHORIZATION commands rather\n" " than \\connect commands\n"));
" than \\connect commands\n" printf(_( " -X disable-triggers, --disable-triggers\n"
" -X disable-triggers, --disable-triggers\n" " disable triggers during data-only restore\n"));
" disable triggers during data-only restore\n" printf(_( " -Z, --compress {0-9} compression level for compressed formats\n"));
" -Z, --compress {0-9} compression level for compressed formats\n"
)); #else /* not HAVE_GETOPT_LONG */
#else printf(_( " -a dump only the data, not the schema\n"));
puts(gettext( printf(_( " -b include large objects in dump\n"));
" -a dump only the data, not the schema\n" printf(_( " -c clean (drop) schema prior to create\n"));
" -b include large objects in dump\n" printf(_( " -C include commands to create database in dump\n"));
" -c clean (drop) schema prior to create\n" printf(_( " -d dump data as INSERT, rather than COPY, commands\n"));
" -C include commands to create database in dump\n" printf(_( " -D dump data as INSERT commands with column names\n"));
" -d dump data as INSERT, rather than COPY, commands\n" printf(_( " -f FILENAME output file name\n"));
" -D dump data as INSERT commands with column names\n" printf(_( " -F {c|t|p} output file format (custom, tar, plain text)\n"));
" -f FILENAME output file name\n" printf(_( " -h HOSTNAME database server host name\n"));
" -F {c|t|p} output file format (custom, tar, plain text)\n" printf(_( " -i proceed even when server version mismatches\n"
" -h HOSTNAME database server host name\n" " pg_dump version\n"));
" -i proceed even when server version mismatches\n" printf(_( " -o include OIDs in dump\n"));
" pg_dump version\n" printf(_( " -O do not output \\connect commands in plain\n"
" -o include OIDs in dump\n" " text format\n"));
" -O do not output \\connect commands in plain\n" printf(_( " -p PORT database server port number\n"));
" text format\n" printf(_( " -R disable ALL reconnections to the database in\n"
" -p PORT database server port number\n" " plain text format\n"));
" -R disable ALL reconnections to the database in\n" printf(_( " -s dump only the schema, no data\n"));
" plain text format\n" printf(_( " -S NAME specify the superuser user name to use in\n"
" -s dump only the schema, no data\n" " plain text format\n"));
" -S NAME specify the superuser user name to use in\n" printf(_( " -t TABLE dump this table only (* for all)\n"));
" plain text format\n" printf(_( " -U NAME connect as specified database user\n"));
" -t TABLE dump this table only (* for all)\n" printf(_( " -v verbose mode\n"));
" -U NAME connect as specified database user\n" printf(_( " -W force password prompt (should happen automatically)\n"));
" -v verbose mode\n" printf(_( " -x do not dump privileges (grant/revoke)\n"));
" -W force password prompt (should happen automatically)\n" printf(_( " -X use-set-session-authorization\n"
" -x do not dump privileges (grant/revoke)\n" " output SET SESSION AUTHORIZATION commands rather\n"
" -X use-set-session-authorization\n" " than \\connect commands\n"));
" output SET SESSION AUTHORIZATION commands rather\n" printf(_( " -X disable-triggers disable triggers during data-only restore\n"));
" than \\connect commands\n" printf(_( " -Z {0-9} compression level for compressed formats\n"));
" -X disable-triggers disable triggers during data-only restore\n"
" -Z {0-9} compression level for compressed formats\n"
));
#endif #endif
puts(gettext("If no database name is not supplied, then the PGDATABASE environment\n"
"variable value is used.\n\n" printf(_("\nIf no database name is not supplied, then the PGDATABASE environment\n"
"Report bugs to <pgsql-bugs@postgresql.org>.")); "variable value is used.\n\n"));
printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
} }
static int static int

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* *
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.3 2002/08/28 18:25:05 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.4 2002/08/28 20:57:22 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -237,7 +237,7 @@ help(void)
printf(_(" -h HOSTNAME database server host name\n")); printf(_(" -h HOSTNAME database server host name\n"));
printf(_(" -i proceed even when server version mismatches\n" printf(_(" -i proceed even when server version mismatches\n"
" pg_dumpall version\n")); " pg_dumpall version\n"));
printf(_(" -o include oids in dump\n")); printf(_(" -o include OIDs in dump\n"));
printf(_(" -p PORT database server port number\n")); printf(_(" -p PORT database server port number\n"));
printf(_(" -U NAME connect as specified database user\n")); printf(_(" -U NAME connect as specified database user\n"));
printf(_(" -v verbose mode\n")); printf(_(" -v verbose mode\n"));

View File

@ -34,7 +34,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.39 2002/08/27 18:57:26 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.40 2002/08/28 20:57:22 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -63,6 +63,8 @@
#include <locale.h> #include <locale.h>
#endif #endif
#define _(x) gettext((x))
/* Forward decls */ /* Forward decls */
static void usage(const char *progname); static void usage(const char *progname);
static char *_cleanupName(char *name); static char *_cleanupName(char *name);
@ -276,9 +278,9 @@ main(int argc, char **argv)
else else
{ {
fprintf(stderr, fprintf(stderr,
gettext("%s: invalid -X option -- %s\n"), _("%s: invalid -X option -- %s\n"),
progname, optarg); progname, optarg);
fprintf(stderr, gettext("Try '%s --help' for more information.\n"), progname); fprintf(stderr, _("Try '%s --help' for more information.\n"), progname);
exit(1); exit(1);
} }
break; break;
@ -290,7 +292,7 @@ main(int argc, char **argv)
#endif #endif
default: default:
fprintf(stderr, gettext("Try '%s --help' for more information.\n"), progname); fprintf(stderr, _("Try '%s --help' for more information.\n"), progname);
exit(1); exit(1);
} }
} }
@ -371,89 +373,85 @@ main(int argc, char **argv)
static void static void
usage(const char *progname) usage(const char *progname)
{ {
printf(gettext( printf(_("%s restores a PostgreSQL database from an archive created by pg_dump.\n\n"), progname);
"%s restores a PostgreSQL database from an archive created by pg_dump.\n\n" printf(_("Usage:\n"));
"Usage:\n %s [options] [file]\n\n" printf(_(" %s [OPTIONS] [FILE]\n\n"), progname);
"Options:\n"), printf(_("Options:\n"));
progname, progname);
#ifdef HAVE_GETOPT_LONG #ifdef HAVE_GETOPT_LONG
puts(gettext( printf(_( " -a, --data-only restore only the data, no schema\n"));
" -a, --data-only restore only the data, no schema\n" printf(_( " -c, --clean clean (drop) schema prior to create\n"));
" -c, --clean clean (drop) schema prior to create\n" printf(_( " -C, --create issue commands to create the database\n"));
" -C, --create issue commands to create the database\n" printf(_( " -d, --dbname=NAME output database name\n"));
" -d, --dbname=NAME output database name\n" printf(_( " -f, --file=FILENAME output file name\n"));
" -f, --file=FILENAME output file name\n" printf(_( " -F, --format={c|t} specify backup file format\n"));
" -F, --format={c|t} specify backup file format\n" printf(_( " -h, --host=HOSTNAME database server host name\n"));
" -h, --host=HOSTNAME server host name\n" printf(_( " -i, --ignore-version proceed even when server version mismatches\n"));
" -i, --ignore-version proceed even when server version mismatches\n" printf(_( " -I, --index=NAME restore named index\n"));
" -I, --index=NAME restore named index\n" printf(_( " -l, --list print summarized TOC of the archive\n"));
" -l, --list print summarized TOC of the archive\n" printf(_( " -L, --use-list=FILENAME use specified table of contents for ordering\n"
" -L, --use-list=FILENAME use specified table of contents for ordering\n" " output from this file\n"));
" output from this file\n" printf(_( " -N, --orig-order restore in original dump order\n"));
" -N, --orig-order restore in original dump order\n" printf(_( " -o, --oid-order restore in OID order\n"));
" -o, --oid-order restore in OID order\n" printf(_( " -O, --no-owner do not reconnect to database to match\n"
" -O, --no-owner do not reconnect to database to match\n" " object owner\n"));
" object owner\n" printf(_( " -p, --port=PORT database server port number\n"));
" -p, --port=PORT server port number\n" printf(_( " -P, --function=NAME(args)restore named function\n"));
" -P, --function=NAME(args)restore named function\n" printf(_( " -r, --rearrange rearrange output to put indexes etc. at end\n"));
" -r, --rearrange rearrange output to put indexes etc. at end\n" printf(_( " -R, --no-reconnect disallow ALL reconnections to the database\n"));
" -R, --no-reconnect disallow ALL reconnections to the database\n" printf(_( " -s, --schema-only restore only the schema, no data\n"));
" -s, --schema-only restore only the schema, no data\n" printf(_( " -S, --superuser=NAME specify the superuser user name to use for\n"
" -S, --superuser=NAME specify the superuser user name to use for\n" " disabling triggers\n"));
" disabling triggers\n" printf(_( " -t, --table=NAME restore named table\n"));
" -t, --table=NAME restore named table\n" printf(_( " -T, --trigger=NAME restore named trigger\n"));
" -T, --trigger=NAME restore named trigger\n" printf(_( " -U, --username=NAME connect as specified database user\n"));
" -U, --username=NAME connect as specified database user\n" printf(_( " -v, --verbose verbose mode\n"));
" -v, --verbose verbose mode\n" printf(_( " -W, --password force password prompt (should happen automatically)\n"));
" -W, --password force password prompt (should happen automatically)\n" printf(_( " -x, --no-privileges skip restoration of access privileges (grant/revoke)\n"));
" -x, --no-privileges skip restoration of access privileges (grant/revoke)\n" printf(_( " -X use-set-session-authorization, --use-set-session-authorization\n"
" -X use-set-session-authorization, --use-set-session-authorization\n" " use SET SESSION AUTHORIZATION commands instead\n"
" use SET SESSION AUTHORIZATION commands instead\n" " of reconnecting, if possible\n"));
" of reconnecting, if possible\n" printf(_( " -X disable-triggers, --disable-triggers\n"
" -X disable-triggers, --disable-triggers\n" " disable triggers during data-only restore\n"));
" disable triggers during data-only restore\n"
));
#else /* not HAVE_GETOPT_LONG */ #else /* not HAVE_GETOPT_LONG */
printf(_( " -a restore only the data, no schema\n"));
puts(gettext( printf(_( " -c clean (drop) schema prior to create\n"));
" -a restore only the data, no schema\n" printf(_( " -C issue commands to create the database\n"));
" -c clean (drop) schema prior to create\n" printf(_( " -d NAME output database name\n"));
" -C issue commands to create the database\n" printf(_( " -f FILENAME output file name\n"));
" -d NAME output database name\n" printf(_( " -F {c|t} specify backup file format\n"));
" -f FILENAME output file name\n" printf(_( " -h HOSTNAME database server host name\n"));
" -F {c|t} specify backup file format\n" printf(_( " -i proceed even when server version mismatches\n"));
" -h HOSTNAME server host name\n" printf(_( " -I NAME restore named index\n"));
" -i proceed even when server version mismatches\n" printf(_( " -l print summarized TOC of the archive\n"));
" -I NAME restore named index\n" printf(_( " -L FILENAME use specified table of contents for ordering\n"
" -l print summarized TOC of the archive\n" " output from this file\n"));
" -L FILENAME use specified table of contents for ordering\n" printf(_( " -N restore in original dump order\n"));
" output from this file\n" printf(_( " -o restore in OID order\n"));
" -N restore in original dump order\n" printf(_( " -O do not reconnect to database to match\n"
" -o restore in OID order\n" " object owner\n"));
" -O do not reconnect to database to match\n" printf(_( " -p PORT database server port number\n"));
" object owner\n" printf(_( " -P NAME(args) restore named function\n"));
" -p PORT server port number\n" printf(_( " -r rearrange output to put indexes etc. at end\n"));
" -P NAME(args) restore named function\n" printf(_( " -R disallow ALL reconnections to the database\n"));
" -r rearrange output to put indexes etc. at end\n" printf(_( " -s restore only the schema, no data\n"));
" -R disallow ALL reconnections to the database\n" printf(_( " -S NAME specify the superuser user name to use for\n"
" -s restore only the schema, no data\n" " disabling triggers\n"));
" -S NAME specify the superuser user name to use for\n" printf(_( " -t NAME restore named table\n"));
" disabling triggers\n" printf(_( " -T NAME restore named trigger\n"));
" -t NAME restore named table\n" printf(_( " -U NAME connect as specified database user\n"));
" -T NAME restore named trigger\n" printf(_( " -v verbose mode\n"));
" -U NAME connect as specified database user\n" printf(_( " -W force password prompt (should happen automatically)\n"));
" -v verbose mode\n" printf(_( " -x skip restoration of access privileges (grant/revoke)\n"));
" -W force password prompt (should happen automatically)\n" printf(_( " -X use-set-session-authorization\n"
" -x skip restoration of access privileges (grant/revoke)\n" " use SET SESSION AUTHORIZATION commands instead\n"
" -X use-set-session-authorization\n" " of reconnecting, if possible\n"));
" use SET SESSION AUTHORIZATION commands instead\n" printf(_( " -X disable-triggers disable triggers during data-only restore\n"));
" of reconnecting, if possible\n"
" -X disable-triggers disable triggers during data-only restore\n"
));
#endif #endif
puts(gettext("If no input file name is supplied, then standard input is used.\n"));
puts(gettext("Report bugs to <pgsql-bugs@postgresql.org>.")); printf(_("\nIf no input file name is supplied, then standard input is used.\n\n"));
printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
} }