| 1 | #pragma once |
| 2 | |
| 3 | #if __has_include(<common/config_common.h>) |
| 4 | #include <common/config_common.h> |
| 5 | #endif |
| 6 | |
| 7 | /// Different line editing libraries can be used depending on the environment. |
| 8 | #if USE_READLINE |
| 9 | #include <readline/readline.h> |
| 10 | #include <readline/history.h> |
| 11 | #elif USE_LIBEDIT |
| 12 | #include <editline/readline.h> |
| 13 | #else |
| 14 | #include <string> |
| 15 | #include <cstring> |
| 16 | #include <iostream> |
| 17 | inline char * readline(const char * prompt) |
| 18 | { |
| 19 | std::string s; |
| 20 | std::cout << prompt; |
| 21 | std::getline(std::cin, s); |
| 22 | |
| 23 | if (!std::cin.good()) |
| 24 | return nullptr; |
| 25 | return strdup(s.data()); |
| 26 | } |
| 27 | #define add_history(...) do {} while (0) |
| 28 | #define rl_bind_key(...) do {} while (0) |
| 29 | #endif |
| 30 | |