mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-16 18:01:54 +00:00
fix build plus warning if we have no readline
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user