Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
54691d41
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,发现更多精彩内容 >>
提交
54691d41
编写于
11月 04, 2004
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix psql \e and \! for Win32.
上级
e48b9b55
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
15 deletion
+45
-15
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_ctl/pg_ctl.c
+3
-3
src/bin/psql/command.c
src/bin/psql/command.c
+42
-12
未找到文件。
src/bin/pg_ctl/pg_ctl.c
浏览文件 @
54691d41
...
...
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.4
4 2004/10/27 19:44:14
momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.4
5 2004/11/04 22:25:12
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -335,7 +335,7 @@ start_postmaster(void)
* http://dev.remotenetworktechnology.com/cmd/cmdfaq.htm
*/
if
(
log_file
!=
NULL
)
#if
!defined(WIN32)
/* Cygwin doesn't have START */
#if
ndef WIN32
/* Cygwin doesn't have START */
snprintf
(
cmd
,
MAXPGPATH
,
"%s
\"
%s
\"
%s%s <
\"
%s
\"
>>
\"
%s
\"
2>&1 &%s"
,
#else
snprintf
(
cmd
,
MAXPGPATH
,
"%sSTART /B
\"\"
\"
%s
\"
%s%s <
\"
%s
\"
>>
\"
%s
\"
2>&1%s"
,
...
...
@@ -343,7 +343,7 @@ start_postmaster(void)
SYSTEMQUOTE
,
postgres_path
,
pgdata_opt
,
post_opts
,
DEVNULL
,
log_file
,
SYSTEMQUOTE
);
else
#if
!defined(WIN32)
/* Cygwin doesn't have START */
#if
ndef WIN32
/* Cygwin doesn't have START */
snprintf
(
cmd
,
MAXPGPATH
,
"%s
\"
%s
\"
%s%s <
\"
%s
\"
2>&1 &%s"
,
#else
snprintf
(
cmd
,
MAXPGPATH
,
"%sSTART /B
\"\"
\"
%s
\"
%s%s <
\"
%s
\"
2>&1%s"
,
...
...
src/bin/psql/command.c
浏览文件 @
54691d41
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.1
29 2004/10/16 03:10:16
momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.1
30 2004/11/04 22:25:14
momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
...
...
@@ -23,6 +23,10 @@
#include <io.h>
#include <fcntl.h>
#include <direct.h>
#ifndef WIN32_CLIENT_ONLY
#include <sys/types.h>
/* for umask() */
#include <sys/stat.h>
/* for stat() */
#endif
#endif
#include "libpq-fe.h"
...
...
@@ -1097,7 +1101,7 @@ editFile(const char *fname)
#ifndef WIN32
"exec "
#endif
"%s
'%s'"
,
editorName
,
fname
);
"%s
\"
%s
\"
\"
%s
\"
%s"
,
SYSTEMQUOTE
,
editorName
,
fname
,
SYSTEMQUOTE
);
result
=
system
(
sys
);
if
(
result
==
-
1
)
psql_error
(
"could not start editor
\"
%s
\"\n
"
,
editorName
);
...
...
@@ -1119,7 +1123,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
bool
error
=
false
;
int
fd
;
#ifndef WIN32
#ifndef WIN32
_CLIENT_ONLY
struct
stat
before
,
after
;
#endif
...
...
@@ -1130,13 +1134,35 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
{
/* make a temp file to edit */
#ifndef WIN32
const
char
*
tmpdir
env
=
getenv
(
"TMPDIR"
);
const
char
*
tmpdir
=
getenv
(
"TMPDIR"
);
snprintf
(
fnametmp
,
sizeof
(
fnametmp
),
"%s/psql.edit.%d.%d"
,
tmpdirenv
?
tmpdirenv
:
"/tmp"
,
geteuid
(),
(
int
)
getpid
());
if
(
!
tmpdir
)
tmpdir
=
"/tmp"
;
#else
char
tmpdir
[
MAXPGPATH
];
int
ret
;
ret
=
GetTempPath
(
MAXPGPATH
,
tmpdir
);
if
(
ret
==
0
||
ret
>
MAXPGPATH
)
{
psql_error
(
"Can not locate temporary directory: %s"
,
!
ret
?
strerror
(
errno
)
:
""
);
return
false
;
}
/*
* No canonicalize_path() here.
* EDIT.EXE run from CMD.EXE prepends the current directory to the
* supplied path unless we use only backslashes, so we do that.
*/
#endif
snprintf
(
fnametmp
,
sizeof
(
fnametmp
),
"%s%spsql.edit.%d"
,
tmpdir
,
#ifndef WIN32
"/"
,
#else
GetTempFileName
(
"."
,
"psql"
,
0
,
fnametmp
);
""
,
/* trailing separator already present */
#endif
(
int
)
getpid
());
fname
=
(
const
char
*
)
fnametmp
;
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_EXCL
,
0600
);
...
...
@@ -1174,7 +1200,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
}
}
#ifndef WIN32
#ifndef WIN32
_CLIENT_ONLY
if
(
!
error
&&
stat
(
fname
,
&
before
)
!=
0
)
{
psql_error
(
"%s: %s
\n
"
,
fname
,
strerror
(
errno
));
...
...
@@ -1186,7 +1212,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
if
(
!
error
)
error
=
!
editFile
(
fname
);
#ifndef WIN32
#ifndef WIN32
_CLIENT_ONLY
if
(
!
error
&&
stat
(
fname
,
&
after
)
!=
0
)
{
psql_error
(
"%s: %s
\n
"
,
fname
,
strerror
(
errno
));
...
...
@@ -1509,9 +1535,13 @@ do_shell(const char *command)
if
(
!
command
)
{
char
*
sys
;
const
char
*
shellName
;
const
char
*
shellName
=
NULL
;
shellName
=
getenv
(
"SHELL"
);
#ifdef WIN32
shellName
=
getenv
(
"COMSPEC"
);
#endif
if
(
shellName
==
NULL
)
shellName
=
getenv
(
"SHELL"
);
if
(
shellName
==
NULL
)
shellName
=
DEFAULT_SHELL
;
...
...
@@ -1520,7 +1550,7 @@ do_shell(const char *command)
#ifndef WIN32
"exec "
#endif
"%s
"
,
shellName
);
"%s
\"
%s
\"
%s"
,
SYSTEMQUOTE
,
shellName
,
SYSTEMQUOTE
);
result
=
system
(
sys
);
free
(
sys
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录