[PATCH] Adjust type declarations for readline 6.3

Assaf Gordon <[email protected]>
Newsgroups gmane.comp.gnu.mailutils.bugs
Message-ID <[email protected]>
Hello,

Attached is a small patch to fix compilation issues with GNU readline 6.3, which removed declarations of 'CPPFuction' and replaced it with 'rl_completion_func_t'.

See similar fixes at:
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741767#19
  https://blueslugs.com/blog/2016-10-23-updating-cppfunction-in-old-readline-consumers/


regards,
 - assaf

_______________________________________________
Bug-mailutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-mailutils
0001-Adjust-type-declarations-for-readline-6.3.patch (text/x-patch, 2.2 KB)
From 1d06df5d61a46f5b80815dced7fa5c1ce7040e87 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <[email protected]>
Date: Mon, 21 Nov 2016 18:41:15 -0500
Subject: [PATCH] Adjust type declarations for readline 6.3

Replace 'CPPFunction' with 'rl_completion_func_t' - 'CPPFunction' has
been removed in GNU readline 6.3.
This commit fixes the following compilation error:

  $ make
  [...]
  make[3]: Entering directory `/home/gordon/sources/mailutils/mu'
    CC       shell.o
  shell.c: In function 'mutool_initialize_readline':
  shell.c:335:39: error: 'CPPFunction' undeclared (first use in this function)
     rl_attempted_completion_function = (CPPFunction *) shell_completion;
---
 examples/nntpclient.c | 2 +-
 mail/mailline.c       | 2 +-
 mu/shell.c            | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/nntpclient.c b/examples/nntpclient.c
index 1e53b86..2f94856 100644
--- a/examples/nntpclient.c
+++ b/examples/nntpclient.c
@@ -163,7 +163,7 @@ initialize_readline ()
   rl_readline_name = (char *) "nntp";
 
   /* Tell the completer that we want a crack first. */
-  rl_attempted_completion_function = (CPPFunction *) nntp_completion;
+  rl_attempted_completion_function = (rl_completion_func_t *) nntp_completion;
 }
 
 /* Attempt to complete on the contents of TEXT.  START and END bound the
diff --git a/mail/mailline.c b/mail/mailline.c
index ae9a8f8..1c2753c 100644
--- a/mail/mailline.c
+++ b/mail/mailline.c
@@ -93,7 +93,7 @@ ml_readline_init ()
 
 #ifdef WITH_READLINE
   rl_readline_name = "mail";
-  rl_attempted_completion_function = (CPPFunction*)ml_command_completion;
+  rl_attempted_completion_function = (rl_completion_func_t*)ml_command_completion;
   rl_getc_function = ml_getc;
 #endif
 #ifdef HAVE_SIGACTION
diff --git a/mu/shell.c b/mu/shell.c
index ff4bd05..33ae91d 100644
--- a/mu/shell.c
+++ b/mu/shell.c
@@ -332,7 +332,7 @@ mutool_initialize_readline (const char *name)
 {
   /* Allow conditional parsing of the ~/.inputrc file. */
   rl_readline_name = (char *) name;
-  rl_attempted_completion_function = (CPPFunction *) shell_completion;
+  rl_attempted_completion_function = (rl_completion_func_t *) shell_completion;
   rl_getc_function = _shell_getc;
   read_history (get_history_file_name ());
 }
-- 
2.8.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.