This patch shows the full path name when doing a \s in psql,
authorBruce Momjian
Thu, 9 Jun 2005 23:28:10 +0000 (23:28 +0000)
committerBruce Momjian
Thu, 9 Jun 2005 23:28:10 +0000 (23:28 +0000)
if you have previously issued a \cd command.

Greg Sabino Mullane

src/bin/psql/command.c
src/bin/psql/settings.h

index 5b646ee130fb3df21b093747ba696b22059e8524..bf58b885a93883d96c6f1f1e4a1c7c9a69f8f5fa 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2005, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.144 2005/06/09 15:27:26 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.145 2005/06/09 23:28:09 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -276,6 +276,11 @@ exec_command(const char *cmd,
            success = false;
        }
 
+       if (pset.dirname)
+           pfree(pset.dirname);
+       pset.dirname = pg_strdup(dir);
+       canonicalize_path(pset.dirname);
+
        if (opt)
            free(opt);
    }
@@ -661,7 +666,8 @@ exec_command(const char *cmd,
        success = saveHistory(fname ? fname : "/dev/tty");
 
        if (success && !quiet && fname)
-           printf(_("Wrote history to file \"%s\".\n"), fname);
+           printf(gettext("Wrote history to file \"%s/%s\".\n"),
+                  pset.dirname ? pset.dirname : ".", fname);
        if (!fname)
            putchar('\n');
        free(fname);
index a2b67905d22b7ac84afd42b9c48ecc882a7db497..5090efd7b69973cb120a4a56afce34bef82d6607 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2005, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.23 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.24 2005/06/09 23:28:10 momjian Exp $
  */
 #ifndef SETTINGS_H
 #define SETTINGS_H
@@ -49,6 +49,8 @@ typedef struct _psqlSettings
    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 */