Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
1abf13db
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,发现更多精彩内容 >>
提交
1abf13db
编写于
8月 18, 2004
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add get_home_path() to use USERPROFILE on Win32 and HOME on Unix.
上级
19cd31b0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
25 deletion
+47
-25
src/bin/psql/common.c
src/bin/psql/common.c
+6
-6
src/bin/psql/input.c
src/bin/psql/input.c
+5
-7
src/bin/psql/startup.c
src/bin/psql/startup.c
+3
-3
src/include/port.h
src/include/port.h
+8
-4
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+3
-4
src/port/path.c
src/port/path.c
+22
-1
未找到文件。
src/bin/psql/common.c
浏览文件 @
1abf13db
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.8
7 2004/05/23 22:20:10 neilc
Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.8
8 2004/08/18 02:59:11 momjian
Exp $
*/
#include "postgres_fe.h"
#include "common.h"
...
...
@@ -1078,13 +1078,13 @@ expand_tilde(char **filename)
if
(
**
filename
==
'~'
)
{
char
*
fn
;
char
*
home
;
char
oldp
,
*
p
;
struct
passwd
*
pw
;
char
home
[
MAXPGPATH
];
fn
=
*
filename
;
home
=
NULL
;
*
home
=
'\0'
;
p
=
fn
+
1
;
while
(
*
p
!=
'/'
&&
*
p
!=
'\0'
)
...
...
@@ -1094,12 +1094,12 @@ expand_tilde(char **filename)
*
p
=
'\0'
;
if
(
*
(
fn
+
1
)
==
'\0'
)
home
=
getenv
(
"HOME"
);
get_home_path
(
home
);
else
if
((
pw
=
getpwnam
(
fn
+
1
))
!=
NULL
)
home
=
pw
->
pw_dir
;
StrNCpy
(
home
,
pw
->
pw_dir
,
MAXPGPATH
)
;
*
p
=
oldp
;
if
(
home
)
if
(
strlen
(
home
)
!=
0
)
{
char
*
newfn
;
...
...
src/bin/psql/input.c
浏览文件 @
1abf13db
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.3
4 2004/01/25 03:07:22 neilc
Exp $
* $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.3
5 2004/08/18 02:59:11 momjian
Exp $
*/
#include "postgres_fe.h"
#include "input.h"
...
...
@@ -171,7 +171,7 @@ initializeInput(int flags)
#ifdef USE_READLINE
if
(
flags
&
1
)
{
c
onst
char
*
home
;
c
har
home
[
MAXPGPATH
]
;
useReadline
=
true
;
initialize_readline
();
...
...
@@ -180,8 +180,7 @@ initializeInput(int flags)
if
(
GetVariable
(
pset
.
vars
,
"HISTSIZE"
)
==
NULL
)
SetVariable
(
pset
.
vars
,
"HISTSIZE"
,
"500"
);
using_history
();
home
=
getenv
(
"HOME"
);
if
(
home
)
if
(
get_home_path
(
home
))
{
char
*
psql_history
;
...
...
@@ -231,10 +230,9 @@ finishInput(int exitstatus, void *arg)
#ifdef USE_READLINE
if
(
useHistory
)
{
char
*
home
;
char
home
[
MAXPGPATH
]
;
home
=
getenv
(
"HOME"
);
if
(
home
)
if
(
get_home_path
(
home
))
{
char
*
psql_history
;
int
hist_size
;
...
...
src/bin/psql/startup.c
浏览文件 @
1abf13db
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.9
5 2004/06/03 00:07:37
momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.9
6 2004/08/18 02:59:11
momjian Exp $
*/
#include "postgres_fe.h"
...
...
@@ -570,8 +570,8 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
static
void
process_psqlrc
(
char
*
argv0
)
{
char
*
home
;
char
*
psqlrc
;
char
home
[
MAXPGPATH
];
char
global_file
[
MAXPGPATH
];
char
my_exec_path
[
MAXPGPATH
];
char
etc_path
[
MAXPGPATH
];
...
...
@@ -582,7 +582,7 @@ process_psqlrc(char *argv0)
snprintf
(
global_file
,
MAXPGPATH
,
"%s/%s"
,
etc_path
,
SYSPSQLRC
);
process_psqlrc_file
(
global_file
);
if
(
(
home
=
getenv
(
"HOME"
))
!=
NULL
)
if
(
get_home_path
(
home
)
)
{
psqlrc
=
pg_malloc
(
strlen
(
home
)
+
1
+
strlen
(
PSQLRC
)
+
1
);
sprintf
(
psqlrc
,
"%s/%s"
,
home
,
PSQLRC
);
...
...
src/include/port.h
浏览文件 @
1abf13db
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.5
3 2004/08/17 14:38:38
momjian Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.5
4 2004/08/18 02:59:11
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -50,6 +50,7 @@ extern void get_lib_path(const char *my_exec_path, char *ret_path);
extern
void
get_pkglib_path
(
const
char
*
my_exec_path
,
char
*
ret_path
);
extern
void
get_locale_path
(
const
char
*
my_exec_path
,
char
*
ret_path
);
extern
void
set_pglocale_pgservice
(
const
char
*
argv0
,
const
char
*
app
);
extern
bool
get_home_path
(
char
*
ret_path
);
/*
* is_absolute_path
...
...
@@ -74,9 +75,6 @@ extern void set_pglocale_pgservice(const char *argv0, const char *app);
#endif
/* Portable way to find binaries */
extern
int
find_my_exec
(
const
char
*
argv0
,
char
*
retpath
);
extern
int
find_other_exec
(
const
char
*
argv0
,
const
char
*
target
,
...
...
@@ -104,6 +102,12 @@ extern int find_other_exec(const char *argv0, const char *target,
#define SYSTEMQUOTE ""
#endif
#ifdef WIN32
#define HOMEDIR "USERPROFILE"
#else
#define HOMEDIR "HOME"
#endif
/* Portable delay handling */
extern
void
pg_usleep
(
long
microsec
);
...
...
src/interfaces/libpq/fe-connect.c
浏览文件 @
1abf13db
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.28
0 2004/08/17 04:24:23 tgl
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.28
1 2004/08/18 02:59:11 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -3093,7 +3093,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
{
FILE
*
fp
;
char
*
pgpassfile
;
char
*
home
;
char
home
[
MAXPGPATH
]
;
struct
stat
stat_buf
;
#define LINELEN NAMEDATALEN*5
...
...
@@ -3112,8 +3112,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
port
=
DEF_PGPORT_STR
;
/* Look for it in the home dir */
home
=
getenv
(
"HOME"
);
if
(
!
home
)
if
(
!
get_home_path
(
home
))
return
NULL
;
pgpassfile
=
malloc
(
strlen
(
home
)
+
1
+
strlen
(
PGPASSFILE
)
+
1
);
...
...
src/port/path.c
浏览文件 @
1abf13db
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/path.c,v 1.3
0 2004/08/13 14:47:23 tgl
Exp $
* $PostgreSQL: pgsql/src/port/path.c,v 1.3
1 2004/08/18 02:59:12 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -370,6 +370,27 @@ set_pglocale_pgservice(const char *argv0, const char *app)
}
/*
* get_include_path
*/
bool
get_home_path
(
char
*
ret_path
)
{
if
(
getenv
(
HOMEDIR
)
==
NULL
)
{
*
ret_path
=
'\0'
;
return
false
;
}
else
{
StrNCpy
(
ret_path
,
getenv
(
HOMEDIR
),
MAXPGPATH
);
canonicalize_path
(
ret_path
);
return
true
;
}
}
/*
* make_relative - adjust path to be relative to bin/
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录