1717 *
1818 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
1919 *
20- * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.15 2005/10/06 12:04:58 petere Exp $
20+ * $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.16 2005/10/13 17:58:44 tgl Exp $
2121 *
2222 *-------------------------------------------------------------------------
2323 */
@@ -32,9 +32,9 @@ static charmypath[MAXPGPATH];
3232
3333/*
3434 * This function cleans up the paths for use with either cmd.exe or Msys
35- * on Windows. We need them to usedouble backslashes and filenames without
36- *spaces (for which a short filename is the safest equivalent) eg:
37- * C:\\ Progra~1\\
35+ * on Windows. We need them to usefilenames without spaces, for which a
36+ * short filename is the safest equivalent, eg:
37+ *C:/ Progra~1/
3838 *
3939 * This can fail in 2 ways - if the path doesn't exist, or short names are
4040 * disabled. In the first case, don't return any path. In the second case,
@@ -45,8 +45,7 @@ static void
4545cleanup_path (char * path )
4646{
4747#ifdef WIN32
48- int x = 0 ,y = 0 ;
49- char temp [MAXPGPATH ];
48+ char * ptr ;
5049
5150if (GetShortPathName (path ,path ,MAXPGPATH - 1 )== 0 )
5251{
@@ -59,31 +58,13 @@ cleanup_path(char *path)
5958return ;
6059}
6160}
62-
6361
64- /* Replace '\' with '\\'. */
65- for (x = 0 ;x < strlen (path );x ++ )
66- {
67- if (path [x ]== '/' || path [x ]== '\\' )
68- {
69- temp [y ]= '\\' ;
70- y ++ ;
71- temp [y ]= '\\' ;
72- }
73- else
74- {
75- temp [y ]= path [x ];
76- }
77-
78- y ++ ;
79-
80- /* Bail out if we're too close to MAXPGPATH */
81- if (y >=MAXPGPATH - 2 )
82- break ;
62+ /* Replace '\' with '/' */
63+ for (ptr = path ;* ptr ;ptr ++ )
64+ {
65+ if (* ptr == '\\' )
66+ * ptr = '/' ;
8367}
84- temp [y ]= '\0' ;
85-
86- strncpy (path ,temp ,MAXPGPATH - 1 );
8768#endif
8869}
8970