aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-10-13 17:58:44 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-10-13 17:58:44 +0000
commita0fc05aa6ea7ac4a099f03babaea5929d6512a82 (patch)
treef1756d3c43dcf21015ba6c18084da8dbeac00cab /src
parent84cc9a4bb3c86345f58aa786715f0cdcb479a343 (diff)
downloadpostgresql-a0fc05aa6ea7ac4a099f03babaea5929d6512a82.tar.gz
postgresql-a0fc05aa6ea7ac4a099f03babaea5929d6512a82.zip
Go back to emitting path names with forward slashes on Windows.
I'm not clear on what the double-backslash idea was intended to fix, but it breaks at least mingw GNU Make. Per report from Thomas Hallgren.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_config/pg_config.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/src/bin/pg_config/pg_config.c b/src/bin/pg_config/pg_config.c
index 33983a5a9e6..b5ea5265a9d 100644
--- a/src/bin/pg_config/pg_config.c
+++ b/src/bin/pg_config/pg_config.c
@@ -17,7 +17,7 @@
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.15 2005/10/06 12:04:58 petere Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.16 2005/10/13 17:58:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,9 +32,9 @@ static char mypath[MAXPGPATH];
/*
* This function cleans up the paths for use with either cmd.exe or Msys
- * on Windows. We need them to use double backslashes and filenames without
- * spaces (for which a short filename is the safest equivalent) eg:
- * C:\\Progra~1\\
+ * on Windows. We need them to use filenames without spaces, for which a
+ * short filename is the safest equivalent, eg:
+ * C:/Progra~1/
*
* This can fail in 2 ways - if the path doesn't exist, or short names are
* disabled. In the first case, don't return any path. In the second case,
@@ -45,8 +45,7 @@ static void
cleanup_path(char *path)
{
#ifdef WIN32
- int x=0, y=0;
- char temp[MAXPGPATH];
+ char *ptr;
if (GetShortPathName(path, path, MAXPGPATH - 1) == 0)
{
@@ -59,31 +58,13 @@ cleanup_path(char *path)
return;
}
}
-
- /* Replace '\' with '\\'. */
- for (x = 0; x < strlen(path); x++)
- {
- if (path[x] == '/' || path[x] == '\\')
- {
- temp[y] = '\\';
- y++;
- temp[y] = '\\';
- }
- else
- {
- temp[y] = path[x];
- }
-
- y++;
-
- /* Bail out if we're too close to MAXPGPATH */
- if (y >= MAXPGPATH - 2)
- break;
+ /* Replace '\' with '/' */
+ for (ptr = path; *ptr; ptr++)
+ {
+ if (*ptr == '\\')
+ *ptr = '/';
}
- temp[y] = '\0';
-
- strncpy(path, temp, MAXPGPATH - 1);
#endif
}