diff options
author | irungentoo <irungentoo@gmail.com> | 2013-08-20 05:02:26 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-20 05:02:26 -0700 |
commit | 617b2c8ba59970a67178c602d5348d036140d559 (patch) | |
tree | 0c8d4f3f889a9bc5fdeb1f0505e7ece758096e50 /testing/toxic | |
parent | 3707833f0b77182a1fffd154be26b33f70314809 (diff) | |
parent | 7f5591615d9911aa9b9aec022b81b9a1c52ce653 (diff) |
Merge pull request #503 from rose-m/issue-495-fix
fixed space handling in commands (issue #495)
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/prompt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 473633d4..81f00bce 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -363,6 +363,11 @@ static void execute(ToxWindow *self, Messenger *m, char *u_cmd) | |||
363 | 363 | ||
364 | if (cmd[i] == ' ') { | 364 | if (cmd[i] == ' ') { |
365 | cmd[i] = '\0'; | 365 | cmd[i] = '\0'; |
366 | |||
367 | int j = i; | ||
368 | while (++j < MAX_STR_SIZE && isspace(cmd[j])); | ||
369 | i = j - 1; | ||
370 | |||
366 | numargs++; | 371 | numargs++; |
367 | } | 372 | } |
368 | } | 373 | } |
@@ -380,6 +385,9 @@ static void execute(ToxWindow *self, Messenger *m, char *u_cmd) | |||
380 | for (i = 0; i < 5; i++) { | 385 | for (i = 0; i < 5; i++) { |
381 | cmdargs[i] = cmd + pos; | 386 | cmdargs[i] = cmd + pos; |
382 | pos += strlen(cmdargs[i]) + 1; | 387 | pos += strlen(cmdargs[i]) + 1; |
388 | |||
389 | while (isspace(cmd[pos]) && pos < MAX_STR_SIZE) | ||
390 | ++pos; | ||
383 | } | 391 | } |
384 | 392 | ||
385 | /* no input */ | 393 | /* no input */ |