Обсуждение: PATCH: postgresql-7.1 + readline-4.2 compatability

Поиск
Список
Период
Сортировка

PATCH: postgresql-7.1 + readline-4.2 compatability

От
"Adam J. Richter"
Дата:
    The following patch allows postgresql-7.1 to build under
readline-4.2, per the discussion on this topic on pgsql-hackers.
This patch should also preserve backware compatability.  It makes
the source code use the readline-4.2 terminology, with #define's
for automatic backward compatability.

    At this point all I know is that this patch allows postgresql-7.1
to compile successfully with readline-4.2.

Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

--- postgresql-7.1/configure.in    Fri Apr 13 14:22:46 2001
+++ postgresql/configure.in    Mon Apr 16 00:51:02 2001
@@ -903,10 +903,15 @@
 else
     _readline_header='xxx'
 fi
-AC_EGREP_HEADER([filename_completion_function], [$_readline_header],
-[AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
-AC_MSG_RESULT(yes)],
-[AC_MSG_RESULT(no)])
+
+AC_EGREP_HEADER([rl_filename_completion_function], [$_readline_header],
+    [AC_DEFINE(HAVE_RL_FILENAME_COMPLETION_FUNCTION_DECL)
+     AC_MSG_RESULT(yes)],
+    [AC_MSG_RESULT(no)
+     AC_EGREP_HEADER([filename_completion_function], [$_readline_header],
+    [AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
+     AC_MSG_RESULT(yes)],
+    [AC_MSG_RESULT(no)])])



--- postgresql-7.1/src/include/config.h.in    Fri Mar 23 16:54:58 2001
+++ postgresql/src/include/config.h.in    Mon Apr 16 00:52:00 2001
@@ -573,6 +573,9 @@
 /* Set to 1 if your libreadline defines rl_completion_append_character */
 #undef HAVE_RL_COMPLETION_APPEND_CHARACTER

+/* Set to 1 if rl_filename_completion_function is declared in the readline header */
+#undef HAVE_RL_FILENAME_COMPLETION_FUNCTION_DECL
+
 /* Set to 1 if filename_completion_function is declared in the readline header */
 #undef HAVE_FILENAME_COMPLETION_FUNCTION_DECL

--- postgresql-7.1/src/bin/psql/tab-complete.c    Sun Apr  1 12:17:32 2001
+++ postgresql/src/bin/psql/tab-complete.c    Mon Apr 16 00:57:08 2001
@@ -60,9 +60,11 @@
 #include "common.h"
 #include "settings.h"

-#ifndef HAVE_FILENAME_COMPLETION_FUNCTION_DECL
-char       *filename_completion_function(char *, int);
-
+#ifndef HAVE_RL_FILENAME_COMPLETION_FUNCTION_DECL
+#  define rl_filename_completion_function filename_completion_function
+#  ifndef HAVE_FILENAME_COMPLETION_FUNCTION_DECL
+     char       *filename_completion_function(char *, int);
+#  endif
 #endif

 #define BUF_SIZE 2048
@@ -731,7 +733,7 @@
              strcmp(prev_wd, "\\s") == 0 ||
            strcmp(prev_wd, "\\w") == 0 || strcmp(prev_wd, "\\write") == 0
         )
-        matches = completion_matches(text, filename_completion_function);
+        matches = completion_matches(text, rl_filename_completion_function);


     /*


Re: PATCH: postgresql-7.1 + readline-4.2 compatability

От
Peter Eisentraut
Дата:
Adam J. Richter writes:

>     The following patch allows postgresql-7.1 to build under
> readline-4.2, per the discussion on this topic on pgsql-hackers.
> This patch should also preserve backware compatability.  It makes
> the source code use the readline-4.2 terminology, with #define's
> for automatic backward compatability.

This is already fixed in current CVS, to be released in 7.1.1.  The patch
is available at http://www.postgresql.org/~petere/readline42.html.  I
don't believe that your patch is complete.  There are a few more places
that need to be changed, for example the assignment of
rl_attempted_completion_function.

>[snipped]
> --- postgresql-7.1/src/bin/psql/tab-complete.c    Sun Apr  1 12:17:32 2001
> +++ postgresql/src/bin/psql/tab-complete.c    Mon Apr 16 00:57:08 2001
> @@ -60,9 +60,11 @@
>  #include "common.h"
>  #include "settings.h"
>
> -#ifndef HAVE_FILENAME_COMPLETION_FUNCTION_DECL
> -char       *filename_completion_function(char *, int);
> -
> +#ifndef HAVE_RL_FILENAME_COMPLETION_FUNCTION_DECL
> +#  define rl_filename_completion_function filename_completion_function
> +#  ifndef HAVE_FILENAME_COMPLETION_FUNCTION_DECL
> +     char       *filename_completion_function(char *, int);
> +#  endif
>  #endif
>
>  #define BUF_SIZE 2048
> @@ -731,7 +733,7 @@
>               strcmp(prev_wd, "\\s") == 0 ||
>             strcmp(prev_wd, "\\w") == 0 || strcmp(prev_wd, "\\write") == 0
>          )
> -        matches = completion_matches(text, filename_completion_function);
> +        matches = completion_matches(text, rl_filename_completion_function);
>
>
>      /*

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: PATCH: postgresql-7.1 + readline-4.2 compatability

От
Tom Lane
Дата:
"Adam J. Richter" <adam@yggdrasil.com> writes:
>     The following patch allows postgresql-7.1 to build under
> readline-4.2, per the discussion on this topic on pgsql-hackers.

Peter E. already did something about this ... I haven't tested his fix
against 4.2 yet, but I can confirm that it didn't break anything with
readline 4.0.

            regards, tom lane