From c62a5465fba74c9bc1ae2e45b705a633a03fcc46 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 6 Oct 2004 18:39:16 +0000 Subject: [PATCH] Suppress psql \s help display for platforms like Win32 that don't typically install witn readline, and throw an error if they try to access it. --- doc/src/sgml/ref/psql-ref.sgml | 4 ++-- src/bin/psql/help.c | 4 +++- src/bin/psql/input.c | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 8dce2924db..02c298f91a 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1,5 +1,5 @@ @@ -1603,7 +1603,7 @@ lo_import 152801 class="parameter">filename is omitted, the history is written to the standard output. This option is only available if psql is configured to use the - GNU history library. + GNU readline (or history) library. diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 24d2c8f59f..1fa93c203a 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2004, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.93 2004/08/29 05:06:54 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.94 2004/10/06 18:39:16 momjian Exp $ */ #include "postgres_fe.h" #include "common.h" @@ -194,7 +194,9 @@ slashUsage(unsigned short int pager) fprintf(output, _(" \\g [FILE] send query buffer to server (and results to file or |pipe)\n")); fprintf(output, _(" \\p show the contents of the query buffer\n")); fprintf(output, _(" \\r reset (clear) the query buffer\n")); +#ifdef USE_READLINE fprintf(output, _(" \\s [FILE] display history or save it to file\n")); +#endif fprintf(output, _(" \\w FILE write query buffer to file\n")); fprintf(output, "\n"); diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index 7cc59c1421..769ac88229 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2004, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.38 2004/09/27 19:16:02 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.39 2004/10/06 18:39:16 momjian Exp $ */ #include "postgres_fe.h" #include "input.h" @@ -209,6 +209,8 @@ saveHistory(char *fname) psql_error("could not save history to file \"%s\": %s\n", fname, strerror(errno)); } +#else + psql_error("history is not supported on this platform\n"); #endif return false; -- 2.11.0