OSDN Git Service

Fix typo in sslmode documentation
[pg-rex/syncrep.git] / src / bin / psql / startup.c
1 /*
2  * psql - the PostgreSQL interactive terminal
3  *
4  * Copyright (c) 2000-2011, PostgreSQL Global Development Group
5  *
6  * src/bin/psql/startup.c
7  */
8 #include "postgres_fe.h"
9
10 #include <sys/types.h>
11
12 #ifndef WIN32
13 #include <unistd.h>
14 #else                                                   /* WIN32 */
15 #include <io.h>
16 #include <win32.h>
17 #endif   /* WIN32 */
18
19 #include "getopt_long.h"
20
21 #include <locale.h>
22
23 #include "command.h"
24 #include "common.h"
25 #include "describe.h"
26 #include "help.h"
27 #include "input.h"
28 #include "mainloop.h"
29 #include "settings.h"
30
31
32
33 /*
34  * Global psql options
35  */
36 PsqlSettings pset;
37
38 #ifndef WIN32
39 #define SYSPSQLRC       "psqlrc"
40 #define PSQLRC          ".psqlrc"
41 #else
42 #define SYSPSQLRC       "psqlrc"
43 #define PSQLRC          "psqlrc.conf"
44 #endif
45
46 /*
47  * Structures to pass information between the option parsing routine
48  * and the main function
49  */
50 enum _actions
51 {
52         ACT_NOTHING = 0,
53         ACT_SINGLE_SLASH,
54         ACT_LIST_DB,
55         ACT_SINGLE_QUERY,
56         ACT_FILE
57 };
58
59 struct adhoc_opts
60 {
61         char       *dbname;
62         char       *host;
63         char       *port;
64         char       *username;
65         char       *logfilename;
66         enum _actions action;
67         char       *action_string;
68         bool            no_readline;
69         bool            no_psqlrc;
70         bool            single_txn;
71 };
72
73 static void parse_psql_options(int argc, char *argv[],
74                                    struct adhoc_opts * options);
75 static void process_psqlrc(char *argv0);
76 static void process_psqlrc_file(char *filename);
77 static void showVersion(void);
78 static void EstablishVariableSpace(void);
79
80 /*
81  *
82  * main
83  *
84  */
85 int
86 main(int argc, char *argv[])
87 {
88         struct adhoc_opts options;
89         int                     successResult;
90         char       *password = NULL;
91         char       *password_prompt = NULL;
92         bool            new_pass;
93
94         set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("psql"));
95
96         if (argc > 1)
97         {
98                 if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
99                 {
100                         usage();
101                         exit(EXIT_SUCCESS);
102                 }
103                 if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
104                 {
105                         showVersion();
106                         exit(EXIT_SUCCESS);
107                 }
108         }
109
110 #ifdef WIN32
111         setvbuf(stderr, NULL, _IONBF, 0);
112 #endif
113
114         setup_cancel_handler();
115
116         pset.progname = get_progname(argv[0]);
117
118         pset.db = NULL;
119         setDecimalLocale();
120         pset.encoding = PQenv2encoding();
121         pset.queryFout = stdout;
122         pset.queryFoutPipe = false;
123         pset.cur_cmd_source = stdin;
124         pset.cur_cmd_interactive = false;
125
126         /* We rely on unmentioned fields of pset.popt to start out 0/false/NULL */
127         pset.popt.topt.format = PRINT_ALIGNED;
128         pset.popt.topt.border = 1;
129         pset.popt.topt.pager = 1;
130         pset.popt.topt.start_table = true;
131         pset.popt.topt.stop_table = true;
132         pset.popt.default_footer = true;
133         /* We must get COLUMNS here before readline() sets it */
134         pset.popt.topt.env_columns = getenv("COLUMNS") ? atoi(getenv("COLUMNS")) : 0;
135
136         pset.notty = (!isatty(fileno(stdin)) || !isatty(fileno(stdout)));
137
138         pset.getPassword = TRI_DEFAULT;
139
140         EstablishVariableSpace();
141
142         SetVariable(pset.vars, "VERSION", PG_VERSION_STR);
143
144         /* Default values for variables */
145         SetVariableBool(pset.vars, "AUTOCOMMIT");
146         SetVariable(pset.vars, "VERBOSITY", "default");
147         SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
148         SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
149         SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);
150
151         parse_psql_options(argc, argv, &options);
152
153         if (!pset.popt.topt.fieldSep)
154                 pset.popt.topt.fieldSep = pg_strdup(DEFAULT_FIELD_SEP);
155         if (!pset.popt.topt.recordSep)
156                 pset.popt.topt.recordSep = pg_strdup(DEFAULT_RECORD_SEP);
157
158         if (options.username == NULL)
159                 password_prompt = pg_strdup(_("Password: "));
160         else
161         {
162                 password_prompt = malloc(strlen(_("Password for user %s: ")) - 2 +
163                                                                  strlen(options.username) + 1);
164                 sprintf(password_prompt, _("Password for user %s: "),
165                                 options.username);
166         }
167
168         if (pset.getPassword == TRI_YES)
169                 password = simple_prompt(password_prompt, 100, false);
170
171         /* loop until we have a password if requested by backend */
172         do
173         {
174 #define PARAMS_ARRAY_SIZE       8
175                 const char **keywords = pg_malloc(PARAMS_ARRAY_SIZE * sizeof(*keywords));
176                 const char **values = pg_malloc(PARAMS_ARRAY_SIZE * sizeof(*values));
177
178                 keywords[0] = "host";
179                 values[0] = options.host;
180                 keywords[1] = "port";
181                 values[1] = options.port;
182                 keywords[2] = "user";
183                 values[2] = options.username;
184                 keywords[3] = "password";
185                 values[3] = password;
186                 keywords[4] = "dbname";
187                 values[4] = (options.action == ACT_LIST_DB &&
188                                          options.dbname == NULL) ?
189                         "postgres" : options.dbname;
190                 keywords[5] = "fallback_application_name";
191                 values[5] = pset.progname;
192                 keywords[6] = "client_encoding";
193                 values[6] = (pset.notty || getenv("PGCLIENTENCODING")) ? NULL : "auto";
194                 keywords[7] = NULL;
195                 values[7] = NULL;
196
197                 new_pass = false;
198                 pset.db = PQconnectdbParams(keywords, values, true);
199                 free(keywords);
200                 free(values);
201
202                 if (PQstatus(pset.db) == CONNECTION_BAD &&
203                         PQconnectionNeedsPassword(pset.db) &&
204                         password == NULL &&
205                         pset.getPassword != TRI_NO)
206                 {
207                         PQfinish(pset.db);
208                         password = simple_prompt(password_prompt, 100, false);
209                         new_pass = true;
210                 }
211         } while (new_pass);
212
213         free(password);
214         free(password_prompt);
215
216         if (PQstatus(pset.db) == CONNECTION_BAD)
217         {
218                 fprintf(stderr, "%s: %s", pset.progname, PQerrorMessage(pset.db));
219                 PQfinish(pset.db);
220                 exit(EXIT_BADCONN);
221         }
222
223         PQsetNoticeProcessor(pset.db, NoticeProcessor, NULL);
224
225         SyncVariables();
226
227         if (options.action == ACT_LIST_DB)
228         {
229                 int                     success;
230
231                 if (!options.no_psqlrc)
232                         process_psqlrc(argv[0]);
233
234                 success = listAllDbs(false);
235                 PQfinish(pset.db);
236                 exit(success ? EXIT_SUCCESS : EXIT_FAILURE);
237         }
238
239         if (options.logfilename)
240         {
241                 pset.logfile = fopen(options.logfilename, "a");
242                 if (!pset.logfile)
243                         fprintf(stderr, _("%s: could not open log file \"%s\": %s\n"),
244                                         pset.progname, options.logfilename, strerror(errno));
245         }
246
247         /*
248          * Now find something to do
249          */
250
251         /*
252          * process file given by -f
253          */
254         if (options.action == ACT_FILE)
255         {
256                 if (!options.no_psqlrc)
257                         process_psqlrc(argv[0]);
258
259                 successResult = process_file(options.action_string, options.single_txn);
260         }
261
262         /*
263          * process slash command if one was given to -c
264          */
265         else if (options.action == ACT_SINGLE_SLASH)
266         {
267                 PsqlScanState scan_state;
268
269                 if (pset.echo == PSQL_ECHO_ALL)
270                         puts(options.action_string);
271
272                 scan_state = psql_scan_create();
273                 psql_scan_setup(scan_state,
274                                                 options.action_string,
275                                                 strlen(options.action_string));
276
277                 successResult = HandleSlashCmds(scan_state, NULL) != PSQL_CMD_ERROR
278                         ? EXIT_SUCCESS : EXIT_FAILURE;
279
280                 psql_scan_destroy(scan_state);
281         }
282
283         /*
284          * If the query given to -c was a normal one, send it
285          */
286         else if (options.action == ACT_SINGLE_QUERY)
287         {
288                 if (pset.echo == PSQL_ECHO_ALL)
289                         puts(options.action_string);
290
291                 successResult = SendQuery(options.action_string)
292                         ? EXIT_SUCCESS : EXIT_FAILURE;
293         }
294
295         /*
296          * or otherwise enter interactive main loop
297          */
298         else
299         {
300                 if (!options.no_psqlrc)
301                         process_psqlrc(argv[0]);
302
303                 connection_warnings(true);
304                 if (!pset.quiet && !pset.notty)
305                         printf(_("Type \"help\" for help.\n\n"));
306                 if (!pset.notty)
307                         initializeInput(options.no_readline ? 0 : 1);
308                 if (options.action_string)              /* -f - was used */
309                         pset.inputfile = "<stdin>";
310
311                 successResult = MainLoop(stdin);
312         }
313
314         /* clean up */
315         if (pset.logfile)
316                 fclose(pset.logfile);
317         PQfinish(pset.db);
318         setQFout(NULL);
319
320         return successResult;
321 }
322
323
324 /*
325  * Parse command line options
326  */
327
328 static void
329 parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
330 {
331         static struct option long_options[] =
332         {
333                 {"echo-all", no_argument, NULL, 'a'},
334                 {"no-align", no_argument, NULL, 'A'},
335                 {"command", required_argument, NULL, 'c'},
336                 {"dbname", required_argument, NULL, 'd'},
337                 {"echo-queries", no_argument, NULL, 'e'},
338                 {"echo-hidden", no_argument, NULL, 'E'},
339                 {"file", required_argument, NULL, 'f'},
340                 {"field-separator", required_argument, NULL, 'F'},
341                 {"host", required_argument, NULL, 'h'},
342                 {"html", no_argument, NULL, 'H'},
343                 {"list", no_argument, NULL, 'l'},
344                 {"log-file", required_argument, NULL, 'L'},
345                 {"no-readline", no_argument, NULL, 'n'},
346                 {"single-transaction", no_argument, NULL, '1'},
347                 {"output", required_argument, NULL, 'o'},
348                 {"port", required_argument, NULL, 'p'},
349                 {"pset", required_argument, NULL, 'P'},
350                 {"quiet", no_argument, NULL, 'q'},
351                 {"record-separator", required_argument, NULL, 'R'},
352                 {"single-step", no_argument, NULL, 's'},
353                 {"single-line", no_argument, NULL, 'S'},
354                 {"tuples-only", no_argument, NULL, 't'},
355                 {"table-attr", required_argument, NULL, 'T'},
356                 {"username", required_argument, NULL, 'U'},
357                 {"set", required_argument, NULL, 'v'},
358                 {"variable", required_argument, NULL, 'v'},
359                 {"version", no_argument, NULL, 'V'},
360                 {"no-password", no_argument, NULL, 'w'},
361                 {"password", no_argument, NULL, 'W'},
362                 {"expanded", no_argument, NULL, 'x'},
363                 {"no-psqlrc", no_argument, NULL, 'X'},
364                 {"help", no_argument, NULL, '?'},
365                 {NULL, 0, NULL, 0}
366         };
367
368         int                     optindex;
369         extern char *optarg;
370         extern int      optind;
371         int                     c;
372
373         memset(options, 0, sizeof *options);
374
375         while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:h:HlL:no:p:P:qR:sStT:U:v:VwWxX?1",
376                                                         long_options, &optindex)) != -1)
377         {
378                 switch (c)
379                 {
380                         case 'a':
381                                 SetVariable(pset.vars, "ECHO", "all");
382                                 break;
383                         case 'A':
384                                 pset.popt.topt.format = PRINT_UNALIGNED;
385                                 break;
386                         case 'c':
387                                 options->action_string = optarg;
388                                 if (optarg[0] == '\\')
389                                 {
390                                         options->action = ACT_SINGLE_SLASH;
391                                         options->action_string++;
392                                 }
393                                 else
394                                         options->action = ACT_SINGLE_QUERY;
395                                 break;
396                         case 'd':
397                                 options->dbname = optarg;
398                                 break;
399                         case 'e':
400                                 SetVariable(pset.vars, "ECHO", "queries");
401                                 break;
402                         case 'E':
403                                 SetVariableBool(pset.vars, "ECHO_HIDDEN");
404                                 break;
405                         case 'f':
406                                 options->action = ACT_FILE;
407                                 options->action_string = optarg;
408                                 break;
409                         case 'F':
410                                 pset.popt.topt.fieldSep = pg_strdup(optarg);
411                                 break;
412                         case 'h':
413                                 options->host = optarg;
414                                 break;
415                         case 'H':
416                                 pset.popt.topt.format = PRINT_HTML;
417                                 break;
418                         case 'l':
419                                 options->action = ACT_LIST_DB;
420                                 break;
421                         case 'L':
422                                 options->logfilename = optarg;
423                                 break;
424                         case 'n':
425                                 options->no_readline = true;
426                                 break;
427                         case 'o':
428                                 setQFout(optarg);
429                                 break;
430                         case 'p':
431                                 options->port = optarg;
432                                 break;
433                         case 'P':
434                                 {
435                                         char       *value;
436                                         char       *equal_loc;
437                                         bool            result;
438
439                                         value = pg_strdup(optarg);
440                                         equal_loc = strchr(value, '=');
441                                         if (!equal_loc)
442                                                 result = do_pset(value, NULL, &pset.popt, true);
443                                         else
444                                         {
445                                                 *equal_loc = '\0';
446                                                 result = do_pset(value, equal_loc + 1, &pset.popt, true);
447                                         }
448
449                                         if (!result)
450                                         {
451                                                 fprintf(stderr, _("%s: could not set printing parameter \"%s\"\n"), pset.progname, value);
452                                                 exit(EXIT_FAILURE);
453                                         }
454
455                                         free(value);
456                                         break;
457                                 }
458                         case 'q':
459                                 SetVariableBool(pset.vars, "QUIET");
460                                 break;
461                         case 'R':
462                                 pset.popt.topt.recordSep = pg_strdup(optarg);
463                                 break;
464                         case 's':
465                                 SetVariableBool(pset.vars, "SINGLESTEP");
466                                 break;
467                         case 'S':
468                                 SetVariableBool(pset.vars, "SINGLELINE");
469                                 break;
470                         case 't':
471                                 pset.popt.topt.tuples_only = true;
472                                 break;
473                         case 'T':
474                                 pset.popt.topt.tableAttr = pg_strdup(optarg);
475                                 break;
476                         case 'U':
477                                 options->username = optarg;
478                                 break;
479                         case 'v':
480                                 {
481                                         char       *value;
482                                         char       *equal_loc;
483
484                                         value = pg_strdup(optarg);
485                                         equal_loc = strchr(value, '=');
486                                         if (!equal_loc)
487                                         {
488                                                 if (!DeleteVariable(pset.vars, value))
489                                                 {
490                                                         fprintf(stderr, _("%s: could not delete variable \"%s\"\n"),
491                                                                         pset.progname, value);
492                                                         exit(EXIT_FAILURE);
493                                                 }
494                                         }
495                                         else
496                                         {
497                                                 *equal_loc = '\0';
498                                                 if (!SetVariable(pset.vars, value, equal_loc + 1))
499                                                 {
500                                                         fprintf(stderr, _("%s: could not set variable \"%s\"\n"),
501                                                                         pset.progname, value);
502                                                         exit(EXIT_FAILURE);
503                                                 }
504                                         }
505
506                                         free(value);
507                                         break;
508                                 }
509                         case 'V':
510                                 showVersion();
511                                 exit(EXIT_SUCCESS);
512                         case 'w':
513                                 pset.getPassword = TRI_NO;
514                                 break;
515                         case 'W':
516                                 pset.getPassword = TRI_YES;
517                                 break;
518                         case 'x':
519                                 pset.popt.topt.expanded = true;
520                                 break;
521                         case 'X':
522                                 options->no_psqlrc = true;
523                                 break;
524                         case '1':
525                                 options->single_txn = true;
526                                 break;
527                         case '?':
528                                 /* Actual help option given */
529                                 if (strcmp(argv[optind - 1], "-?") == 0 || strcmp(argv[optind - 1], "--help") == 0)
530                                 {
531                                         usage();
532                                         exit(EXIT_SUCCESS);
533                                 }
534                                 /* unknown option reported by getopt */
535                                 else
536                                 {
537                                         fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
538                                                         pset.progname);
539                                         exit(EXIT_FAILURE);
540                                 }
541                                 break;
542                         default:
543                                 fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
544                                                 pset.progname);
545                                 exit(EXIT_FAILURE);
546                                 break;
547                 }
548         }
549
550         /*
551          * if we still have arguments, use it as the database name and username
552          */
553         while (argc - optind >= 1)
554         {
555                 if (!options->dbname)
556                         options->dbname = argv[optind];
557                 else if (!options->username)
558                         options->username = argv[optind];
559                 else if (!pset.quiet)
560                         fprintf(stderr, _("%s: warning: extra command-line argument \"%s\" ignored\n"),
561                                         pset.progname, argv[optind]);
562
563                 optind++;
564         }
565 }
566
567
568 /*
569  * Load .psqlrc file, if found.
570  */
571 static void
572 process_psqlrc(char *argv0)
573 {
574         char            home[MAXPGPATH];
575         char            rc_file[MAXPGPATH];
576         char            my_exec_path[MAXPGPATH];
577         char            etc_path[MAXPGPATH];
578
579         find_my_exec(argv0, my_exec_path);
580         get_etc_path(my_exec_path, etc_path);
581
582         snprintf(rc_file, MAXPGPATH, "%s/%s", etc_path, SYSPSQLRC);
583         process_psqlrc_file(rc_file);
584
585         if (get_home_path(home))
586         {
587                 snprintf(rc_file, MAXPGPATH, "%s/%s", home, PSQLRC);
588                 process_psqlrc_file(rc_file);
589         }
590 }
591
592
593
594 static void
595 process_psqlrc_file(char *filename)
596 {
597         char       *psqlrc;
598
599 #if defined(WIN32) && (!defined(__MINGW32__))
600 #define R_OK 4
601 #endif
602
603         psqlrc = pg_malloc(strlen(filename) + 1 + strlen(PG_VERSION) + 1);
604         sprintf(psqlrc, "%s-%s", filename, PG_VERSION);
605
606         if (access(psqlrc, R_OK) == 0)
607                 (void) process_file(psqlrc, false);
608         else if (access(filename, R_OK) == 0)
609                 (void) process_file(filename, false);
610         free(psqlrc);
611 }
612
613
614
615 /* showVersion
616  *
617  * This output format is intended to match GNU standards.
618  */
619 static void
620 showVersion(void)
621 {
622         puts("psql (PostgreSQL) " PG_VERSION);
623
624 #if defined(USE_READLINE)
625         puts(_("contains support for command-line editing"));
626 #endif
627 }
628
629
630
631 /*
632  * Assign hooks for psql variables.
633  *
634  * This isn't an amazingly good place for them, but neither is anywhere else.
635  */
636
637 static void
638 autocommit_hook(const char *newval)
639 {
640         pset.autocommit = ParseVariableBool(newval);
641 }
642
643 static void
644 on_error_stop_hook(const char *newval)
645 {
646         pset.on_error_stop = ParseVariableBool(newval);
647 }
648
649 static void
650 quiet_hook(const char *newval)
651 {
652         pset.quiet = ParseVariableBool(newval);
653 }
654
655 static void
656 singleline_hook(const char *newval)
657 {
658         pset.singleline = ParseVariableBool(newval);
659 }
660
661 static void
662 singlestep_hook(const char *newval)
663 {
664         pset.singlestep = ParseVariableBool(newval);
665 }
666
667 static void
668 fetch_count_hook(const char *newval)
669 {
670         pset.fetch_count = ParseVariableNum(newval, -1, -1, false);
671 }
672
673 static void
674 echo_hook(const char *newval)
675 {
676         if (newval == NULL)
677                 pset.echo = PSQL_ECHO_NONE;
678         else if (strcmp(newval, "queries") == 0)
679                 pset.echo = PSQL_ECHO_QUERIES;
680         else if (strcmp(newval, "all") == 0)
681                 pset.echo = PSQL_ECHO_ALL;
682         else
683                 pset.echo = PSQL_ECHO_NONE;
684 }
685
686 static void
687 echo_hidden_hook(const char *newval)
688 {
689         if (newval == NULL)
690                 pset.echo_hidden = PSQL_ECHO_HIDDEN_OFF;
691         else if (strcmp(newval, "noexec") == 0)
692                 pset.echo_hidden = PSQL_ECHO_HIDDEN_NOEXEC;
693         else if (pg_strcasecmp(newval, "off") == 0)
694                 pset.echo_hidden = PSQL_ECHO_HIDDEN_OFF;
695         else
696                 pset.echo_hidden = PSQL_ECHO_HIDDEN_ON;
697 }
698
699 static void
700 on_error_rollback_hook(const char *newval)
701 {
702         if (newval == NULL)
703                 pset.on_error_rollback = PSQL_ERROR_ROLLBACK_OFF;
704         else if (pg_strcasecmp(newval, "interactive") == 0)
705                 pset.on_error_rollback = PSQL_ERROR_ROLLBACK_INTERACTIVE;
706         else if (pg_strcasecmp(newval, "off") == 0)
707                 pset.on_error_rollback = PSQL_ERROR_ROLLBACK_OFF;
708         else
709                 pset.on_error_rollback = PSQL_ERROR_ROLLBACK_ON;
710 }
711
712 static void
713 histcontrol_hook(const char *newval)
714 {
715         if (newval == NULL)
716                 pset.histcontrol = hctl_none;
717         else if (strcmp(newval, "ignorespace") == 0)
718                 pset.histcontrol = hctl_ignorespace;
719         else if (strcmp(newval, "ignoredups") == 0)
720                 pset.histcontrol = hctl_ignoredups;
721         else if (strcmp(newval, "ignoreboth") == 0)
722                 pset.histcontrol = hctl_ignoreboth;
723         else
724                 pset.histcontrol = hctl_none;
725 }
726
727 static void
728 prompt1_hook(const char *newval)
729 {
730         pset.prompt1 = newval ? newval : "";
731 }
732
733 static void
734 prompt2_hook(const char *newval)
735 {
736         pset.prompt2 = newval ? newval : "";
737 }
738
739 static void
740 prompt3_hook(const char *newval)
741 {
742         pset.prompt3 = newval ? newval : "";
743 }
744
745 static void
746 verbosity_hook(const char *newval)
747 {
748         if (newval == NULL)
749                 pset.verbosity = PQERRORS_DEFAULT;
750         else if (strcmp(newval, "default") == 0)
751                 pset.verbosity = PQERRORS_DEFAULT;
752         else if (strcmp(newval, "terse") == 0)
753                 pset.verbosity = PQERRORS_TERSE;
754         else if (strcmp(newval, "verbose") == 0)
755                 pset.verbosity = PQERRORS_VERBOSE;
756         else
757                 pset.verbosity = PQERRORS_DEFAULT;
758
759         if (pset.db)
760                 PQsetErrorVerbosity(pset.db, pset.verbosity);
761 }
762
763
764 static void
765 EstablishVariableSpace(void)
766 {
767         pset.vars = CreateVariableSpace();
768
769         SetVariableAssignHook(pset.vars, "AUTOCOMMIT", autocommit_hook);
770         SetVariableAssignHook(pset.vars, "ON_ERROR_STOP", on_error_stop_hook);
771         SetVariableAssignHook(pset.vars, "QUIET", quiet_hook);
772         SetVariableAssignHook(pset.vars, "SINGLELINE", singleline_hook);
773         SetVariableAssignHook(pset.vars, "SINGLESTEP", singlestep_hook);
774         SetVariableAssignHook(pset.vars, "FETCH_COUNT", fetch_count_hook);
775         SetVariableAssignHook(pset.vars, "ECHO", echo_hook);
776         SetVariableAssignHook(pset.vars, "ECHO_HIDDEN", echo_hidden_hook);
777         SetVariableAssignHook(pset.vars, "ON_ERROR_ROLLBACK", on_error_rollback_hook);
778         SetVariableAssignHook(pset.vars, "HISTCONTROL", histcontrol_hook);
779         SetVariableAssignHook(pset.vars, "PROMPT1", prompt1_hook);
780         SetVariableAssignHook(pset.vars, "PROMPT2", prompt2_hook);
781         SetVariableAssignHook(pset.vars, "PROMPT3", prompt3_hook);
782         SetVariableAssignHook(pset.vars, "VERBOSITY", verbosity_hook);
783 }