Another \f\ fix for psql.
authorBruce Momjian
Fri, 15 May 1998 01:57:33 +0000 (01:57 +0000)
committerBruce Momjian
Fri, 15 May 1998 01:57:33 +0000 (01:57 +0000)
src/bin/psql/psql.c

index 0542d3951e9958ed4f769c57bb3818fce73fad07..e698f68fb53c64ffb6cb7840aaffe4e61dc2acb5 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.143 1998/05/13 03:27:07 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.144 1998/05/15 01:57:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1988,8 +1988,16 @@ HandleSlashCmds(PsqlSettings *pset,
 
                if (optarg)
                    fs = optarg;
-               if (optarg && !*optarg && strlen(cmd) > 2)
-                   fs = cmd + 2;
+               /* handle \f \{space} */
+               if (optarg && !*optarg && strlen(cmd) > 1)
+               {
+                   int         i;
+                   
+                   /* line and cmd match until the first blank space */
+                   for (i=2; isspace(line[i]); i++)
+                       ;
+                   fs = cmd + i - 1;
+               }
                if (pset->opt.fieldSep)
                    free(pset->opt.fieldSep);
                if (!(pset->opt.fieldSep = strdup(fs)))