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

Commit 7d392f2

Browse files
committed
Fixed psql -c "\slashcmd"
1 parent f4d452c commit 7d392f2

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/bin/psql/command.c

+8-6
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/command.c,v 1.24 2000/03/01 21:09:58 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.25 2000/03/18 22:48:29 petere Exp $
77
*/
88
#include "postgres.h"
99
#include "command.h"
@@ -149,11 +149,13 @@ HandleSlashCmds(const char *line,
149149
if (continue_parse && *continue_parse && *(continue_parse + 1) == '\\')
150150
continue_parse += 2;
151151

152-
153-
if (continue_parse)
154-
*end_of_cmd = line + (continue_parse - my_line);
155-
else
156-
*end_of_cmd = line + strlen(line);
152+
if (end_of_cmd)
153+
{
154+
if (continue_parse)
155+
*end_of_cmd = line + (continue_parse - my_line);
156+
else
157+
*end_of_cmd = line + strlen(line);
158+
}
157159

158160
free(my_line);
159161

src/bin/psql/startup.c

+4-1
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/startup.c,v 1.27 2000/03/01 21:09:58 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.28 2000/03/18 22:48:29 petere Exp $
77
*/
88
#include "postgres.h"
99

@@ -357,7 +357,10 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
357357
case 'c':
358358
options->action_string = optarg;
359359
if (optarg[0] == '\\')
360+
{
360361
options->action = ACT_SINGLE_SLASH;
362+
options->action_string++;
363+
}
361364
else
362365
options->action = ACT_SINGLE_QUERY;
363366
break;

0 commit comments

Comments
 (0)