Hello,

The attached patch fixes the build issues with CDCD.
This is what the patch does:

- Include readline.h in cmd_cdcd.c
- Change the declaration of  cdcd_completion parameters (add a const
  modifier to the first parameter)
- Remove the casting when assigning to rl_attempted_completion_function
  (singe now the types match)

J.

diff -Nur cdcd-0.6.6/cmd_cdcd.c cdcd-0.6.6-new/cmd_cdcd.c
--- cdcd-0.6.6/cmd_cdcd.c	2014-08-07 11:12:25.000000000 -0300
+++ cdcd-0.6.6-new/cmd_cdcd.c	2014-08-07 11:15:19.422590652 -0300
@@ -51,6 +51,15 @@
 #include "interface.h"
 #include "cmd_edit.h"
 
+#ifdef READLINE_LIBRARY
+#  include "readline.h"
+#  include "history.h"
+#else
+#  include <readline/readline.h>
+#  include <readline/history.h>
+#endif
+
+
 Execfunc cmd_play, cmd_access, cmd_ext, cmd_stop, cmd_close,
   cmd_pause, cmd_resume, cmd_toggle, cmd_rew, cmd_ff, cmd_rndplay, cmd_next,
   cmd_prev, cmd_setvol, cmd_getvol, cmd_status, cmd_info, cmd_tracks,
@@ -1279,7 +1288,7 @@
 void
 cmd_cdcd_mainloop ()
 {
-  rl_attempted_completion_function = (CPPFunction *) cdcd_completion;
+  rl_attempted_completion_function =  cdcd_completion;
   cmd_mainloop (&cdcd_command_matcher, "cdcd> ", cmds);
 }
 
diff -Nur cdcd-0.6.6/cmdline.c cdcd-0.6.6-new/cmdline.c
--- cdcd-0.6.6/cmdline.c	2004-01-30 22:50:32.000000000 -0200
+++ cdcd-0.6.6-new/cmdline.c	2014-08-07 11:10:57.146584946 -0300
@@ -587,7 +587,7 @@
 }
 
 char **
-cdcd_completion (char *text, int start, int end)
+cdcd_completion (const char *text, int start, int end)
 {
   char **matches = NULL;
 
diff -Nur cdcd-0.6.6/cmdline.h cdcd-0.6.6-new/cmdline.h
--- cdcd-0.6.6/cmdline.h	2004-01-26 21:52:16.000000000 -0200
+++ cdcd-0.6.6-new/cmdline.h	2014-08-07 11:11:19.018585422 -0300
@@ -61,7 +61,7 @@
 /* FIXME: this function is hell */
 void get_input_text (char *buffer, char *prompt, int len);
 char *trackname_matcher (const char *text, int state);
-char **cdcd_completion (char *text, int start, int end);
+char **cdcd_completion (const char *text, int start, int end);
 
 int read_trackname (char *s, int *ret,
 		    struct disc_data *data, struct disc_info *disc);

Reply via email to