summaryrefslogtreecommitdiff
path: root/testing/toxic/prompt.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/toxic/prompt.c')
-rw-r--r--testing/toxic/prompt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c
index 6b110073..d79d061f 100644
--- a/testing/toxic/prompt.c
+++ b/testing/toxic/prompt.c
@@ -52,6 +52,17 @@ static void execute(ToxWindow *self, char *u_cmd)
52 cmd[i - newlines] = u_cmd[i]; 52 cmd[i - newlines] = u_cmd[i];
53 } 53 }
54 54
55 int leading_spc = 0;
56 for (i = 0; i < 256 && isspace(cmd[i]); ++i)
57 leading_spc++;
58 memmove(cmd, cmd + leading_spc, 256 - leading_spc);
59
60 int cmd_end = strlen(cmd);
61 while (cmd_end > 0 && cmd_end--)
62 if (!isspace(cmd[cmd_end]))
63 break;
64 cmd[cmd_end + 1] = '\0';
65
55 if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) { 66 if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) {
56 endwin(); 67 endwin();
57 exit(0); 68 exit(0);