ClickHouse/libs/libcommon/include/common/readline_use.h
abyss7 d538f70679 Fix build and tests on Fedora (#3496)
* Fix some tests and build on Fedora 28

* Update contrib/ssl

* Try `sudo` first, then without `sudo`.
2018-10-30 17:05:44 +03:00

30 lines
731 B
C++

#pragma once
#if __has_include(<common/config_common.h>)
#include <common/config_common.h>
#endif
/// Different line editing libraries can be used depending on the environment.
#if USE_READLINE
#include <readline/readline.h>
#include <readline/history.h>
#elif USE_LIBEDIT
#include <editline/readline.h>
#else
#include <string>
#include <cstring>
#include <iostream>
inline char * readline(const char * prompt)
{
std::string s;
std::cout << prompt;
std::getline(std::cin, s);
if (!std::cin.good())
return nullptr;
return strdup(s.data());
}
#define add_history(...) do {} while (0);
#define rl_bind_key(...) do {} while (0);
#endif