Re: Show full path name when saving in psql - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: Show full path name when saving in psql |
Date | |
Msg-id | 200506092327.j59NRlk00279@candle.pha.pa.us Whole thread Raw |
In response to | Show full path name when saving in psql ("Greg Sabino Mullane" <greg@turnstep.com>) |
List | pgsql-patches |
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 Index: src/bin/psql/command.c =================================================================== RCS file: /cvsroot/pgsql/src/bin/psql/command.c,v retrieving revision 1.144 diff -c -c -r1.144 command.c *** src/bin/psql/command.c 9 Jun 2005 15:27:26 -0000 1.144 --- src/bin/psql/command.c 9 Jun 2005 23:21:16 -0000 *************** *** 276,281 **** --- 276,286 ---- success = false; } + if (pset.dirname) + pfree(pset.dirname); + pset.dirname = pg_strdup(dir); + canonicalize_path(pset.dirname); + if (opt) free(opt); } *************** *** 661,667 **** success = saveHistory(fname ? fname : "/dev/tty"); if (success && !quiet && fname) ! printf(_("Wrote history to file \"%s\".\n"), fname); if (!fname) putchar('\n'); free(fname); --- 666,673 ---- success = saveHistory(fname ? fname : "/dev/tty"); if (success && !quiet && fname) ! printf(gettext("Wrote history to file \"%s/%s\".\n"), ! pset.dirname ? pset.dirname : ".", fname); if (!fname) putchar('\n'); free(fname); Index: src/bin/psql/settings.h =================================================================== RCS file: /cvsroot/pgsql/src/bin/psql/settings.h,v retrieving revision 1.23 diff -c -c -r1.23 settings.h *** src/bin/psql/settings.h 1 Jan 2005 05:43:08 -0000 1.23 --- src/bin/psql/settings.h 9 Jun 2005 23:21:16 -0000 *************** *** 49,54 **** --- 49,56 ---- int sversion; /* backend server version */ const char *progname; /* in case you renamed psql */ char *inputfile; /* for error reporting */ + char *dirname; /* current directory for \s display */ + unsigned lineno; /* also for error reporting */ bool timing; /* enable timing of all queries */
pgsql-patches by date: