summaryrefslogtreecommitdiff
path: root/testing/toxic
diff options
context:
space:
mode:
authorMichael Rose <michael_rose@gmx.de>2013-08-20 13:40:15 +0200
committerMichael Rose <michael_rose@gmx.de>2013-08-20 13:40:15 +0200
commit7f5591615d9911aa9b9aec022b81b9a1c52ce653 (patch)
treea1deab5d3d5ec16541d1dc01f7ebcd6342cad66a /testing/toxic
parentb16906d5e42cf65e198de0ccd21155df4a364c56 (diff)
fixed space handling in commands (issue #495)
Diffstat (limited to 'testing/toxic')
-rw-r--r--testing/toxic/prompt.c8
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 */