From 132576c28c4bb2f3528e85b2f6bcb5063891da30 Mon Sep 17 00:00:00 2001 From: ptrasd Date: Wed, 7 Aug 2013 02:25:20 -0400 Subject: [PATCH] testing/toxic/prompt.c: changed execute() to ignore whitespace at end of commands --- prompt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prompt.c b/prompt.c index a96c07b..b0e21c6 100644 --- a/prompt.c +++ b/prompt.c @@ -57,6 +57,12 @@ static void execute(ToxWindow *self, char *u_cmd) 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);