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

Commit 2af0d09

Browse files
committed
Fix to allow \f \ to make spaces as delimiter.
1 parent 1a07a52 commit 2af0d09

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/bin/psql/psql.c

+3-1
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.142 1998/05/12 23:05:12 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.143 1998/05/13 03:27:07 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1988,6 +1988,8 @@ HandleSlashCmds(PsqlSettings *pset,
19881988

19891989
if (optarg)
19901990
fs = optarg;
1991+
if (optarg && !*optarg && strlen(cmd) > 2)
1992+
fs = cmd + 2;
19911993
if (pset->opt.fieldSep)
19921994
free(pset->opt.fieldSep);
19931995
if (!(pset->opt.fieldSep = strdup(fs)))

src/bin/psql/stringutils.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.13 1998/02/26 04:39:13 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.14 1998/05/13 03:27:07 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -56,11 +56,20 @@ leftTrim(char *s)
5656
char *
5757
rightTrim(char *s)
5858
{
59-
char *sEnd;
59+
char *sEnd, *bsEnd;
60+
bool in_bs = false;
6061

6162
sEnd = s + strlen(s) - 1;
6263
while (sEnd >= s && isspace(*sEnd))
6364
sEnd--;
65+
bsEnd = sEnd;
66+
while (bsEnd >= s && *bsEnd == '\\')
67+
{
68+
in_bs = (in_bs == false);
69+
bsEnd--;
70+
}
71+
if (in_bs && *sEnd)
72+
sEnd++;
6473
if (sEnd < s)
6574
s[0] = '\0';
6675
else

0 commit comments

Comments
 (0)