3
3
*
4
4
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
5
5
*
6
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.108 2003/12/01 22: 21:54 momjian Exp $
6
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.109 2004/01/09 21:12:20 momjian Exp $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
#include "command.h"
@@ -413,6 +413,7 @@ exec_command(const char *cmd,
413
413
else
414
414
{
415
415
fname = scan_option (& string ,OT_NORMAL ,NULL , true);
416
+ expand_tilde (& fname );
416
417
status = do_edit (fname ,query_buf ) ?CMD_NEWEDIT :CMD_ERROR ;
417
418
free (fname );
418
419
}
@@ -494,7 +495,10 @@ exec_command(const char *cmd,
494
495
if (!fname )
495
496
pset .gfname = NULL ;
496
497
else
498
+ {
499
+ expand_tilde (& fname );
497
500
pset .gfname = xstrdup (fname );
501
+ }
498
502
free (fname );
499
503
status = CMD_SEND ;
500
504
}
@@ -531,6 +535,7 @@ exec_command(const char *cmd,
531
535
}
532
536
else
533
537
{
538
+ expand_tilde (& fname );
534
539
success = (process_file (fname )== EXIT_SUCCESS );
535
540
free (fname );
536
541
}
@@ -561,7 +566,10 @@ exec_command(const char *cmd,
561
566
success = false;
562
567
}
563
568
else
569
+ {
570
+ expand_tilde (& opt2 );
564
571
success = do_lo_export (opt1 ,opt2 );
572
+ }
565
573
}
566
574
567
575
else if (strcmp (cmd + 3 ,"import" )== 0 )
@@ -572,7 +580,10 @@ exec_command(const char *cmd,
572
580
success = false;
573
581
}
574
582
else
583
+ {
584
+ expand_tilde (& opt1 );
575
585
success = do_lo_import (opt1 ,opt2 );
586
+ }
576
587
}
577
588
578
589
else if (strcmp (cmd + 3 ,"list" )== 0 )
@@ -602,6 +613,7 @@ exec_command(const char *cmd,
602
613
{
603
614
char * fname = scan_option (& string ,OT_FILEPIPE ,NULL , true);
604
615
616
+ expand_tilde (& fname );
605
617
success = setQFout (fname );
606
618
free (fname );
607
619
}
@@ -653,6 +665,7 @@ exec_command(const char *cmd,
653
665
{
654
666
char * fname = scan_option (& string ,OT_NORMAL ,NULL , true);
655
667
668
+ expand_tilde (& fname );
656
669
success = saveHistory (fname ?fname :"/dev/tty" );
657
670
658
671
if (success && !quiet && fname )
@@ -771,6 +784,7 @@ exec_command(const char *cmd,
771
784
else
772
785
{
773
786
fname = scan_option (& string ,OT_FILEPIPE ,NULL , true);
787
+ expand_tilde (& fname );
774
788
775
789
if (!fname )
776
790
{