Definition at line 28 of file createuser.c.
29{
61 };
62
75 bool echo = false;
81
82
90
92
95
99
101
102 while ((
c =
getopt_long(argc, argv,
"a:c:dDeEg:h:iIlLm:p:PrRsSU:v:wW",
104 {
106 {
107 case 'a':
109 break;
110 case 'c':
114 break;
115 case 'd':
117 break;
118 case 'D':
120 break;
121 case 'e':
122 echo = true;
123 break;
124 case 'E':
125
126 break;
127 case 'g':
129 break;
130 case 'h':
132 break;
133 case 'i':
135 break;
136 case 'I':
138 break;
139 case 'l':
141 break;
142 case 'L':
144 break;
145 case 'm':
147 break;
148 case 'p':
150 break;
151 case 'P':
153 break;
154 case 'r':
156 break;
157 case 'R':
159 break;
160 case 's':
162 break;
163 case 'S':
165 break;
166 case 'U':
168 break;
169 case 'v':
171 break;
172 case 'w':
174 break;
175 case 'W':
177 break;
178 case 1:
180 break;
181 case 2:
183 break;
184 case 3:
186 break;
187 case 4:
189 break;
190 case 5:
192 break;
193 default:
194
197 }
198 }
199
201 {
202 case 0:
203 break;
204 case 1:
206 break;
207 default:
208 pg_log_error(
"too many command-line arguments (first is \"%s\")",
212 }
213
215 {
217 {
219 }
220 else
221 {
224 else
226 }
227 }
228
230 {
232
236 {
239 }
241 }
242
244 {
247 else
249 }
250
252 {
253
256 }
257
259 {
262 else
264 }
265
267 {
270 else
272 }
273
276
279
282
285
292
294
296
298
301 {
303
305
311 pg_fatal(
"password encryption failed: %s",
315 }
338 if (replication ==
TRI_NO)
347 {
350 }
352 {
354
356
357 for (cell = roles.
head; cell; cell = cell->
next)
358 {
361 else
363 }
364 }
366 {
368
370
371 for (cell = members.
head; cell; cell = cell->
next)
372 {
375 else
377 }
378 }
380 {
382
384
385 for (cell =
admins.head; cell; cell = cell->
next)
386 {
389 else
391 }
392 }
393
395
396 if (echo)
399
401 {
405 }
406
410}
bool yesno_prompt(const char *question)
#define PG_TEXTDOMAIN(domain)
void set_pglocale_pgservice(const char *argv0, const char *app)
PGconn * connectMaintenanceDatabase(ConnParams *cparams, const char *progname, bool echo)
#define fprintf(file, fmt, msg)
Oid createdb(ParseState *pstate, const CreatedbStmt *stmt)
char * PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm)
int PQclientEncoding(const PGconn *conn)
void PQfinish(PGconn *conn)
char * PQerrorMessage(const PGconn *conn)
void PQfreemem(void *ptr)
PGresult * PQexec(PGconn *conn, const char *query)
char * pg_strdup(const char *in)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
void pg_logging_init(const char *argv0)
#define pg_log_error(...)
#define pg_log_error_hint(...)
bool option_parse_int(const char *optarg, const char *optname, int min_range, int max_range, int *result)
void handle_help_version_opts(int argc, char *argv[], const char *fixed_progname, help_handler hlp)
PGDLLIMPORT char * optarg
const char * get_progname(const char *argv0)
void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void initPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void simple_string_list_append(SimpleStringList *list, const char *val)
char * simple_prompt(const char *prompt, bool echo)
const char * fmtId(const char *rawid)
void setFmtEncoding(int encoding)
void appendStringLiteralConn(PQExpBuffer buf, const char *str, PGconn *conn)
char val[FLEXIBLE_ARRAY_MEMBER]
struct SimpleStringListCell * next
SimpleStringListCell * head
enum trivalue prompt_password
const char * get_user_name_or_exit(const char *progname)
References _, appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), appendStringLiteralConn(), conn, connectMaintenanceDatabase(), createdb(), PQExpBufferData::data, _connParams::dbname, fb(), fmtId(), fprintf, free, get_progname(), get_user_name_or_exit(), getopt_long(), handle_help_version_opts(), SimpleStringList::head, help(), initPQExpBuffer(), SimpleStringListCell::next, no_argument, optarg, optind, option_parse_int(), _connParams::override_dbname, pg_fatal, pg_log_error, pg_log_error_hint, pg_logging_init(), pg_strdup(), PG_TEXTDOMAIN, _connParams::pghost, _connParams::pgport, PGRES_COMMAND_OK, _connParams::pguser, port, PQclear, PQclientEncoding(), PQencryptPasswordConn(), PQerrorMessage(), PQexec(), PQfinish(), PQfreemem(), PQresultStatus, printf, printfPQExpBuffer(), progname, _connParams::prompt_password, pwprompt, required_argument, set_pglocale_pgservice(), setFmtEncoding(), simple_prompt(), simple_string_list_append(), superuser(), TRI_DEFAULT, TRI_NO, TRI_YES, username, SimpleStringListCell::val, and yesno_prompt().