From 78a37829c5fc193343e3e5d7d657bd79f6af8f8e Mon Sep 17 00:00:00 2001 From: ptrasd Date: Wed, 7 Aug 2013 02:10:46 -0400 Subject: [PATCH] testing/toxic/prompt.c: changed execute() to skip whitespace at start of command --- prompt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prompt.c b/prompt.c index 89c87d8..a96c07b 100644 --- a/prompt.c +++ b/prompt.c @@ -52,6 +52,11 @@ 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); + if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) { endwin(); exit(0);