testing/toxic/prompt.c: changed execute() to skip whitespace at start of command

This commit is contained in:
ptrasd 2013-08-07 02:10:46 -04:00
parent d04f2d0e51
commit b32a7b2294

View File

@ -52,6 +52,11 @@ static void execute(ToxWindow *self, char *u_cmd)
cmd[i - newlines] = u_cmd[i];
}
int leading_spc = 0;
for (i = 0; i < 256 && isspace(cmd[i]); ++i)
leading_spc++;
memmove(cmd, cmd + leading_spc, 256 - leading_spc);
if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) {
endwin();
exit(0);