summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptrasd <f@k.e>2013-08-07 02:25:20 -0400
committerptrasd <f@k.e>2013-08-07 02:25:20 -0400
commitcaa75b52c37b16aa00f1cb692cc533444c5d716d (patch)
tree463db3f05958162b72ed4956049b0d6e8a167773
parentb32a7b2294fff9f5ef0f5027e4e2ce1f01adc221 (diff)
testing/toxic/prompt.c: changed execute() to ignore whitespace at end of commands
-rw-r--r--testing/toxic/prompt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c
index a96c07bb..b0e21c64 100644
--- a/testing/toxic/prompt.c
+++ b/testing/toxic/prompt.c
@@ -57,6 +57,12 @@ static void execute(ToxWindow *self, char *u_cmd)
57 leading_spc++; 57 leading_spc++;
58 memmove(cmd, cmd + leading_spc, 256 - leading_spc); 58 memmove(cmd, cmd + leading_spc, 256 - leading_spc);
59 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
60 if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) { 66 if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) {
61 endwin(); 67 endwin();
62 exit(0); 68 exit(0);