Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
f39cfbe4
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f39cfbe4
编写于
10月 05, 2005
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix pgxs for spaces in file names on Win32
Dave Page
上级
0f397b9e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
86 addition
and
14 deletion
+86
-14
src/bin/pg_config/pg_config.c
src/bin/pg_config/pg_config.c
+86
-14
未找到文件。
src/bin/pg_config/pg_config.c
浏览文件 @
f39cfbe4
...
...
@@ -17,7 +17,7 @@
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.1
3 2005/09/27 17:39:33 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/pg_config/pg_config.c,v 1.1
4 2005/10/05 12:16:28 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -30,6 +30,64 @@ static const char *progname;
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\\
*
* 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,
* we leave the path in the long form. In this case, it does still seem to
* fix elements containing spaces which is all we actually need.
*/
static
void
cleanup_path
(
char
*
path
)
{
#ifdef WIN32
int
x
=
0
,
y
=
0
;
char
temp
[
MAXPGPATH
];
if
(
GetShortPathName
(
path
,
path
,
MAXPGPATH
-
1
)
==
0
)
{
/* Ignore ERROR_INVALID_PARAMETER as it almost certainly
* means that short names are disabled
*/
if
(
GetLastError
()
!=
ERROR_INVALID_PARAMETER
)
{
path
[
0
]
=
'\0'
;
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
;
}
temp
[
y
]
=
'\0'
;
strncpy
(
path
,
temp
,
MAXPGPATH
-
1
);
#endif
}
/*
* For each piece of information known to pg_config, we define a subroutine
* to print it. This is probably overkill, but it avoids code duplication
...
...
@@ -39,138 +97,152 @@ static char mypath[MAXPGPATH];
static
void
show_bindir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
*
lastsep
;
char
path
[
MAXPGPATH
];
char
*
lastsep
;
if
(
all
)
printf
(
"BINDIR = "
);
/* assume we are located in the bindir */
strcpy
(
path
,
mypath
);
lastsep
=
strrchr
(
path
,
'/'
);
if
(
lastsep
)
*
lastsep
=
'\0'
;
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_docdir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"DOCDIR = "
);
get_doc_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_includedir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"INCLUDEDIR = "
);
get_include_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_pkgincludedir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"PKGINCLUDEDIR = "
);
get_pkginclude_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_includedir_server
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"INCLUDEDIR-SERVER = "
);
get_includeserver_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_libdir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"LIBDIR = "
);
get_lib_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_pkglibdir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"PKGLIBDIR = "
);
get_pkglib_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_localedir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"LOCALEDIR = "
);
get_locale_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_mandir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"MANDIR = "
);
get_man_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_sharedir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"SHAREDIR = "
);
get_share_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_sysconfdir
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"SYSCONFDIR = "
);
get_etc_path
(
mypath
,
path
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
static
void
show_pgxs
(
bool
all
)
{
char
path
[
MAXPGPATH
];
char
path
[
MAXPGPATH
];
if
(
all
)
printf
(
"PGXS = "
);
get_pkglib_path
(
mypath
,
path
);
strncat
(
path
,
"/pgxs/src/makefiles/pgxs.mk"
,
MAXPGPATH
-
1
);
cleanup_path
(
path
);
printf
(
"%s
\n
"
,
path
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录