summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorTom Lane2006-09-11 20:10:30 +0000
committerTom Lane2006-09-11 20:10:30 +0000
commit568b80168f1166a4f6cffad90fd030ee280519e8 (patch)
tree568189043aa038440f87bfcde18880d8dcac5fef /src/port
parent7ce2ff2d22aba9442347e94dd62fe2212d0adb27 (diff)
Move set_pglocale_pgservice() from path.c to exec.c, so that pulling in
path.c does not in itself force linking of both exec.c and libintl. Should fix current ecpglib build failure on pickier platforms.
Diffstat (limited to 'src/port')
-rw-r--r--src/port/exec.c54
-rw-r--r--src/port/path.c50
2 files changed, 54 insertions, 50 deletions
diff --git a/src/port/exec.c b/src/port/exec.c
index 7abc3d650b6..642bd5fdc9e 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.42 2006/06/07 22:24:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.43 2006/09/11 20:10:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -590,3 +590,55 @@ pclose_check(FILE *stream)
return -1;
}
+
+
+/*
+ * set_pglocale_pgservice
+ *
+ * Set application-specific locale and service directory
+ *
+ * This function takes the value of argv[0] rather than a full path.
+ *
+ * (You may be wondering why this is in exec.c. It requires this module's
+ * services and doesn't introduce any new dependencies, so this seems as
+ * good as anyplace.)
+ */
+void
+set_pglocale_pgservice(const char *argv0, const char *app)
+{
+ char path[MAXPGPATH];
+ char my_exec_path[MAXPGPATH];
+ char env_path[MAXPGPATH + sizeof("PGSYSCONFDIR=")]; /* longer than
+ * PGLOCALEDIR */
+
+ /* don't set LC_ALL in the backend */
+ if (strcmp(app, "postgres") != 0)
+ setlocale(LC_ALL, "");
+
+ if (find_my_exec(argv0, my_exec_path) < 0)
+ return;
+
+#ifdef ENABLE_NLS
+ get_locale_path(my_exec_path, path);
+ bindtextdomain(app, path);
+ textdomain(app);
+
+ if (getenv("PGLOCALEDIR") == NULL)
+ {
+ /* set for libpq to use */
+ snprintf(env_path, sizeof(env_path), "PGLOCALEDIR=%s", path);
+ canonicalize_path(env_path + 12);
+ putenv(strdup(env_path));
+ }
+#endif
+
+ if (getenv("PGSYSCONFDIR") == NULL)
+ {
+ get_etc_path(my_exec_path, path);
+
+ /* set for libpq to use */
+ snprintf(env_path, sizeof(env_path), "PGSYSCONFDIR=%s", path);
+ canonicalize_path(env_path + 13);
+ putenv(strdup(env_path));
+ }
+}
diff --git a/src/port/path.c b/src/port/path.c
index cb7ab9eb22b..818b3212c43 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/path.c,v 1.66 2006/03/05 15:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/path.c,v 1.67 2006/09/11 20:10:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -653,54 +653,6 @@ get_parent_directory(char *path)
/*
- * set_pglocale_pgservice
- *
- * Set application-specific locale and service directory
- *
- * This function takes an argv[0] rather than a full path.
- */
-void
-set_pglocale_pgservice(const char *argv0, const char *app)
-{
- char path[MAXPGPATH];
- char my_exec_path[MAXPGPATH];
- char env_path[MAXPGPATH + sizeof("PGSYSCONFDIR=")]; /* longer than
- * PGLOCALEDIR */
-
- /* don't set LC_ALL in the backend */
- if (strcmp(app, "postgres") != 0)
- setlocale(LC_ALL, "");
-
- if (find_my_exec(argv0, my_exec_path) < 0)
- return;
-
-#ifdef ENABLE_NLS
- get_locale_path(my_exec_path, path);
- bindtextdomain(app, path);
- textdomain(app);
-
- if (getenv("PGLOCALEDIR") == NULL)
- {
- /* set for libpq to use */
- snprintf(env_path, sizeof(env_path), "PGLOCALEDIR=%s", path);
- canonicalize_path(env_path + 12);
- putenv(strdup(env_path));
- }
-#endif
-
- if (getenv("PGSYSCONFDIR") == NULL)
- {
- get_etc_path(my_exec_path, path);
-
- /* set for libpq to use */
- snprintf(env_path, sizeof(env_path), "PGSYSCONFDIR=%s", path);
- canonicalize_path(env_path + 13);
- putenv(strdup(env_path));
- }
-}
-
-
-/*
* trim_directory
*
* Trim trailing directory from path, that is, remove any trailing slashes,