33 *
44 * Copyright (c) 2000-2003, PostgreSQL Global Development Group
55 *
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 $
77 */
88#include "postgres_fe.h"
99#include "command.h"
@@ -413,6 +413,7 @@ exec_command(const char *cmd,
413413else
414414{
415415fname = scan_option (& string ,OT_NORMAL ,NULL , true);
416+ expand_tilde (& fname );
416417status = do_edit (fname ,query_buf ) ?CMD_NEWEDIT :CMD_ERROR ;
417418free (fname );
418419}
@@ -494,7 +495,10 @@ exec_command(const char *cmd,
494495if (!fname )
495496pset .gfname = NULL ;
496497else
498+ {
499+ expand_tilde (& fname );
497500pset .gfname = xstrdup (fname );
501+ }
498502free (fname );
499503status = CMD_SEND ;
500504}
@@ -531,6 +535,7 @@ exec_command(const char *cmd,
531535}
532536else
533537{
538+ expand_tilde (& fname );
534539success = (process_file (fname )== EXIT_SUCCESS );
535540free (fname );
536541}
@@ -561,7 +566,10 @@ exec_command(const char *cmd,
561566success = false;
562567}
563568else
569+ {
570+ expand_tilde (& opt2 );
564571success = do_lo_export (opt1 ,opt2 );
572+ }
565573}
566574
567575else if (strcmp (cmd + 3 ,"import" )== 0 )
@@ -572,7 +580,10 @@ exec_command(const char *cmd,
572580success = false;
573581}
574582else
583+ {
584+ expand_tilde (& opt1 );
575585success = do_lo_import (opt1 ,opt2 );
586+ }
576587}
577588
578589else if (strcmp (cmd + 3 ,"list" )== 0 )
@@ -602,6 +613,7 @@ exec_command(const char *cmd,
602613{
603614char * fname = scan_option (& string ,OT_FILEPIPE ,NULL , true);
604615
616+ expand_tilde (& fname );
605617success = setQFout (fname );
606618free (fname );
607619}
@@ -653,6 +665,7 @@ exec_command(const char *cmd,
653665{
654666char * fname = scan_option (& string ,OT_NORMAL ,NULL , true);
655667
668+ expand_tilde (& fname );
656669success = saveHistory (fname ?fname :"/dev/tty" );
657670
658671if (success && !quiet && fname )
@@ -771,6 +784,7 @@ exec_command(const char *cmd,
771784else
772785{
773786fname = scan_option (& string ,OT_FILEPIPE ,NULL , true);
787+ expand_tilde (& fname );
774788
775789if (!fname )
776790{