fix build plus warning if we have no readline

This commit is contained in:
Evgeniy Dushistov
2013-07-06 17:49:23 +00:00
parent 1386e5d160
commit 06e3f25ea4

View File

@@ -36,10 +36,21 @@
#ifndef WITH_READLINE #ifndef WITH_READLINE
static bool stdio_getline(FILE *in, std::string & str)
{
str.clear();
int ch;
while ((ch=fgetc(in))!=EOF && ch!='\n')
str+=ch;
if (EOF==ch)
return false;
return true;
}
class dummy_readline : public read_line { class dummy_readline : public read_line {
public: public:
bool read(const string& banner, string& line) { bool read(const string& banner, string& line) {
printf(banner.c_str()); printf("%s", banner.c_str());
return stdio_getline(stdin, line); return stdio_getline(stdin, line);
} }
}; };