PostgreSQL的 initdb 源代码分析之二
继续分析
下面这一段,当 initdb --version 或者 initdb --help 才有意义。
if (argc > )
{ if (strcmp(argv[], "--help") == || strcmp(argv[], "-?") == )
{
usage(progname);
exit();
}
if (strcmp(argv[], "--version") == || strcmp(argv[], "-V") == )
{
puts("initdb (PostgreSQL) " PG_VERSION);
exit();
}
}
再看下一段:
实际上就是 initdb 运行时候,后面可以跟各种参数。我这里只考虑 -D那种就好了
/* process command-line options */
while ((c = getopt_long(argc, argv, "dD:E:L:nU:WA:sT:X:", long_options, &option_index)) != -)
{
switch (c)
{
case 'A':
authmethod = xstrdup(optarg);
break;
case 'D':
pg_data = xstrdup(optarg);
break;
case 'E':
encoding = xstrdup(optarg);
break;
case 'W':
pwprompt = true;
break;
case 'U':
username = xstrdup(optarg);
break;
case 'd':
debug = true;
printf(_("Running in debug mode.\n"));
break;
case 'n':
noclean = true;
printf(_("Running in noclean mode. Mistakes will not be cleaned up.\n"));
break;
case 'L':
share_path = xstrdup(optarg);
break;
case :
locale = xstrdup(optarg);
break;
case :
lc_collate = xstrdup(optarg);
break;
case :
lc_ctype = xstrdup(optarg);
break;
case :
lc_monetary = xstrdup(optarg);
break;
case :
lc_numeric = xstrdup(optarg);
break;
case :
lc_time = xstrdup(optarg);
break;
case :
lc_messages = xstrdup(optarg);
break;
case :
locale = "C";
break;
case :
pwfilename = xstrdup(optarg);
break;
case 's':
show_setting = true;
break;
case 'T':
default_text_search_config = xstrdup(optarg);
break;
case 'X':
xlog_dir = xstrdup(optarg);
break;
default:
/* getopt_long already emitted a complaint */
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname);
exit();
}
}
也就是这段:
case 'D':
pg_data = xstrdup(optarg);
break;
PostgreSQL的 initdb 源代码分析之二的更多相关文章
- PostgreSQL的 initdb 源代码分析之二十四
继续分析: make_template0(); 展开: 无需再作解释,就是创建template0数据库 /* * copy template1 to template0 */ static void ...
- PostgreSQL的 initdb 源代码分析之二十五
继续分析: make_postgres(); 展开: 目的是创建postgres数据库. cmd是:/home/pgsql/project/bin/postgres" --single -F ...
- PostgreSQL的 initdb 源代码分析之二十三
继续分析: vacuum_db(); 展开: cmd是:/home/pgsql/project/bin/postgres" --single -F -O -c search_path=pg_ ...
- PostgreSQL的 initdb 源代码分析之二十二
继续分析 load_plpgsql(); 展开: 就是让postgres 执行 create extension plpgsql cmd是: "/home/pgsql/project/bin ...
- PostgreSQL的 initdb 源代码分析之二十一
继续分析: setup_schema(); 展开: 实质就是创建info_schema. cmd 是: "/home/pgsql/project/bin/postgres" --s ...
- PostgreSQL的 initdb 源代码分析之二十
继续分析: setup_privileges(); 展开: 这是设置权限. 其cmd是:"/home/pgsql/project/bin/postgres" --single -F ...
- PostgreSQL的 initdb 源代码分析之十二
继续分析 /* Now create all the text config files */ setup_config(); 将其展开: 实质就是,确定各种参数,分别写入 postgresql.co ...
- PostgreSQL的initdb 源代码分析之六
继续分析 下面的是获取运行此程序的用户名称,主要还是为了防止在linux下用root来运行的情形. effective_user = get_id(); ) username = effective_ ...
- PostgreSQL的 initdb 源代码分析之十五
继续分析: if (pwprompt || pwfilename) get_set_pwd(); 由于我启动initdb的时候,没有设置口令相关的选项,故此略过. 接下来: setup_depend( ...
随机推荐
- Java [Leetcode 171]Excel Sheet Column Number
题目描述: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 解题思路: 循环读取数字,从左向右读取,每次该位字 ...
- 去除 waring Method 'CreateNew' hides virtual method of base type 'TCustomForm'
最近整理前人的代码,有好多的hint和waring, 其中整理到Method 'CreateNew' hides virtual method of base type 'TCustomForm', ...
- android直接读取数据库文件
public class Dictionary extends Activity implements OnClickListener, TextWatcher{ private final ...
- C# 总结
转自原文 C# 总结 1.类型是隐式内部的.(类) 2.类型成员是隐式私有的.(方法) 3.常量定义:const 是隐式static的,必须在定义时设置初始值. 4.只读字段:readonly 可以在 ...
- TabWidget/TabHost的两种使用方法
1.概念 盛放Tab的容器就是TabHost.TabHost的实现有两种方式: 第一种继承TabActivity,从TabActivity中用getTabHost()方法获取TabHost.各个Tab ...
- 关于ThinkPHP中Session不能夸模块/控制器使用的问题-网上的答案我做个补充
1,确保c:/windows目录下有php.ini文件2,修改php.ini中的session.auto_start = 0 为 session.auto_start = 1 //设置自动开启ses ...
- hdu 2087-剪花布条(KMP)
题意: 求文本串最多可以分成几个模式串. 分析: KMP #include <map> #include <set> #include <list> #includ ...
- codeforces 678D Iterated Linear Function 矩阵快速幂
矩阵快速幂的题要多做 由题可得 g[n]=A*g[n-1]+B 所以构造矩阵 { g[n] } = {A B} * { g[n-1]} { 1 } {0 1 ...
- HDU-4882 ZCC Loves Codefires
http://acm.hdu.edu.cn/showproblem.php?pid=4882 ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Ot ...
- div模拟的下拉框特效jquery
从网上找来的,感觉不错就拿来分享下 <style type="text/css"> body, ul, li { margin: 0; padding: 0; font ...