diff options
author | Bruce Momjian | 2001-06-11 22:12:48 +0000 |
---|---|---|
committer | Bruce Momjian | 2001-06-11 22:12:48 +0000 |
commit | 3a5d2ba776c761c96c9706c5bca3b22fc4af4a80 (patch) | |
tree | f45b65870da5116df307e864b761335fd4d663f4 | |
parent | 36b3fcc02ae29ed27ec87ad20936fb0d63e8919a (diff) |
The attached patch enables PostgreSQL CVS to build cleanly under Cygwin
when built against readline 4.2. Specifically, it handles the deprecation
of
filename_completion_function()
with preference for
rl_filename_completion_function()
Although, I was motivated by Cygwin support, IMO this patch is appropriate
for all platforms. To quote from the readline source:
#if 0
/* Backwards compatibility (compat.c). These will go away sometime. */
...
extern READLINE_EXPORT(char, *filename_completion_function) ...
#endif
Note that this patch is modeled after the one by Peter Eisentraut for
completion_matches():
http://www.ca.postgresql.org/~petere/readline42.html
I tested this patch under the following environments:
Cygwin with readline 4.1
Cygwin with readline 4.2
Linux with readline 2.2.1
Linux with readline 4.2
and it behaved as expected.
Jason Tishler
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/bin/psql/tab-complete.c | 4 | ||||
-rw-r--r-- | src/include/config.h.in | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/configure.in b/configure.in index d18e57e3cb..045b890f35 100644 --- a/configure.in +++ b/configure.in @@ -928,7 +928,7 @@ AC_TRY_LINK([#include <stdio.h> AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER)], [AC_MSG_RESULT(no)]) -AC_CHECK_FUNCS([rl_completion_matches]) +AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function]) dnl Cannot use AC_CHECK_FUNC because finite may be a macro diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 9978f41437..8678dd37d9 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -60,7 +60,9 @@ #include "common.h" #include "settings.h" -extern char *filename_completion_function(); +#ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION +#define filename_completion_function rl_filename_completion_function +#endif #ifdef HAVE_RL_COMPLETION_MATCHES #define completion_matches(x, y) rl_completion_matches((x), ((rl_compentry_func_t *)(y))) diff --git a/src/include/config.h.in b/src/include/config.h.in index 437ecf7c9e..ed0b5832e1 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -589,6 +589,9 @@ extern int fdatasync(int fildes); /* Set to 1 if you have rl_completion_matches */ #undef HAVE_RL_COMPLETION_MATCHES +/* Set to 1 if you have rl_filename_completion_function */ +#undef HAVE_RL_FILENAME_COMPLETION_FUNCTION + /* Set to 1 if you have getopt_long() (GNU long options) */ #undef HAVE_GETOPT_LONG |