Fixed the default debugger input to strip new lines, fixing the debugger in SDL

This commit is contained in:
Lior Halphon 2016-04-06 22:57:37 +03:00
parent eb0b642247
commit 1c2af7fa5b
1 changed files with 6 additions and 0 deletions

View File

@ -97,9 +97,15 @@ static char *default_input_callback(GB_gameboy_t *gb)
size_t size = 0;
printf(">");
getline(&expression, &size, stdin);
if (!expression) {
return strdup("");
}
size_t length = strlen(expression);
if (expression[length - 1] == '\n') {
expression[length - 1] = 0;
}
return expression;
}