From 6f5ef70a14a189272d56addc5d92cda6f456ef4f Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 19 Jan 2020 21:48:04 +0300 Subject: [PATCH] Minimal readline support --- libs/libcommon/src/LineReader.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libs/libcommon/src/LineReader.cpp b/libs/libcommon/src/LineReader.cpp index 3de6e43cb27..ab63ccc0f19 100644 --- a/libs/libcommon/src/LineReader.cpp +++ b/libs/libcommon/src/LineReader.cpp @@ -162,9 +162,16 @@ LineReader::InputStatus LineReader::readOneLine(const String & prompt) } else { - void * dl_handle = dlopen("libreadline.so", RTLD_LAZY); - if (dl_handle) - readline_ptr = reinterpret_cast(dlsym(dl_handle, "readline")); + for (auto name : {"libreadline.so", "libreadline.so.0", "libeditline.so", "libeditline.so.0"}) + { + void * dl_handle = dlopen(name, RTLD_LAZY); + if (dl_handle) + { + readline_ptr = reinterpret_cast(dlsym(dl_handle, "readline")); + if (readline_ptr) + break; + } + } } }