Remove init_nls() functions, call set_pglocale() directly.

Add locale to pg_ctl.c.
This commit is contained in:
Bruce Momjian 2004-06-01 02:54:09 +00:00
parent 66fa6eba5a
commit 6c33054a0c
11 changed files with 27 additions and 41 deletions

View File

@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.33 2004/05/25 01:00:22 momjian Exp $
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.34 2004/06/01 02:53:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -167,7 +167,6 @@ static void check_ok(void);
static bool chklocale(const char *locale);
static void setlocales(void);
static void usage(const char *progname);
static void init_nls(const char *argv0);
/*
@ -1750,16 +1749,6 @@ usage(const char *progname)
printf(_("\nReport bugs to <pgsql-bugs@postgresql.org>.\n"));
}
/*
* Initialized NLS if enabled.
*/
static void
init_nls(const char *argv0)
{
set_pglocale(argv0, "initdb");
}
int
main(int argc, char *argv[])
{
@ -1797,9 +1786,9 @@ main(int argc, char *argv[])
* environment */
char *subdirs[] =
{"global", "pg_xlog", "pg_clog", "base", "base/1"};
init_nls(argv[0]);
progname = get_progname(argv[0]);
set_pglocale(argv[0], "initdb");
if (argc > 1)
{

View File

@ -4,7 +4,7 @@
*
* Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.7 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.8 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -58,7 +58,8 @@ main(int argc, char *argv[])
char *table = NULL;
progname = get_progname(argv[0]);
init_nls(argv[0]);
set_pglocale(argv[0], "pgscripts");
handle_help_version_opts(argc, argv, "clusterdb", help);
while ((c = getopt_long(argc, argv, "h:p:U:Weqd:at:", long_options, &optindex)) != -1)

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.8 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.9 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -47,16 +47,6 @@ get_user_name(const char *progname)
}
/*
* Initialized NLS if enabled.
*/
void
init_nls(const char *argv0)
{
set_pglocale(argv0, "pgscripts");
}
/*
* Provide strictly harmonized handling of --help and --version
* options.

View File

@ -11,7 +11,6 @@ int optreset;
const char *get_user_name(const char *progname);
#define _(x) gettext((x))
void init_nls(const char *argv0);
typedef void (*help_handler) (const char *);

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.9 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.10 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -60,7 +60,8 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
init_nls(argv[0]);
set_pglocale(argv[0], "pgscripts");
handle_help_version_opts(argc, argv, "createdb", help);
while ((c = getopt_long(argc, argv, "h:p:U:WeqO:D:T:E:", long_options, &optindex)) != -1)

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.10 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.11 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -61,7 +61,8 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
init_nls(argv[0]);
set_pglocale(argv[0], "pgscripts");
handle_help_version_opts(argc, argv, "createlang", help);
while ((c = getopt_long(argc, argv, "lh:p:U:Wd:L:e", long_options, &optindex)) != -1)

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.11 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.12 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -63,7 +63,8 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
init_nls(argv[0]);
set_pglocale(argv[0], "pgscripts");
handle_help_version_opts(argc, argv, "createuser", help);
while ((c = getopt_long(argc, argv, "h:p:U:WeqaAdDi:PEN", long_options, &optindex)) != -1)

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.10 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.11 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -51,7 +51,8 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
init_nls(argv[0]);
set_pglocale(argv[0], "pgscripts");
handle_help_version_opts(argc, argv, "dropdb", help);
while ((c = getopt_long(argc, argv, "h:p:U:Weqi", long_options, &optindex)) != -1)

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/droplang.c,v 1.9 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/droplang.c,v 1.10 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -61,7 +61,8 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
init_nls(argv[0]);
set_pglocale(argv[0], "pgscripts");
handle_help_version_opts(argc, argv, "droplang", help);
while ((c = getopt_long(argc, argv, "lh:p:U:Wd:e", long_options, &optindex)) != -1)

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.9 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.10 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -51,7 +51,8 @@ main(int argc, char *argv[])
PGresult *result;
progname = get_progname(argv[0]);
init_nls(argv[0]);
set_pglocale(argv[0], "pgscripts");
handle_help_version_opts(argc, argv, "dropuser", help);
while ((c = getopt_long(argc, argv, "h:p:U:Weqi", long_options, &optindex)) != -1)

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.7 2004/05/25 01:00:27 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.8 2004/06/01 02:54:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -66,7 +66,8 @@ main(int argc, char *argv[])
bool verbose = false;
progname = get_progname(argv[0]);
init_nls(argv[0]);
set_pglocale(argv[0], "pgscripts");
handle_help_version_opts(argc, argv, "vacuumdb", help);
while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zat:fv", long_options, &optindex)) != -1)