Skip to content

Commit 0725065

Browse files
committed
This patch shows the full path name when doing a \s in psql,
if you have previously issued a \cd command. Greg Sabino Mullane
1 parent 51746c4 commit 0725065

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/bin/psql/command.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.144 2005/06/09 15:27:26 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.145 2005/06/09 23:28:09 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -276,6 +276,11 @@ exec_command(const char *cmd,
276276
success = false;
277277
}
278278

279+
if (pset.dirname)
280+
pfree(pset.dirname);
281+
pset.dirname = pg_strdup(dir);
282+
canonicalize_path(pset.dirname);
283+
279284
if (opt)
280285
free(opt);
281286
}
@@ -661,7 +666,8 @@ exec_command(const char *cmd,
661666
success = saveHistory(fname ? fname : "/dev/tty");
662667

663668
if (success && !quiet && fname)
664-
printf(_("Wrote history to file \"%s\".\n"), fname);
669+
printf(gettext("Wrote history to file \"%s/%s\".\n"),
670+
pset.dirname ? pset.dirname : ".", fname);
665671
if (!fname)
666672
putchar('\n');
667673
free(fname);

src/bin/psql/settings.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.23 2005/01/01 05:43:08 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.24 2005/06/09 23:28:10 momjian Exp $
77
*/
88
#ifndef SETTINGS_H
99
#define SETTINGS_H
@@ -49,6 +49,8 @@ typedef struct _psqlSettings
4949
int sversion; /* backend server version */
5050
const char *progname; /* in case you renamed psql */
5151
char *inputfile; /* for error reporting */
52+
char *dirname; /* current directory for \s display */
53+
5254
unsigned lineno; /* also for error reporting */
5355

5456
bool timing; /* enable timing of all queries */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy