diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2023-06-06 15:51:54 +0200 |
---|---|---|
committer | Alexis Hildebrandt <afh@surryhill.net> | 2023-06-07 09:09:42 +0200 |
commit | 1d422c32d6c3b137e8cb4a95b68fbd035107a7e5 (patch) | |
tree | d1707df8d962ab326503672bd9c75cf99d465904 /src | |
parent | 5e2afd286a332b93481750821be4785fbbd555a4 (diff) | |
download | fork-ledger-1d422c32d6c3b137e8cb4a95b68fbd035107a7e5.tar.gz fork-ledger-1d422c32d6c3b137e8cb4a95b68fbd035107a7e5.tar.bz2 fork-ledger-1d422c32d6c3b137e8cb4a95b68fbd035107a7e5.zip |
Add build support readline
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cc | 11 | ||||
-rw-r--r-- | src/system.hh.in | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/main.cc b/src/main.cc index 6b3e1eb3..fcd61f28 100644 --- a/src/main.cc +++ b/src/main.cc @@ -41,6 +41,9 @@ #if HAVE_EDIT #include <editline/readline.h> +#elif HAVE_READLINE +#include <readline/readline.h> +#include <readline/history.h> #endif using namespace ledger; @@ -137,7 +140,7 @@ int main(int argc, char * argv[], char * envp[]) bool exit_loop = false; -#if HAVE_EDIT +#if HAVE_EDIT || HAVE_READLINE rl_readline_name = const_cast<char *>("Ledger"); // TODO: rl_attempted_completion_function = ledger_completion; @@ -158,7 +161,7 @@ int main(int argc, char * argv[], char * envp[]) add_history(expansion); } -#else // HAVE_EDIT +#else // HAVE_EDIT || HAVE_READLINE while (! std::cin.eof()) { std::cout << global_scope->prompt_string(); @@ -167,7 +170,7 @@ int main(int argc, char * argv[], char * envp[]) char * p = skip_ws(line); -#endif // HAVE_EDIT +#endif // HAVE_EDIT || HAVE_READLINE check_for_signal(); @@ -178,7 +181,7 @@ int main(int argc, char * argv[], char * envp[]) global_scope->execute_command_wrapper(split_arguments(p), true); } -#if HAVE_EDIT +#if HAVE_EDIT || HAVE_READLINE if (expansion) std::free(expansion); std::free(p); diff --git a/src/system.hh.in b/src/system.hh.in index 10086d23..05f28fc2 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -52,6 +52,7 @@ #cmakedefine01 HAVE_GETTEXT #cmakedefine01 HAVE_EDIT +#cmakedefine01 HAVE_READLINE #cmakedefine01 HAVE_GETPWUID #cmakedefine01 HAVE_GETPWNAM #cmakedefine01 HAVE_IOCTL |