mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
testing/toxic/prompt.c: changed execute() to ignore whitespace at end of commands
This commit is contained in:
parent
b32a7b2294
commit
caa75b52c3
|
@ -57,6 +57,12 @@ static void execute(ToxWindow *self, char *u_cmd)
|
||||||
leading_spc++;
|
leading_spc++;
|
||||||
memmove(cmd, cmd + leading_spc, 256 - leading_spc);
|
memmove(cmd, cmd + leading_spc, 256 - leading_spc);
|
||||||
|
|
||||||
|
int cmd_end = strlen(cmd);
|
||||||
|
while (cmd_end > 0 && cmd_end--)
|
||||||
|
if (!isspace(cmd[cmd_end]))
|
||||||
|
break;
|
||||||
|
cmd[cmd_end + 1] = '\0';
|
||||||
|
|
||||||
if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) {
|
if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) {
|
||||||
endwin();
|
endwin();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user