diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/INSTALL codeciv/INSTALL --- freeciv/INSTALL Mon Jul 2 16:41:30 2001 +++ codeciv/INSTALL Mon Jul 2 16:46:33 2001 @@ -392,7 +392,6 @@ installed. If so it will automatically set up the makefiles so that readline is compiled into the server. If not then it will just silently configure without readline support. -You need readline version >= 4.2. You can force configure to include readline or die trying by giving configure the --with-readline option: diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/configure.in codeciv/configure.in --- freeciv/configure.in Mon Jul 2 16:41:30 2001 +++ codeciv/configure.in Mon Jul 2 16:42:41 2001 @@ -394,7 +394,7 @@ fi else dnl Readline lib - AC_CHECK_LIB(readline, rl_completion_matches, + AC_CHECK_LIB(readline, completion_matches, have_readline_lib=1, have_readline_lib=0) if test "$have_readline_lib" = "0"; then dnl Many readline installations are broken in that they @@ -410,10 +410,10 @@ AC_CHECK_LIB(ncurses, initscr, HAVE_TERMCAP="-lncurses") if test x"$HAVE_TERMCAP" != "x"; then - dnl We can't check for rl_completion_matches() again, + dnl We can't check for completion_matches() again, dnl cause the result is cached. And autoconf doesn't dnl seem to have a way to uncache it. - AC_CHECK_LIB(readline, rl_filename_completion_function, + AC_CHECK_LIB(readline, filename_completion_function, have_readline_lib=1, have_readline_lib=0, "$HAVE_TERMCAP") if test "$have_readline_lib" = "1"; then diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/server/stdinhand.c codeciv/server/stdinhand.c --- freeciv/server/stdinhand.c Mon Jul 2 16:41:59 2001 +++ codeciv/server/stdinhand.c Mon Jul 2 17:01:52 2001 @@ -3550,6 +3550,13 @@ return contains_str_before_start(start, commands[CMD_LIST].name, 0); } +/* The nice readline developers though they would remove the declarations + of some functions when going from 4.1 to 4.2. + The functions are still in the lib. */ +#ifdef RL_STATE_NONE +extern char **completion_matches __P((const char *, rl_compentry_func_t *)); +extern char *filename_completion_function __P((const char *, int)); +#endif /************************************************************************** Attempt to complete on the contents of TEXT. START and END bound the region of rl_line_buffer that contains the word to complete. TEXT is @@ -3561,27 +3568,30 @@ { char **matches = (char **)NULL; + /* Sigh. Readline 4.1/4.2 compatability mess. */ + char *text2 = (char *)text; + if (is_help(start)) { - matches = rl_completion_matches(text, help_generator); + matches = completion_matches(text2, help_generator); } else if (is_command(start)) { - matches = rl_completion_matches(text, command_generator); + matches = completion_matches(text2, command_generator); } else if (is_rulesout(start)) { - matches = rl_completion_matches(text, rulesout_generator); + matches = completion_matches(text2, rulesout_generator); } else if (is_list(start)) { - matches = rl_completion_matches(text, list_generator); + matches = completion_matches(text2, list_generator); } else if (is_cmdlevel_arg2(start)) { - matches = rl_completion_matches(text, cmdlevel_arg2_generator); + matches = completion_matches(text2, cmdlevel_arg2_generator); } else if (is_cmdlevel_arg1(start)) { - matches = rl_completion_matches(text, cmdlevel_arg1_generator); + matches = completion_matches(text2, cmdlevel_arg1_generator); } else if (is_connection(start)) { - matches = rl_completion_matches(text, connection_generator); + matches = completion_matches(text2, connection_generator); } else if (is_player(start)) { - matches = rl_completion_matches(text, player_generator); + matches = completion_matches(text2, player_generator); } else if (is_server_option(start)) { - matches = rl_completion_matches(text, option_generator); + matches = completion_matches(text2, option_generator); } else if (is_filename(start)) { /* This function we get from readline */ - matches = rl_completion_matches(text, rl_filename_completion_function); + matches = completion_matches(text2, filename_completion_function); } else /* We have no idea what to do */ matches = NULL;