main: handle q, ctrl+d; add exit point

This commit is contained in:
Kiëd Llaentenn 2020-09-17 11:58:22 +00:00
parent d1ad444cd0
commit da742e282d

16
main.c
View File

@ -91,19 +91,25 @@ main ( int argc, char *argv[] )
if (e.type == TB_EVENT_KEY)
{
switch (e.ch) {
case 'q':
goto cleanup;
default:
break;
}
switch (e.key)
{
case 0x03:
cleanup(&buf);
exit(0);
case TB_KEY_CTRL_C:
case TB_KEY_CTRL_D:
goto cleanup;
default:
break;
}
}
}
// perform cleanup
cleanup:
cleanup(&buf);
return 0;
}