Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65ff0fe

Browse files
committed
Fix backslash commands broken when \connect user added.
1 parentc9be1bc commit65ff0fe

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

‎src/bin/psql/psql.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.60 1997/05/21 03:12:02 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.61 1997/05/22 18:55:35 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1055,19 +1055,12 @@ HandleSlashCmds(PsqlSettings * settings,
10551055
* assuming it's not a one-character command. If it's a one-character
10561056
* command, this is meaningless.
10571057
*/
1058-
char*optarg3;
1059-
/*
1060-
* Pointer inside the second <cmd> string to the argument of the slash command
1061-
* assuming it's not a one-character command. If it's a one-character
1062-
* command, this is meaningless.
1063-
*/
10641058
char*cmd;
10651059
/*
10661060
* String: value of the slash command, less the slash and with escape
10671061
* sequences decoded.
10681062
*/
10691063
intblank_loc;
1070-
intblank_loc2;
10711064
/* Offset within <cmd> of first blank */
10721065

10731066
cmd=malloc(strlen(line));/* unescaping better not make string grow. */
@@ -1089,19 +1082,10 @@ HandleSlashCmds(PsqlSettings * settings,
10891082
optarg=NULL;
10901083

10911084
blank_loc=strcspn(cmd," \t");
1092-
if (blank_loc==0) {
1085+
if (blank_loc==0)
10931086
optarg2=NULL;
1094-
optarg3=NULL;
1095-
}else {
1087+
else
10961088
optarg2=cmd+blank_loc+strspn(cmd+blank_loc," \t");
1097-
blank_loc2=strcspn(optarg2," \t");
1098-
if (blank_loc2==0||*(optarg2+blank_loc2)=='\0')
1099-
optarg3=NULL;
1100-
else {
1101-
optarg3=optarg2+blank_loc2+strspn(optarg2+blank_loc2," \t");
1102-
*(optarg2+blank_loc2)='\0';
1103-
}
1104-
}
11051089

11061090
switch (cmd[0]) {
11071091
case'a':/* toggles to align fields on output */
@@ -1124,8 +1108,20 @@ HandleSlashCmds(PsqlSettings * settings,
11241108
case'c':{
11251109
if (strncmp(cmd,"copy ",strlen("copy "))==0)
11261110
do_copy(optarg2,settings);
1127-
elseif (strncmp(cmd,"connect ",strlen("connect "))==0)
1111+
elseif (strncmp(cmd,"connect ",strlen("connect "))==0) {
1112+
char*optarg3;
1113+
intblank_loc2;
1114+
1115+
blank_loc2=strcspn(optarg2," \t");
1116+
if (blank_loc2==0||*(optarg2+blank_loc2)=='\0')
1117+
optarg3=NULL;
1118+
else {
1119+
optarg3=optarg2+blank_loc2+
1120+
strspn(optarg2+blank_loc2," \t");
1121+
*(optarg2+blank_loc2)='\0';
1122+
}
11281123
do_connect(optarg2,optarg3,settings);
1124+
}
11291125
else
11301126
do_connect(optarg,optarg2,settings);
11311127
}

‎src/bin/psql/psqlHelp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.13 1997/05/17 06:16:34 thomas Exp $
8+
* $Id: psqlHelp.h,v 1.14 1997/05/22 18:55:40 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -175,6 +175,6 @@ static struct _helpStruct QL_HELP[] = {
175175
"update <class_name> set <attr1>=<expr1>,...<attrN>=<exprN> [from <from_clause>] [where <qual>];"},
176176
{"vacuum",
177177
"vacuum the database, i.e. cleans out deleted records, updates statistics",
178-
"vacuum [verbose] [analyze]\n\tor\nvacuum [verbose] table [analyze [(attr1, ... attrN)] ];"},
178+
"vacuum [verbose] [analyze]\n\tor\nvacuum [verbose][analyze]table [analyze [(attr1, ... attrN)] ];"},
179179
{NULL,NULL,NULL}/* important to keep a NULL terminator here! */
180180
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp