OSDN Git Service

Remove init_nls() functions, call set_pglocale() directly.
authorBruce Momjian <bruce@momjian.us>
Tue, 1 Jun 2004 02:54:09 +0000 (02:54 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 1 Jun 2004 02:54:09 +0000 (02:54 +0000)
Add locale to pg_ctl.c.

src/bin/initdb/initdb.c
src/bin/scripts/clusterdb.c
src/bin/scripts/common.c
src/bin/scripts/common.h
src/bin/scripts/createdb.c
src/bin/scripts/createlang.c
src/bin/scripts/createuser.c
src/bin/scripts/dropdb.c
src/bin/scripts/droplang.c
src/bin/scripts/dropuser.c
src/bin/scripts/vacuumdb.c

index 9b22780..3a93931 100644 (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)
     {
index a912d0b..47eab33 100644 (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)
index 715d7e3..3e36d04 100644 (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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,16 +48,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.
  */
index 8898fc5..647be82 100644 (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 *);
 
index cf75e83..59bf2ad 100644 (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)
index 89eef3a..4c7a41e 100644 (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)
index d3b395f..0d6e7ba 100644 (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)
index 08331a0..535285f 100644 (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)
index fc7a942..5e2d8f4 100644 (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)
index a901b64..6c8bcf4 100644 (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)
index eb4fb0d..22dee1d 100644 (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)