*** ./src/bin/psql/command.c.orig Thu Oct 4 07:26:30 2001 --- ./src/bin/psql/command.c Thu Oct 4 07:30:37 2001 *************** *** 55,61 **** { OT_NORMAL, OT_SQLID, OT_FILEPIPE }; ! static char *scan_option(char **string, enum option_type type, char *quote); static char *unescape(const unsigned char *source, size_t len); static bool do_edit(const char *filename_arg, PQExpBuffer query_buf); --- 55,61 ---- { OT_NORMAL, OT_SQLID, OT_FILEPIPE }; ! static char *scan_option(char **string, enum option_type type, char *quote, bool semicolon); static char *unescape(const unsigned char *source, size_t len); static bool do_edit(const char *filename_arg, PQExpBuffer query_buf); *************** *** 216,222 **** /* \C -- override table title (formerly change HTML caption) */ else if (strcmp(cmd, "C") == 0) { ! char *opt = scan_option(&string, OT_NORMAL, NULL); success = do_pset("title", opt, &pset.popt, quiet); free(opt); --- 216,222 ---- /* \C -- override table title (formerly change HTML caption) */ else if (strcmp(cmd, "C") == 0) { ! char *opt = scan_option(&string, OT_NORMAL, NULL, true); success = do_pset("title", opt, &pset.popt, quiet); free(opt); *************** *** 238,245 **** char opt1q, opt2q; ! opt1 = scan_option(&string, OT_NORMAL, &opt1q); ! opt2 = scan_option(&string, OT_NORMAL, &opt2q); if (opt2) /* gave username */ --- 238,245 ---- char opt1q, opt2q; ! opt1 = scan_option(&string, OT_NORMAL, &opt1q, true); ! opt2 = scan_option(&string, OT_NORMAL, &opt2q, true); if (opt2) /* gave username */ *************** *** 273,280 **** { char *name; bool show_verbose; - name = scan_option(&string, OT_SQLID, NULL); show_verbose = strchr(cmd, '+') ? true : false; switch (cmd[1]) --- 273,280 ---- { char *name; bool show_verbose; + name = scan_option(&string, OT_SQLID, NULL, true); show_verbose = strchr(cmd, '+') ? true : false; switch (cmd[1]) *************** *** 337,343 **** } else { ! fname = scan_option(&string, OT_NORMAL, NULL); status = do_edit(fname, query_buf) ? CMD_NEWEDIT : CMD_ERROR; free(fname); } --- 337,343 ---- } else { ! fname = scan_option(&string, OT_NORMAL, NULL, true); status = do_edit(fname, query_buf) ? CMD_NEWEDIT : CMD_ERROR; free(fname); } *************** *** 356,363 **** fout = pset.queryFout; else fout = stdout; ! ! while ((value = scan_option(&string, OT_NORMAL, "ed))) { if (!quoted && strcmp(value, "-n") == 0) no_newline = true; --- 356,363 ---- fout = pset.queryFout; else fout = stdout; ! ! while ((value = scan_option(&string, OT_NORMAL, "ed, false))) { if (!quoted && strcmp(value, "-n") == 0) no_newline = true; *************** *** 378,384 **** /* \encoding -- set/show client side encoding */ else if (strcmp(cmd, "encoding") == 0) { ! char *encoding = scan_option(&string, OT_NORMAL, NULL); if (!encoding) /* show encoding */ --- 378,384 ---- /* \encoding -- set/show client side encoding */ else if (strcmp(cmd, "encoding") == 0) { ! char *encoding = scan_option(&string, OT_NORMAL, NULL, false); if (!encoding) /* show encoding */ *************** *** 406,412 **** /* \f -- change field separator */ else if (strcmp(cmd, "f") == 0) { ! char *fname = scan_option(&string, OT_NORMAL, NULL); success = do_pset("fieldsep", fname, &pset.popt, quiet); free(fname); --- 406,412 ---- /* \f -- change field separator */ else if (strcmp(cmd, "f") == 0) { ! char *fname = scan_option(&string, OT_NORMAL, NULL, false); success = do_pset("fieldsep", fname, &pset.popt, quiet); free(fname); *************** *** 415,421 **** /* \g means send query */ else if (strcmp(cmd, "g") == 0) { ! char *fname = scan_option(&string, OT_FILEPIPE, NULL); if (!fname) pset.gfname = NULL; --- 415,421 ---- /* \g means send query */ else if (strcmp(cmd, "g") == 0) { ! char *fname = scan_option(&string, OT_FILEPIPE, NULL, false); if (!fname) pset.gfname = NULL; *************** *** 447,453 **** /* \i is include file */ else if (strcmp(cmd, "i") == 0 || strcmp(cmd, "include") == 0) { ! char *fname = scan_option(&string, OT_NORMAL, NULL); if (!fname) { --- 447,453 ---- /* \i is include file */ else if (strcmp(cmd, "i") == 0 || strcmp(cmd, "include") == 0) { ! char *fname = scan_option(&string, OT_NORMAL, NULL, true); if (!fname) { *************** *** 475,482 **** char *opt1, *opt2; ! opt1 = scan_option(&string, OT_NORMAL, NULL); ! opt2 = scan_option(&string, OT_NORMAL, NULL); if (strcmp(cmd + 3, "export") == 0) { --- 475,482 ---- char *opt1, *opt2; ! opt1 = scan_option(&string, OT_NORMAL, NULL, true); ! opt2 = scan_option(&string, OT_NORMAL, NULL, true); if (strcmp(cmd + 3, "export") == 0) { *************** *** 525,531 **** /* \o -- set query output */ else if (strcmp(cmd, "o") == 0 || strcmp(cmd, "out") == 0) { ! char *fname = scan_option(&string, OT_FILEPIPE, NULL); success = setQFout(fname); free(fname); --- 525,531 ---- /* \o -- set query output */ else if (strcmp(cmd, "o") == 0 || strcmp(cmd, "out") == 0) { ! char *fname = scan_option(&string, OT_FILEPIPE, NULL, true); success = setQFout(fname); free(fname); *************** *** 544,551 **** /* \pset -- set printing parameters */ else if (strcmp(cmd, "pset") == 0) { ! char *opt0 = scan_option(&string, OT_NORMAL, NULL); ! char *opt1 = scan_option(&string, OT_NORMAL, NULL); if (!opt0) { --- 544,551 ---- /* \pset -- set printing parameters */ else if (strcmp(cmd, "pset") == 0) { ! char *opt0 = scan_option(&string, OT_NORMAL, NULL, false); ! char *opt1 = scan_option(&string, OT_NORMAL, NULL, false); if (!opt0) { *************** *** 574,580 **** /* \s save history in a file or show it on the screen */ else if (strcmp(cmd, "s") == 0) { ! char *fname = scan_option(&string, OT_NORMAL, NULL); success = saveHistory(fname ? fname : "/dev/tty"); --- 574,580 ---- /* \s save history in a file or show it on the screen */ else if (strcmp(cmd, "s") == 0) { ! char *fname = scan_option(&string, OT_NORMAL, NULL, true); success = saveHistory(fname ? fname : "/dev/tty"); *************** *** 586,592 **** /* \set -- generalized set variable/option command */ else if (strcmp(cmd, "set") == 0) { ! char *opt0 = scan_option(&string, OT_NORMAL, NULL); if (!opt0) { --- 586,592 ---- /* \set -- generalized set variable/option command */ else if (strcmp(cmd, "set") == 0) { ! char *opt0 = scan_option(&string, OT_NORMAL, NULL, false); if (!opt0) { *************** *** 611,621 **** char *newval = NULL; char *opt; ! opt = scan_option(&string, OT_NORMAL, NULL); newval = xstrdup(opt ? opt : ""); free(opt); ! while ((opt = scan_option(&string, OT_NORMAL, NULL))) { newval = realloc(newval, strlen(newval) + strlen(opt) + 1); if (!newval) --- 611,621 ---- char *newval = NULL; char *opt; ! opt = scan_option(&string, OT_NORMAL, NULL, false); newval = xstrdup(opt ? opt : ""); free(opt); ! while ((opt = scan_option(&string, OT_NORMAL, NULL, false))) { newval = realloc(newval, strlen(newval) + strlen(opt) + 1); if (!newval) *************** *** 645,651 **** /* \T -- define html