From db12a63ef10f615462cef7fd9f704153fcf10550 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 13 Nov 1999 02:04:54 +0000 Subject: The \p\g fix didn't turn out to be so bad. It even works in other circumstances: => select * from foo\x\t\pset border 0 \p\g\\select * from bar; Also the release prep update so the sql_help.h is generated before packaging. Peter. --- src/bin/psql/command.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/bin/psql/command.c') diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 986ee365a52..0883d438f1c 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -58,7 +58,8 @@ static bool * Handles all the different commands that start with '\', * ordinarily called by MainLoop(). * - * 'line' is the current input line, which must start with a '\' + * 'line' is the current input line, which should not start with a '\' + * but with the actual command name * (that is taken care of by MainLoop) * * 'query_buf' contains the query-so-far, which may be modified by @@ -89,16 +90,22 @@ HandleSlashCmds(PsqlSettings *pset, my_line = xstrdup(line); /* - * Find the first whitespace (or backslash) line[blank_loc] will now + * Find the first whitespace. line[blank_loc] will now * be the whitespace character or the \0 at the end + * + * Also look for a backslash, so stuff like \p\g works. */ - blank_loc = strcspn(my_line, " \t"); + blank_loc = strcspn(my_line, " \t\\"); + if (my_line[blank_loc] == '\\') + { + continue_parse = &my_line[blank_loc]; + my_line[blank_loc] = '\0'; + } /* do we have an option string? */ - if (my_line[blank_loc] != '\0') - { - options_string = &my_line[blank_loc + 1]; - + else if (my_line[blank_loc] != '\0') + { + options_string = &my_line[blank_loc + 1]; my_line[blank_loc] = '\0'; } @@ -198,7 +205,6 @@ HandleSlashCmds(PsqlSettings *pset, } cmd = my_line; - status = exec_command(cmd, options, options_string, query_buf, pset); if (status == CMD_UNKNOWN) -- cgit v1.2.3