summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 */