mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-23 11:13:24 +01:00
Merge branch 'master' of https://github.com/ptrasd/ProjectTox-Core into pull-requests
This commit is contained in:
commit
605f84ac4a
11
prompt.c
11
prompt.c
@ -52,6 +52,17 @@ 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);
|
||||
|
||||
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")) {
|
||||
endwin();
|
||||
exit(0);
|
||||
|
Loading…
Reference in New Issue
Block a user