summaryrefslogtreecommitdiff
path: root/testing/toxic/prompt.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-07 09:11:41 -0400
committerirungentoo <irungentoo@gmail.com>2013-08-07 09:11:41 -0400
commit0c4788030fb2f44d1120616d5b0ffd914700d3ff (patch)
tree9100dcff9853abc3d6f93255b5db2f56a73ebcb8 /testing/toxic/prompt.c
parente760c9eeff5af86bf40d07f9c371f32132956f91 (diff)
parentcaa75b52c37b16aa00f1cb692cc533444c5d716d (diff)
Merge branch 'master' of https://github.com/ptrasd/ProjectTox-Core into pull-requests
Diffstat (limited to 'testing/toxic/prompt.c')
-rw-r--r--testing/toxic/prompt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c
index 89c87d8f..b0e21c64 100644
--- a/testing/toxic/prompt.c
+++ b/testing/toxic/prompt.c
@@ -52,6 +52,17 @@ 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
60 int cmd_end = strlen(cmd);
61 while (cmd_end > 0 && cmd_end--)
62 if (!isspace(cmd[cmd_end]))
63 break;
64 cmd[cmd_end + 1] = '\0';
65
55 if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) { 66 if (!strcmp(cmd, "quit") || !strcmp(cmd, "exit") || !strcmp(cmd, "q")) {
56 endwin(); 67 endwin();
57 exit(0); 68 exit(0);