fix GNU readline bug. linking libhistory is not necessary. In fact, it causes a SIGSEGV.

This commit is contained in:
Kelvin Sherlock 2019-02-11 23:09:59 -05:00
parent 14e1fe18f8
commit 2f05a766b0
2 changed files with 2 additions and 2 deletions

View File

@ -165,7 +165,7 @@ if (READLINE MATCHES "AUTO")
endif()
if(READLINE MATCHES "READLINE")
target_compile_definitions(x_readline PRIVATE USE_READLINE)
target_link_libraries(x_readline PUBLIC history readline)
target_link_libraries(x_readline PUBLIC readline)
elseif(READLINE MATCHES "LIBEDIT")
target_compile_definitions(x_readline PRIVATE USE_LIBEDIT)
target_link_libraries(x_readline PUBLIC edit)

View File

@ -121,7 +121,7 @@ char *x_readline(const char *prompt) {
/* append to history, but only if unique from prev. entry */
if (*buffer) {
HIST_ENTRY *h = history_get(history_length-1);
HIST_ENTRY *h = history_get(history_length);
if (h == NULL || strcmp(buffer, h->line))
add_history(buffer);
}