summaryrefslogtreecommitdiff
path: root/src/port/exec.c
diff options
context:
space:
mode:
authorBruce Momjian2004-06-10 22:26:24 +0000
committerBruce Momjian2004-06-10 22:26:24 +0000
commit6cc4175b256cfc87411f9e704f9a34cf54f6b256 (patch)
tree7bdf7438dc345bd1154f30efd2cc097f3f0c0c4e /src/port/exec.c
parentd4117de50a78afb11d5b7004aa4e34540dc9193a (diff)
Attached is a patch that takes care of the PATHSEP issue. I made a more
extensive change then what was suggested. I found the file path.c that contained a lot of "Unix/Windows" agnostic functions so I added a function there instead and removed the PATHSEP declaration in exec.c altogether. All to keep things from scattering all over the code. I also took the liberty of changing the name of the functions "first_path_sep" and "last_path_sep". Where I come from (and I'm apparently not alone given the former macro name PATHSEP), they should be called "first_dir_sep" and "last_dir_sep". The new function I introduced, that actually finds path separators, is now the "first_path_sep". The patch contains changes on all affected places of course. I also changed the documentation on dynamic_library_path to reflect the chagnes. Thomas Hallgren
Diffstat (limited to 'src/port/exec.c')
-rw-r--r--src/port/exec.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/port/exec.c b/src/port/exec.c
index dbdc04b0ba2..c8ba1227a15 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.15 2004/05/24 22:35:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.16 2004/06/10 22:26:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,13 +28,6 @@
#define _(x) gettext(x)
-/* $PATH (or %PATH%) path separator */
-#ifdef WIN32
-#define PATHSEP ';'
-#else
-#define PATHSEP ':'
-#endif
-
#ifndef S_IRUSR /* XXX [TRH] should be in a header */
#define S_IRUSR S_IREAD
#define S_IWUSR S_IWRITE
@@ -196,7 +189,7 @@ find_my_exec(const char *argv0, char *retpath)
* it).
*/
/* Does argv0 have a separator? */
- if ((path = last_path_separator(argv0)))
+ if ((path = last_dir_separator(argv0)))
{
if (*++path == '\0')
{
@@ -247,7 +240,7 @@ find_my_exec(const char *argv0, char *retpath)
else
startp = endp + 1;
- endp = strchr(startp, PATHSEP);
+ endp = first_path_separator(startp);
if (!endp)
endp = startp + strlen(startp); /* point to end */
@@ -303,7 +296,7 @@ find_other_exec(const char *argv0, const char *target,
return -1;
/* Trim off program name and keep just directory */
- *last_path_separator(retpath) = '\0';
+ *last_dir_separator(retpath) = '\0';
snprintf(retpath + strlen(retpath), MAXPGPATH - strlen(retpath),
"/%s%s", target, EXE);