More tests

This commit is contained in:
Andrew Pamment 2016-04-22 16:07:20 +10:00
parent 9c8acc7162
commit 7afd4aac39

View File

@ -810,7 +810,7 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
chars = 0; chars = 0;
s_putstring(socket, "\r\n"); s_putstring(socket, "\r\n");
lines++; lines++;
if (lines >= 17) { if (lines == 17) {
s_putstring(socket, "Press a key to continue..."); s_putstring(socket, "Press a key to continue...");
s_getc(socket); s_getc(socket);
lines = 0; lines = 0;
@ -824,8 +824,7 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
strncpy(buffer, &body[ansi], (z - ansi) + 1); strncpy(buffer, &body[ansi], (z - ansi) + 1);
buffer[z - ansi + 1] = '\0'; buffer[z - ansi + 1] = '\0';
s_putstring(socket, buffer); s_putstring(socket, buffer);
} } else if (body[z] == 'A') {
if (body[z] == 'A') {
for (i=0;i<atoi(&body[ansi + 2]);i++) { for (i=0;i<atoi(&body[ansi + 2]);i++) {
if (lines - 1 >= 0) { if (lines - 1 >= 0) {
s_putstring(socket, "\e[1A"); s_putstring(socket, "\e[1A");
@ -834,8 +833,7 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
break; break;
} }
} }
} } else if (body[z] == 'C') {
if (body[z] == 'C') {
for (i=0;i<atoi(&body[ansi + 2]);i++) { for (i=0;i<atoi(&body[ansi + 2]);i++) {
if (chars + 1 <= 79) { if (chars + 1 <= 79) {
s_putstring(socket, "\e[1C"); s_putstring(socket, "\e[1C");
@ -844,8 +842,7 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
break; break;
} }
} }
} } else if (body[z] == 'B') {
if (body[z] == 'B') {
for (i=0;i<atoi(&body[ansi + 2]);i++) { for (i=0;i<atoi(&body[ansi + 2]);i++) {
if (lines + 1 <= 17) { if (lines + 1 <= 17) {
s_putstring(socket, "\e[1B"); s_putstring(socket, "\e[1B");
@ -853,8 +850,8 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
} else { } else {
break; break;
} }
} } }
if (body[z] == 'D') { } else if (body[z] == 'D') {
for (i=0;i<atoi(&body[ansi + 2]);i++) { for (i=0;i<atoi(&body[ansi + 2]);i++) {
if (chars - 1 >= 0) { if (chars - 1 >= 0) {
s_putstring(socket, "\e[1D"); s_putstring(socket, "\e[1D");
@ -863,8 +860,10 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
break; break;
} }
} }
} else {
printf("%c\n", body[z]);
} }
} else if (body[z] != '\n') { } else {
chars++; chars++;
s_putchar(socket, body[z]); s_putchar(socket, body[z]);
} }