Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9d31e3a

Browse files
committed
/home/peter/commit-msg
1 parent 475cb15 commit 9d31e3a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/bin/psql/help.c

+11-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.29 2000/05/11 18:41:00 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.30 2000/05/12 16:13:44 petere Exp $
77
*/
88
#include "postgres.h"
99
#include "help.h"
@@ -269,11 +269,11 @@ helpSQL(const char *topic)
269269

270270
for (i = 0; i < items_per_column; i++)
271271
{
272-
printf(" %-25s%-25s",
272+
printf(" %-26s%-26s",
273273
VALUE_OR_NULL(QL_HELP[i].cmd),
274274
VALUE_OR_NULL(QL_HELP[i + items_per_column].cmd));
275275
if (i + 2 * items_per_column < QL_HELP_COUNT)
276-
printf("%-25s",
276+
printf("%-26s",
277277
VALUE_OR_NULL(QL_HELP[i + 2 * items_per_column].cmd));
278278
fputc('\n', stdout);
279279
}
@@ -283,10 +283,16 @@ helpSQL(const char *topic)
283283
{
284284
int i;
285285
bool help_found = false;
286+
size_t len;
287+
288+
/* don't care about trailing spaces */
289+
len = strlen(topic);
290+
while (topic[len-1] == ' ')
291+
len--;
286292

287293
for (i = 0; QL_HELP[i].cmd; i++)
288294
{
289-
if (strcasecmp(QL_HELP[i].cmd, topic) == 0 ||
295+
if (strncasecmp(topic, QL_HELP[i].cmd, len) == 0 ||
290296
strcmp(topic, "*") == 0)
291297
{
292298
help_found = true;
@@ -298,7 +304,7 @@ helpSQL(const char *topic)
298304
}
299305

300306
if (!help_found)
301-
printf("No help available for '%s'.\nTry \\h with no arguments to see available help.\n", topic);
307+
printf("No help available for '%-.*s'.\nTry \\h with no arguments to see available help.\n", (int)len, topic);
302308
}
303309
}
304310

src/bin/psql/mainloop.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.29 2000/04/14 23:43:44 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.30 2000/05/12 16:13:44 petere Exp $
77
*/
88
#include "postgres.h"
99
#include "mainloop.h"
@@ -297,6 +297,7 @@ MainLoop(FILE *source)
297297
else
298298
bslash_count = 0;
299299

300+
rescan:
300301
/* in quote? */
301302
if (in_quote)
302303
{
@@ -382,7 +383,8 @@ MainLoop(FILE *source)
382383
free(line);
383384
line = new;
384385
len = strlen(new);
385-
continue; /* reparse the just substituted */
386+
387+
goto rescan; /* reparse the just substituted */
386388
}
387389
else
388390
{

0 commit comments

Comments
 (0)