Show full path name when saving in psql

Started by Greg Sabino Mullanealmost 22 years ago3 messagespatches
Jump to latest
#1Greg Sabino Mullane
greg@turnstep.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

This patch shows the full path name when doing a \s in psql,
if you have previously issued a \cd command.

--
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200408271849

Index: command.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/command.c,v
retrieving revision 1.123
diff -c -r1.123 command.c
*** command.c   13 Aug 2004 14:47:23 -0000      1.123
--- command.c   27 Aug 2004 19:15:41 -0000
***************
*** 258,263 ****
--- 258,266 ----
                        success = false;
                }
+               pset.dirname = pg_strdup(dir);
+               canonicalize_path(pset.dirname);
+
                if (opt)
                        free(opt);
        }
***************
*** 643,649 ****
                success = saveHistory(fname ? fname : "/dev/tty");

if (success && !quiet && fname)
! printf(gettext("Wrote history to file \"%s\".\n"), fname);
free(fname);
}

--- 646,653 ----
                success = saveHistory(fname ? fname : "/dev/tty");

if (success && !quiet && fname)
! printf(gettext("Wrote history to file \"%s/%s\".\n"),
! pset.dirname ? pset.dirname : ".", fname);
free(fname);
}

-----BEGIN PGP SIGNATURE-----

iD8DBQFBL7rcvJuQZxSWSsgRArEzAJ46xxARaVVfeVmx/Ivjzr0+2iIsTACdHFgz
vFutaRJp5l/+Plmc4Q7CM9o=
=ibcl
-----END PGP SIGNATURE-----

#2Bruce Momjian
bruce@momjian.us
In reply to: Greg Sabino Mullane (#1)
Re: Show full path name when saving in psql

This has been saved for the 8.1 release:

http:/momjian.postgresql.org/cgi-bin/pgpatches2

---------------------------------------------------------------------------

Greg Sabino Mullane wrote:
[ There is text before PGP section. ]

[ PGP not available, raw data follows ]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

This patch shows the full path name when doing a \s in psql,
if you have previously issued a \cd command.

--
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200408271849

Index: command.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/command.c,v
retrieving revision 1.123
diff -c -r1.123 command.c
*** command.c   13 Aug 2004 14:47:23 -0000      1.123
--- command.c   27 Aug 2004 19:15:41 -0000
***************
*** 258,263 ****
--- 258,266 ----
success = false;
}
+               pset.dirname = pg_strdup(dir);
+               canonicalize_path(pset.dirname);
+
if (opt)
free(opt);
}
***************
*** 643,649 ****
success = saveHistory(fname ? fname : "/dev/tty");

if (success && !quiet && fname)
! printf(gettext("Wrote history to file \"%s\".\n"), fname);
free(fname);
}

--- 646,653 ----
success = saveHistory(fname ? fname : "/dev/tty");

if (success && !quiet && fname)
! printf(gettext("Wrote history to file \"%s/%s\".\n"),
! pset.dirname ? pset.dirname : ".", fname);
free(fname);
}

-----BEGIN PGP SIGNATURE-----

iD8DBQFBL7rcvJuQZxSWSsgRArEzAJ46xxARaVVfeVmx/Ivjzr0+2iIsTACdHFgz
vFutaRJp5l/+Plmc4Q7CM9o=
=ibcl
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[ Decrypting message... End of raw data. ]

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Bruce Momjian
bruce@momjian.us
In reply to: Greg Sabino Mullane (#1)
Re: Show full path name when saving in psql

Greg Sabino Mullane wrote:
[ There is text before PGP section. ]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

This patch shows the full path name when doing a \s in psql,
if you have previously issued a \cd command.

I have modified your patch and applied it. Your patch was missing a
define for dirname in pset, and was missing a pfree when the value
changed.

Attached patch applied.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+10-3