Skip to content
Snippets Groups Projects
Commit 6261ef05 authored by mattijs's avatar mattijs
Browse files

ENH: setSet : proper exit upon eof

parent df4dc659
Branches
Tags
No related merge requests found
......@@ -934,18 +934,31 @@ int main(int argc, char *argv[])
{
char* linePtr = readline("readline>");
rawLine = string(linePtr);
if (linePtr)
{
rawLine = string(linePtr);
if (*linePtr)
{
add_history(linePtr);
write_history(historyFile);
}
if (*linePtr)
free(linePtr); // readline uses malloc, not new.
}
else
{
add_history(linePtr);
write_history(historyFile);
break;
}
free(linePtr); // readline uses malloc, not new.
}
# else
{
if (!std::cin.good())
{
Info<< "End of cin" << endl;
// No error.
break;
}
Info<< "Command>" << flush;
std::getline(std::cin, rawLine);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment