Work around for buggy ftelnet

This commit is contained in:
Andrew Pamment 2016-03-24 10:46:01 +10:00
parent cfa6b20d5d
commit fb8056e084

53
bbs.c
View File

@ -217,34 +217,37 @@ char s_getchar(int socket) {
unsigned char c; unsigned char c;
int len; int len;
len = read(socket, &c, 1); do {
len = read(socket, &c, 1);
if (len == 0) {
disconnect(socket);
}
while (c == 255) {
len = read(socket, &c, 1);
if (len == 0) {
disconnect(socket);
}
len = read(socket, &c, 1);
if (len == 0) {
disconnect(socket);
}
len = read(socket, &c, 1);
if (len == 0) {
disconnect(socket);
}
}
if (len == 0) {
disconnect(socket);
}
while (c == 255) { if (c == '\r') {
len = read(socket, &c, 1); if (len == 0) {
if (len == 0) { disconnect(socket);
disconnect(socket); }
} }
len = read(socket, &c, 1); } while (c == '\n');
if (len == 0) {
disconnect(socket);
}
len = read(socket, &c, 1);
if (len == 0) {
disconnect(socket);
}
}
if (c == '\r' || c == '\n') {
len = read(socket, &c, 1);
if (len == 0) {
disconnect(socket);
}
}
usertimeout = 10; usertimeout = 10;
return (char)c; return (char)c;
} }