mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Fix to allow \f \ to make spaces as delimiter.
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.142 1998/05/12 23:05:12 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.143 1998/05/13 03:27:07 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1988,6 +1988,8 @@ HandleSlashCmds(PsqlSettings *pset,
|
|||||||
|
|
||||||
if (optarg)
|
if (optarg)
|
||||||
fs = optarg;
|
fs = optarg;
|
||||||
|
if (optarg && !*optarg && strlen(cmd) > 2)
|
||||||
|
fs = cmd + 2;
|
||||||
if (pset->opt.fieldSep)
|
if (pset->opt.fieldSep)
|
||||||
free(pset->opt.fieldSep);
|
free(pset->opt.fieldSep);
|
||||||
if (!(pset->opt.fieldSep = strdup(fs)))
|
if (!(pset->opt.fieldSep = strdup(fs)))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.13 1998/02/26 04:39:13 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.14 1998/05/13 03:27:07 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -56,11 +56,20 @@ leftTrim(char *s)
|
|||||||
char *
|
char *
|
||||||
rightTrim(char *s)
|
rightTrim(char *s)
|
||||||
{
|
{
|
||||||
char *sEnd;
|
char *sEnd, *bsEnd;
|
||||||
|
bool in_bs = false;
|
||||||
|
|
||||||
sEnd = s + strlen(s) - 1;
|
sEnd = s + strlen(s) - 1;
|
||||||
while (sEnd >= s && isspace(*sEnd))
|
while (sEnd >= s && isspace(*sEnd))
|
||||||
sEnd--;
|
sEnd--;
|
||||||
|
bsEnd = sEnd;
|
||||||
|
while (bsEnd >= s && *bsEnd == '\\')
|
||||||
|
{
|
||||||
|
in_bs = (in_bs == false);
|
||||||
|
bsEnd--;
|
||||||
|
}
|
||||||
|
if (in_bs && *sEnd)
|
||||||
|
sEnd++;
|
||||||
if (sEnd < s)
|
if (sEnd < s)
|
||||||
s[0] = '\0';
|
s[0] = '\0';
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user