Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf0f4e82

Browse files
committed
The win32 port backend will require the functionality provided by
canonicalize_path. Patch moves it from initdb.c to port/path.c.Claudio Natoli
1 parent96ef668 commitf0f4e82

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* Portions Copyright (c) 1994, Regents of the University of California
4444
* Portions taken from FreeBSD.
4545
*
46-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.22 2004/02/02 00:11:31 momjian Exp $
46+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.23 2004/03/09 04:49:02 momjian Exp $
4747
*
4848
*-------------------------------------------------------------------------
4949
*/
@@ -151,7 +151,6 @@ char *pgpath;
151151
/* forward declare all our functions */
152152
staticboolrmtree(char*,bool);
153153
staticvoidexit_nicely(void);
154-
staticvoidcanonicalize_path(char*);
155154
#ifdefWIN32
156155
staticchar*expanded_path(char*);
157156
#else
@@ -288,31 +287,6 @@ rmtree(char *path, bool rmtopdir)
288287
}
289288

290289

291-
/*
292-
* make all paths look like unix, with forward slashes
293-
* also strip any trailing slash.
294-
*
295-
* The Windows command processor will accept suitably quoted paths
296-
* with forward slashes, but barfs badly with mixed forward and back
297-
* slashes. Removing the trailing slash on a path means we never get
298-
* ugly double slashes. Don't remove a leading slash, though.
299-
*/
300-
staticvoid
301-
canonicalize_path(char*path)
302-
{
303-
char*p;
304-
305-
for (p=path;*p;p++)
306-
{
307-
#ifdefWIN32
308-
if (*p=='\\')
309-
*p='/';
310-
#endif
311-
}
312-
if (p>path+1&&*--p=='/')
313-
*p='\0';
314-
}
315-
316290
/*
317291
* make a copy of the array of lines, with token replaced by replacement
318292
* the first time it occurs on each line.

‎src/include/port.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.20 2004/02/25 19:41:23 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.21 2004/03/09 04:49:02 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -21,6 +21,7 @@
2121
externboolis_absolute_path(constchar*filename);
2222
externchar*first_path_separator(constchar*filename);
2323
externchar*last_path_separator(constchar*filename);
24+
externvoidcanonicalize_path(char*path);
2425
externchar*get_progname(char*argv0);
2526

2627
/* Portable delay handling */

‎src/port/path.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.4 2003/11/29 19:52:13 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.5 2004/03/09 04:49:02 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -84,6 +84,32 @@ last_path_separator(const char *filename)
8484
}
8585

8686

87+
/*
88+
* make all paths look like unix, with forward slashes
89+
* also strip any trailing slash.
90+
*
91+
* The Windows command processor will accept suitably quoted paths
92+
* with forward slashes, but barfs badly with mixed forward and back
93+
* slashes. Removing the trailing slash on a path means we never get
94+
* ugly double slashes. Don't remove a leading slash, though.
95+
*/
96+
void
97+
canonicalize_path(char*path)
98+
{
99+
char*p;
100+
101+
for (p=path;*p;p++)
102+
{
103+
#ifdefWIN32
104+
if (*p=='\\')
105+
*p='/';
106+
#endif
107+
}
108+
if (p>path+1&&*--p=='/')
109+
*p='\0';
110+
}
111+
112+
87113
/*
88114
* Extracts the actual name of the program as called.
89115
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp