Fix for linux terminal in chat

This commit is contained in:
Andrew Pamment 2018-02-09 08:30:13 +10:00
parent c1ca33f77e
commit de437fb07d
2 changed files with 3 additions and 2 deletions

Binary file not shown.

View File

@ -420,7 +420,7 @@ void chat_system(struct user_record *user) {
} }
memset(inputbuffer, 0, 256); memset(inputbuffer, 0, 256);
inputbuffer_at = 0; inputbuffer_at = 0;
} else if (c != '\n') { } else if (c != '\n' && c != '\0') {
if (c == '\b' || c == 127) { if (c == '\b' || c == 127) {
if (inputbuffer_at > 0) { if (inputbuffer_at > 0) {
inputbuffer_at--; inputbuffer_at--;
@ -446,7 +446,7 @@ void chat_system(struct user_record *user) {
strncat(partmessage, readbuffer, len); strncat(partmessage, readbuffer, len);
strcpy(readbuffer, partmessage); strcpy(readbuffer, partmessage);
fprintf(stderr, "%s\n", readbuffer);
y = 0; y = 0;
for (z = 0;z < strlen(readbuffer); z++) { for (z = 0;z < strlen(readbuffer); z++) {
if (readbuffer[z] != '\n') { if (readbuffer[z] != '\n') {
@ -454,6 +454,7 @@ void chat_system(struct user_record *user) {
message[y+1] = '\0'; message[y+1] = '\0';
y++; y++;
} else { } else {
y = 0; y = 0;
// json parse // json parse
jsmn_init(&parser); jsmn_init(&parser);