Check for both the library and include file when adding history.
When adding history (add_history) use both the existence of the library and the header file to determine if history can be supported. Add a new USE_HISTORY that is the and of these two.
This commit is contained in:
parent
d074a37a2d
commit
4b2e5e5914
|
|
@ -44,6 +44,7 @@
|
|||
# undef HAVE_MALLOC_H
|
||||
# undef HAVE_LIBREADLINE
|
||||
# undef HAVE_READLINE_READLINE_H
|
||||
# undef HAVE_LIBHISTORY
|
||||
# undef HAVE_READLINE_HISTORY_H
|
||||
# undef HAVE_INTTYPES_H
|
||||
# undef HAVE_LROUND
|
||||
|
|
@ -63,6 +64,14 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* Figure if I can use history. */
|
||||
#undef USE_HISTORY
|
||||
#ifdef HAVE_LIBHISTORY
|
||||
#ifdef HAVE_READLINE_HISTORY_H
|
||||
# define USE_HISTORY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MODULE_DIR
|
||||
# define MODULE_DIR "."
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003-2007 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2003-2009 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -30,10 +30,10 @@
|
|||
# include "schedule.h"
|
||||
# include <stdio.h>
|
||||
# include <ctype.h>
|
||||
#ifdef HAVE_READLINE_READLINE_H
|
||||
#ifdef USE_READLINE
|
||||
# include <readline/readline.h>
|
||||
#endif
|
||||
#ifdef HAVE_READLINE_HISTORY_H
|
||||
#ifdef USE_HISTORY
|
||||
# include <readline/history.h>
|
||||
#endif
|
||||
# include <string.h>
|
||||
|
|
@ -499,7 +499,7 @@ void stop_handler(int rc)
|
|||
first += 1;
|
||||
|
||||
if (first[0] != 0) {
|
||||
#ifdef HAVE_READLINE_HISTORY_H
|
||||
#ifdef USE_HISTORY
|
||||
add_history(first);
|
||||
#endif
|
||||
invoke_command(first);
|
||||
|
|
|
|||
Loading…
Reference in New Issue