#140: Ctrl-C handling via linenoise-ng

This commit is contained in:
Louis Rubet 2017-06-18 10:45:05 +02:00
parent 8b0b447e6a
commit 3b007bec3b

View file

@ -39,17 +39,24 @@ static ret_value entry(program& prog)
// get user entry
entry = linenoise(PROMPT);
if (entry != NULL)
{
// parse it
ret = parse(entry, prog);
// keep history
if (entry[0] != 0)
linenoiseHistoryAdd(entry);
}
// Ctrl-C
if (linenoiseKeyType() == 1)
ret = ret_good_bye;
else
ret = ret_internal;
{
if (entry != NULL)
{
// parse it
ret = parse(entry, prog);
// keep history
if (entry[0] != 0)
linenoiseHistoryAdd(entry);
}
else
ret = ret_internal;
}
free(entry);