Skip to content

Commit 4376fdb

Browse files
committed
C comment: clarify why psql's help/exit/quit must alone
Document why no indentation and why no non-whitespace postfix is supported. Backpatch-through: master
1 parent 4cab43e commit 4376fdb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/bin/psql/mainloop.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,13 @@ MainLoop(FILE *source)
237237
bool found_exit_or_quit = false;
238238
bool found_q = false;
239239

240-
/* Search for the words we recognize; must be first word */
240+
/*
241+
* The assistance words, help/exit/quit, must have no
242+
* whitespace before them, and only whitespace after, with an
243+
* optional semicolon. This prevents indented use of these
244+
* words, perhaps as identifiers, from invoking the assistance
245+
* behavior.
246+
*/
241247
if (pg_strncasecmp(first_word, "help", 4) == 0)
242248
{
243249
rest_of_line = first_word + 4;
@@ -249,7 +255,6 @@ MainLoop(FILE *source)
249255
rest_of_line = first_word + 4;
250256
found_exit_or_quit = true;
251257
}
252-
253258
else if (strncmp(first_word, "\\q", 2) == 0)
254259
{
255260
rest_of_line = first_word + 2;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy