From 442b8d1ae2f4419ca2e2e4d76ad06ae38d18d1c7 Mon Sep 17 00:00:00 2001 From: sabetts Date: Wed, 29 Sep 2004 15:33:13 +0000 Subject: * configure.in: Warn when the history header or library is not found and compile without history support. * src/ratpoison.h: change ifdef to check for HAVE_HISTORY. * src/manage.c (get_state): change data to an unsigned char and cast data to a long* when it's used. * src/main.c (main): change ifdef to check for HAVE_HISTORY. (clean_up): likewise * src/history.c: change ifdef to check for HAVE_HISTORY. * src/events.c (receive_command): make prop_return an unsigned char. * src/editor.c (editor_history_previous): change ifdef to check for HAVE_HISTORY. (editor_history_next): likewise (editor_enter): likewise --- ChangeLog | 21 +++++++++++++++++++++ NEWS | 4 ++++ configure.in | 12 +++++++----- src/editor.c | 16 ++++++++-------- src/events.c | 4 ++-- src/history.c | 4 ++-- src/main.c | 8 ++++---- src/manage.c | 6 +++--- src/ratpoison.h | 4 ++-- 9 files changed, 53 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index fad7cf6..6807cfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2004-09-29 Shawn Betts + + * configure.in: Warn when the history header or library is not + found and compile without history support. + + * src/ratpoison.h: change ifdef to check for HAVE_HISTORY. + + * src/manage.c (get_state): change data to an unsigned char and + cast data to a long* when it's used. + + * src/main.c (main): change ifdef to check for HAVE_HISTORY. + (clean_up): likewise + + * src/history.c: change ifdef to check for HAVE_HISTORY. + + * src/events.c (receive_command): make prop_return an unsigned char. + + * src/editor.c (editor_history_previous): change ifdef to check for HAVE_HISTORY. + (editor_history_next): likewise + (editor_enter): likewise + 2004-09-27 Shawn Betts * contrib/ratpoison.el (ratpoison-command): use call-process. diff --git a/NEWS b/NEWS index a0ccce9..9cf6812 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ ratpoison NEWS --- history of user-visible changes. -*- outline -*- +* Changes since 1.3.0 +** configure script warns about missing history lib +Rather than error out, now, ratpoison will just be built without history. + * Changes since 1.3.0-rc2-beta2 ** new format option %f This options displays the frame number the window is in or a space if diff --git a/configure.in b/configure.in index 95c71e1..ecee316 100644 --- a/configure.in +++ b/configure.in @@ -17,7 +17,7 @@ dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl -dnl $Id: configure.in,v 1.43 2004/06/14 05:25:50 sabetts Exp $ +dnl $Id: configure.in,v 1.44 2004/09/29 15:33:14 sabetts Exp $ AC_INIT(src/main.c) AM_INIT_AUTOMAKE(ratpoison, 1.3.1-cvs) @@ -75,10 +75,12 @@ AC_ARG_ENABLE(history, fi],[check_for_libhistory=yes]) if test x$check_for_libhistory = xyes ; then - AC_CHECK_HEADERS([readline/history.h]) - AC_CHECK_LIB(history, add_history, - LIBS="$LIBS -lhistory", - AC_MSG_ERROR([*** Can't find History headers and libs])) + AC_CHECK_HEADERS([readline/history.h], + AC_CHECK_LIB(history, add_history, + [LIBS="$LIBS -lhistory" + AC_DEFINE_UNQUOTED(HAVE_HISTORY, 1, Define this to enable history)], + AC_MSG_WARN([*** Can't find History lib. Install readline dev libs for history.])), + AC_MSG_WARN([*** Can't find History header. Install readline dev libs for history.])) fi LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS $X_EXTRA_LIBS" diff --git a/src/editor.c b/src/editor.c index 4864e80..c5c3560 100644 --- a/src/editor.c +++ b/src/editor.c @@ -309,7 +309,7 @@ editor_backward_kill_line (rp_input_line *line) static edit_status editor_history_previous (rp_input_line *line) { -#ifdef HAVE_READLINE_HISTORY_H +#ifdef HAVE_HISTORY char *entry = history_previous (); if (entry) @@ -336,17 +336,17 @@ editor_history_previous (rp_input_line *line) return EDIT_INSERT; -#else /* HAVE_READLINE_HISTORY_H */ +#else /* HAVE_HISTORY */ return EDIT_NO_OP; -#endif /* HAVE_READLINE_HISTORY_H */ +#endif /* HAVE_HISTORY */ } static edit_status editor_history_next (rp_input_line *line) { -#ifdef HAVE_READLINE_HISTORY_H +#ifdef HAVE_HISTORY char *entry = history_next (); if (entry) @@ -374,9 +374,9 @@ editor_history_next (rp_input_line *line) return EDIT_INSERT; -#else /* HAVE_READLINE_HISTORY_H */ +#else /* HAVE_HISTORY */ return EDIT_NO_OP; -#endif /* HAVE_READLINE_HISTORY_H */ +#endif /* HAVE_HISTORY */ } static edit_status @@ -426,7 +426,7 @@ editor_enter (rp_input_line *line) char *expansion; line->buffer[line->length] = '\0'; -#ifdef HAVE_READLINE_HISTORY_H +#ifdef HAVE_HISTORY result = history_expand_line (line->buffer, &expansion); PRINT_DEBUG (("History Expansion - result: %d\n", result)); @@ -443,7 +443,7 @@ editor_enter (rp_input_line *line) history_add (expansion); line->buffer = expansion; } -#endif /* HAVE_READLINE_HISTORY_H */ +#endif /* HAVE_HISTORY */ return EDIT_DONE; } diff --git a/src/events.c b/src/events.c index 1d62e74..001eab6 100644 --- a/src/events.c +++ b/src/events.c @@ -490,7 +490,7 @@ receive_command () int format_ret; unsigned long nitems; unsigned long bytes_after; - void *prop_return; + unsigned char *prop_return; int offset; /* Init offset to 0. In the case where there is more than one window @@ -510,7 +510,7 @@ receive_command () offset, length, True, XA_WINDOW, &type_ret, &format_ret, &nitems, - &bytes_after, (unsigned char **)&prop_return); + &bytes_after, &prop_return); /* Update the offset to point to the next window (if there is another one). */ diff --git a/src/history.c b/src/history.c index fd3e424..a96c296 100644 --- a/src/history.c +++ b/src/history.c @@ -4,7 +4,7 @@ #include "ratpoison.h" -#ifdef HAVE_READLINE_HISTORY_H +#ifdef HAVE_HISTORY #include "readline/history.h" @@ -129,4 +129,4 @@ int history_expand_line (char *string, char **output) return history_expand (string, output); } -#endif /* HAVE_READLINE_HISTORY_H */ +#endif /* HAVE_HISTORY */ diff --git a/src/main.c b/src/main.c index 1d58faf..5e87c55 100644 --- a/src/main.c +++ b/src/main.c @@ -623,9 +623,9 @@ main (int argc, char *argv[]) init_frame_lists (); update_modifier_map (); initialize_default_keybindings (); -#ifdef HAVE_READLINE_HISTORY_H +#ifdef HAVE_HISTORY history_load (); -#endif /* HAVE_READLINE_HISTORY_H */ +#endif /* HAVE_HISTORY */ /* Scan for windows */ if (screen_arg) @@ -688,9 +688,9 @@ clean_up () { int i; -#ifdef HAVE_READLINE_HISTORY_H +#ifdef HAVE_HISTORY history_save (); -#endif /* HAVE_READLINE_HISTORY_H */ +#endif /* HAVE_HISTORY */ free_keymaps (); free_aliases (); diff --git a/src/manage.c b/src/manage.c index c30b242..3a303de 100644 --- a/src/manage.c +++ b/src/manage.c @@ -526,7 +526,7 @@ get_state (rp_window *win) int format; unsigned long nitems; unsigned long bytes_left; - long *data; + unsigned char *data; if (win == NULL) return state; @@ -534,9 +534,9 @@ get_state (rp_window *win) if (XGetWindowProperty (dpy, win->w, wm_state, 0L, 2L, False, wm_state, &type, &format, &nitems, &bytes_left, - (unsigned char **)&data) == Success && nitems > 0) + &data) == Success && nitems > 0) { - state = *data; + state = *(long *)data; XFree (data); } diff --git a/src/ratpoison.h b/src/ratpoison.h index eb34dcf..26ee77a 100644 --- a/src/ratpoison.h +++ b/src/ratpoison.h @@ -79,9 +79,9 @@ extern XGCValues gv; #include "screen.h" #include "group.h" #include "editor.h" -#ifdef HAVE_READLINE_HISTORY_H +#ifdef HAVE_HISTORY #include "history.h" -#endif /* HAVE_READLINE_HISTORY_H */ +#endif /* HAVE_HISTORY */ #include "completions.h" #include "hook.h" #include "xinerama.h" -- cgit v1.2.3