diff options
author | ptrasd <f@k.e> | 2013-08-07 02:10:46 -0400 |
---|---|---|
committer | ptrasd <f@k.e> | 2013-08-07 02:10:46 -0400 |
commit | b32a7b2294fff9f5ef0f5027e4e2ce1f01adc221 (patch) | |
tree | 579fea413cb88dfdb32affb7306867f8165796ab /testing/toxic | |
parent | d04f2d0e51931db5fbd8c672c44bb1e59fc58b79 (diff) |
testing/toxic/prompt.c: changed execute() to skip whitespace at start of command
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/prompt.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 89c87d8f..a96c07bb 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -52,6 +52,11 @@ 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 | |||
55 | if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) { | 60 | if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) { |
56 | endwin(); | 61 | endwin(); |
57 | exit(0); | 62 | exit(0); |