mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 03:03:02 +01:00
testing/toxic/prompt.c: changed execute() to skip whitespace at start of command
This commit is contained in:
parent
5fd1a658bc
commit
78a37829c5
5
prompt.c
5
prompt.c
@ -52,6 +52,11 @@ static void execute(ToxWindow *self, char *u_cmd)
|
|||||||
cmd[i - newlines] = u_cmd[i];
|
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")) {
|
if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) {
|
||||||
endwin();
|
endwin();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user