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.32 2004/05/17 14:35:34 momjian Exp $
9+ * $PostgreSQL: pgsql/src/include/port.h,v 1.33 2004/05/19 04:21:49 momjian Exp $
1010 *
1111 *-------------------------------------------------------------------------
1212 */
2121bool set_noblock (int sock );
2222
2323/* Portable path handling for Unix/Win32 */
24- extern bool is_absolute_path (const char * filename );
2524extern char * first_path_separator (const char * filename );
2625extern char * last_path_separator (const char * filename );
2726extern void canonicalize_path (char * path );
@@ -32,6 +31,31 @@ extern void get_include_path(const char *my_exec_path, char *ret_path);
3231extern void get_pkginclude_path (const char * my_exec_path , char * ret_path );
3332extern void get_pkglib_path (const char * my_exec_path , char * ret_path );
3433
34+ /*
35+ * is_absolute_path
36+ *
37+ * This capability is needed by libpq and initdb.c
38+ * On Win32, you can't reference the same object file that is
39+ * in two different libraries (pgport and libpq), so a macro is best.
40+ */
41+ #ifndef WIN32
42+ #define is_absolute_path (filename ) \
43+ ( \
44+ ((filename)[0] == '/') \
45+ )
46+ #else
47+ #define is_absolute_path (filename ) \
48+ ( \
49+ ((filename)[0] == '/') || \
50+ (filename)[0] == '\\' || \
51+ (isalpha((filename)[0]) && (filename)[1] == ':' && \
52+ ((filename)[2] == '\\' || (filename)[2] == '/')) \
53+ )
54+ #endif
55+
56+
57+
58+
3559
3660/* Portable way to find binaries */
3761extern int find_my_exec (const char * argv0 , char * full_path );
0 commit comments