Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
040e1cef
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,发现更多精彩内容 >>
提交
040e1cef
编写于
11月 23, 2003
作者:
P
Peter Eisentraut
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make the messages and the options parsing a bit more standard.
上级
4f581e00
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
52 deletion
+41
-52
src/bin/initdb/initdb.c
src/bin/initdb/initdb.c
+41
-52
未找到文件。
src/bin/initdb/initdb.c
浏览文件 @
040e1cef
...
...
@@ -43,7 +43,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
* $Header: /cvsroot/pgsql/src/bin/initdb/initdb.c,v 1.1
2 2003/11/23 21:41:30
petere Exp $
* $Header: /cvsroot/pgsql/src/bin/initdb/initdb.c,v 1.1
3 2003/11/23 22:17:59
petere Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -56,6 +56,7 @@
#include <unistd.h>
#include <locale.h>
#include <signal.h>
#include <errno.h>
#include "libpq/pqsignal.h"
#include "mb/pg_wchar.h"
...
...
@@ -94,8 +95,6 @@ char *username = "";
bool
pwprompt
=
false
;
bool
debug
=
false
;
bool
noclean
=
false
;
bool
show_help
=
false
;
bool
show_version
=
false
;
bool
show_setting
=
false
;
...
...
@@ -250,7 +249,7 @@ xmalloc(size_t size)
result
=
malloc
(
size
);
if
(
!
result
)
{
fp
uts
(
_
(
"malloc failure - bailing out
\n
"
),
stderr
);
fp
rintf
(
stderr
,
_
(
"%s: out of memory
\n
"
),
progname
);
exit
(
1
);
}
return
result
;
...
...
@@ -264,7 +263,7 @@ xstrdup(const char *s)
result
=
strdup
(
s
);
if
(
!
result
)
{
fp
uts
(
_
(
"strdup failure - bailing out
\n
"
),
stderr
);
fp
rintf
(
stderr
,
_
(
"%s: out of memory
\n
"
),
progname
);
exit
(
1
);
}
return
result
;
...
...
@@ -395,7 +394,8 @@ readfile(char *path)
if
((
infile
=
fopen
(
path
,
"r"
))
==
NULL
)
{
fprintf
(
stderr
,
_
(
"could not read %s
\n
"
),
path
);
fprintf
(
stderr
,
_
(
"%s: could not open file
\"
%s
\"
for reading: %s
\n
"
),
progname
,
path
,
strerror
(
errno
));
exit_nicely
();
}
...
...
@@ -453,7 +453,8 @@ writefile(char *path, char **lines)
;
if
((
out_file
=
fopen
(
path
,
PG_BINARY_W
))
==
NULL
)
{
fprintf
(
stderr
,
_
(
"could not write %s
\n
"
),
path
);
fprintf
(
stderr
,
_
(
"%s: could not open file
\"
%s
\"
for writing: %s
\n
"
),
progname
,
path
,
strerror
(
errno
));
exit_nicely
();
}
for
(
line
=
lines
;
*
line
!=
NULL
;
line
++
)
...
...
@@ -2009,23 +2010,23 @@ usage(const char *progname)
printf
(
_
(
" [-D, --pgdata=]DATADIR location for this database cluster
\n
"
));
printf
(
_
(
" -E, --encoding=ENCODING set default encoding for new databases
\n
"
));
printf
(
_
(
" --locale=LOCALE initialize database cluster with given locale
\n
"
));
printf
(
_
(
" --lc-collate, --lc-ctype, --lc-messages=LOCALE
\n
"
));
printf
(
_
(
" --lc-monetary, --lc-numeric, --lc-time=LOCALE
\n
"
));
printf
(
_
(
" initialize database cluster with given locale
\n
"
));
printf
(
_
(
" in the respective category (default taken from
\n
"
));
printf
(
_
(
" environment)
\n
"
));
printf
(
_
(
" --lc-collate, --lc-ctype, --lc-messages=LOCALE
\n
"
" --lc-monetary, --lc-numeric, --lc-time=LOCALE
\n
"
" initialize database cluster with given locale
\n
"
" in the respective category (default taken from
\n
"
" environment)
\n
"
));
printf
(
_
(
" --no-locale equivalent to --locale=C
\n
"
));
printf
(
_
(
" -U, --username=NAME database superuser name
\n
"
));
printf
(
_
(
" -W, --pwprompt prompt for a password for the new superuser
\n
"
));
printf
(
_
(
" -?, --help show this help, then exit
\n
"
));
printf
(
_
(
" -V, --version output version information, then exit
\n
"
));
printf
(
_
(
"
\n
Less commonly used options:
\n
"
));
printf
(
_
(
"
\n
Less commonly used options:
\n
"
));
printf
(
_
(
" -d, --debug generate lots of debugging output
\n
"
));
printf
(
_
(
" -s, --show show internal settings
\n
"
));
printf
(
_
(
" -L DIRECTORY where to find the input files
\n
"
));
printf
(
_
(
" -n, --noclean do not clean up after errors
\n
"
));
printf
(
_
(
"
\n
If the data directory is not specified, the environment variable PGDATA
\n
"
));
printf
(
_
(
"is used.
\n
"
));
printf
(
_
(
"
\n
If the data directory is not specified, the environment variable PGDATA
\n
"
"is used.
\n
"
));
printf
(
_
(
"
\n
Report bugs to <pgsql-bugs@postgresql.org>.
\n
"
));
}
...
...
@@ -2115,20 +2116,24 @@ main(int argc, char *argv[])
self_path
=
NULL
;
}
if
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"--help"
)
==
0
||
strcmp
(
argv
[
1
],
"-?"
)
==
0
)
{
usage
(
progname
);
exit
(
0
);
}
if
(
strcmp
(
argv
[
1
],
"--version"
)
==
0
||
strcmp
(
argv
[
1
],
"-V"
)
==
0
)
{
puts
(
"initdb (PostgreSQL) "
PG_VERSION
);
exit
(
0
);
}
}
/* process command-line options */
while
(
1
)
while
(
(
c
=
getopt_long
(
argc
,
argv
,
"dD:E:L:nU:W"
,
long_options
,
&
option_index
))
!=
-
1
)
{
/*
* a : as the first option char here lets us use ? as a short
* option
*/
c
=
getopt_long
(
argc
,
argv
,
":D:E:WU:?sVdnL:"
,
long_options
,
&
option_index
);
if
(
c
==
-
1
)
break
;
switch
(
c
)
{
case
'D'
:
...
...
@@ -2178,20 +2183,14 @@ main(int argc, char *argv[])
case
8
:
locale
=
"C"
;
break
;
case
'?'
:
show_help
=
true
;
break
;
case
's'
:
show_setting
=
true
;
break
;
case
'V'
:
show_version
=
true
;
break
;
default:
show_help
=
true
;
printf
(
_
(
"Unrecognized option: %c
\n
"
),
c
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
),
progname
);
exit
(
1
);
}
}
/* Non-option argument specifies data directory */
...
...
@@ -2202,19 +2201,11 @@ main(int argc, char *argv[])
}
if
(
optind
<
argc
)
show_help
=
true
;
if
(
show_version
)
{
/* hard coded name here, in case they rename executable */
printf
(
"initdb (PostgreSQL) %s
\n
"
,
PG_VERSION
);
exit
(
0
);
}
if
(
show_help
)
{
usage
(
progname
);
exit
(
0
);
fprintf
(
stderr
,
_
(
"%s: too many command-line arguments (first is
\"
%s
\"
)
\n
"
),
progname
,
argv
[
optind
+
1
]);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
),
progname
);
}
if
(
strlen
(
pg_data
)
==
0
)
...
...
@@ -2229,11 +2220,9 @@ main(int argc, char *argv[])
{
fprintf
(
stderr
,
_
(
"%s: no data directory specified
\n
"
"You must identify the directory where the data "
"for this database system
\n
"
"will reside. Do this with either the invocation "
"option -D or the
\n
"
"environment variable PGDATA.
\n
"
),
"You must identify the directory where the data for this database system
\n
"
"will reside. Do this with either the invocation option -D or the
\n
"
"environment variable PGDATA.
\n
"
),
progname
);
exit
(
1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录