summaryrefslogtreecommitdiff
path: root/src/bin/psql/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/help.c')
-rw-r--r--src/bin/psql/help.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index a591dec792a..98f13750bf2 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.157 2010/03/07 17:02:34 mha Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.158 2010/05/08 16:39:51 tgl Exp $
*/
#include "postgres_fe.h"
@@ -284,6 +284,7 @@ slashUsage(unsigned short int pager)
/*
* helpSQL -- help with SQL commands
*
+ * Note: we assume caller removed any trailing spaces in "topic".
*/
void
helpSQL(const char *topic, unsigned short int pager)
@@ -352,17 +353,16 @@ helpSQL(const char *topic, unsigned short int pager)
wordlen;
int nl_count = 0;
- /* User gets two chances: exact match, then the first word */
-
- /* First pass : strip trailing spaces and semicolons */
+ /*
+ * We first try exact match, then first + second words, then first
+ * word only.
+ */
len = strlen(topic);
- while (topic[len - 1] == ' ' || topic[len - 1] == ';')
- len--;
- for (x = 1; x <= 3; x++) /* Three chances to guess that word... */
+ for (x = 1; x <= 3; x++)
{
if (x > 1) /* Nothing on first pass - try the opening
- * words */
+ * word(s) */
{
wordlen = j = 1;
while (topic[j] != ' ' && j++ < len)
@@ -423,7 +423,7 @@ helpSQL(const char *topic, unsigned short int pager)
}
if (!help_found)
- fprintf(output, _("No help available for \"%-.*s\".\nTry \\h with no arguments to see available help.\n"), (int) len, topic);
+ fprintf(output, _("No help available for \"%s\".\nTry \\h with no arguments to see available help.\n"), topic);
/* Only close if we used the pager */
if (output != stdout)