diff options
author | Bruce Momjian <bruce@momjian.us> | 2004-03-09 04:49:02 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2004-03-09 04:49:02 +0000 |
commit | f0f4e82f45462349bb30f3c4cc9792fa54525575 (patch) | |
tree | c6034542251d490ca2526b58278b8fc2e9dae0a7 /src/port/path.c | |
parent | 96ef6682e3fd4e940ac2e9451eb70afa3625e8c3 (diff) |
The win32 port backend will require the functionality provided by
canonicalize_path. Patch moves it from initdb.c to port/path.c.
Claudio Natoli
Diffstat (limited to 'src/port/path.c')
-rw-r--r-- | src/port/path.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/port/path.c b/src/port/path.c index c093efa4bc4..3f672d5b22e 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/path.c,v 1.4 2003/11/29 19:52:13 pgsql Exp $ + * $PostgreSQL: pgsql/src/port/path.c,v 1.5 2004/03/09 04:49:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -85,6 +85,32 @@ last_path_separator(const char *filename) /* + * make all paths look like unix, with forward slashes + * also strip any trailing slash. + * + * The Windows command processor will accept suitably quoted paths + * with forward slashes, but barfs badly with mixed forward and back + * slashes. Removing the trailing slash on a path means we never get + * ugly double slashes. Don't remove a leading slash, though. + */ +void +canonicalize_path(char *path) +{ + char *p; + + for (p = path; *p; p++) + { +#ifdef WIN32 + if (*p == '\\') + *p = '/'; +#endif + } + if (p > path+1 && *--p == '/') + *p = '\0'; +} + + +/* * Extracts the actual name of the program as called. */ char * |