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( ...
随机推荐
- 自己用的框架写了一个PHP模版解析类
<?php if(!defined('IS_HEARTPHP')) exit('Access Denied'); /** * template.class.php 模板解析类 * * @copy ...
- Java [Leetcode 232]Implement Queue using Stacks
题目描述: Implement the following operations of a queue using stacks. push(x) -- Push element x to the b ...
- poj 2373 Dividing the Path
Dividing the Path Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2858 Accepted: 1064 ...
- 【转】iOS自动布局进阶用法
原文网址:http://www.cnblogs.com/dsxniubility/p/4266581.html 本文主要介绍几个我遇到并总结的相对高级的用法(当然啦牛人会觉得这也不算什么). 简单的s ...
- Oracle“死锁”模拟
本着实验优先的原则,先模拟死锁的发生,然后在列一下死锁产生的四个必要条件和处理死锁的一般策略. 1.创建两个简单的表t1_deadlock和t2_deadlock,每个表中仅仅包含一个字段asys@o ...
- 在Android应用中使用Clean架构
自从开始开发安卓应用,我一直感觉我可以做得更好.我看过不少烂代码,其中当然有我写的.安卓系统的复杂性加上烂代码势必酿成灾祸,所以从错误中成长就很重要.我Google了如何更好地开发应用,发现了这个叫做 ...
- c# List<int> 转 string 以及 string [] 转 List<int>
List<int> 转 string : list<int>: 1,2,3,4,5,6,7 转换成字符串:“1,2,3,4,5,6,7” List<int> li ...
- IOS UIView(UIButton)通过显示动画移动的时候 响应点击的解决方案
今天在做一个UIButton显示动画的时候,遇到一个问题,就是在移动的时候 ,需要相应它的点击时间(click) 通过CAKeyframeAnimation 来移动UIButton的layer ,效果 ...
- IOS AsyncSocket
导入AsyncSocket.h AsyncSocket.m AsyncUdpSocket.h AsyncUdpSocket.m 以及 CFNetWork.framework async ...
- 《Python CookBook2》 第一章 文本 - 替换字符串中的子串
替换字符串中的子串 任务: 给定一个字符串,通过查询一个字符串替换字典,将字符串中被标记的子字符串替换掉. 解决方案: >>> import string >>> ...