summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNominate <thomas.bladon@st-hughs.ox.ac.uk>2013-08-06 11:20:11 +0100
committerNominate <thomas.bladon@st-hughs.ox.ac.uk>2013-08-06 11:20:11 +0100
commitfb9791bc6946fd893e101537fb19fea3b351b0ce (patch)
tree97a13ee907f58a8a91e55b5941404faa79ae6e17
parent45c84e55e6e25bd95b5b6c86368845ff20dec7e9 (diff)
Update prompt.c
-rw-r--r--testing/toxic/prompt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c
index 742b35f8..3006b8a6 100644
--- a/testing/toxic/prompt.c
+++ b/testing/toxic/prompt.c
@@ -44,12 +44,12 @@ static int prompt_buf_pos=0;
44static void execute(ToxWindow* self, char* u_cmd) { 44static void execute(ToxWindow* self, char* u_cmd) {
45 int i; 45 int i;
46 int newlines = 0; 46 int newlines = 0;
47 char cmd[256] = {0}; 47 char cmd[256] = {0};
48 for(i = 0; i < strlen(prompt_buf); i++) 48 for(i = 0; i < strlen(prompt_buf); i++)
49 { 49 {
50 if (u_cmd[i] == '\n') 50 if (u_cmd[i] == '\n')
51 ++newlines; 51 ++newlines;
52 else 52 else
53 cmd[i - newlines] = u_cmd[i]; 53 cmd[i - newlines] = u_cmd[i];
54 } 54 }
55 55
@@ -276,7 +276,7 @@ static void execute(ToxWindow* self, char* u_cmd) {
276static void prompt_onKey(ToxWindow* self, int key) { 276static void prompt_onKey(ToxWindow* self, int key) {
277 // PRINTABLE characters: Add to line. 277 // PRINTABLE characters: Add to line.
278 if(isprint(key)) { 278 if(isprint(key)) {
279 if (prompt_buf_pos == 255){ 279 if (prompt_buf_pos == (sizeof(prompt_buf) - 1)){
280 wprintw(self->window, "\nToo Long.\n"); 280 wprintw(self->window, "\nToo Long.\n");
281 prompt_buf_pos = 0; 281 prompt_buf_pos = 0;
282 prompt_buf[0] = 0; 282 prompt_buf[0] = 0;