| 86 |
|
|
| 87 |
return ret; |
return ret; |
| 88 |
} |
} |
| 89 |
|
|
| 90 |
|
// from Maple-hightman |
| 91 |
|
// added by flyriver, 2001.3.3 |
| 92 |
|
int |
| 93 |
|
telnetopt (int fd, char *buf, int max) |
| 94 |
|
{ |
| 95 |
|
unsigned char c, d, e; |
| 96 |
|
int pp = 0; |
| 97 |
|
unsigned char tmp[30]; |
| 98 |
|
|
| 99 |
|
while (pp < max) |
| 100 |
|
{ |
| 101 |
|
c = buf[pp++]; |
| 102 |
|
if (c == 255) |
| 103 |
|
{ |
| 104 |
|
d = buf[pp++]; |
| 105 |
|
e = buf[pp++]; |
| 106 |
|
iflush (); |
| 107 |
|
if ((d == 253) && (e == 3 || e == 24)) |
| 108 |
|
{ |
| 109 |
|
tmp[0] = 255; |
| 110 |
|
tmp[1] = 251; |
| 111 |
|
tmp[2] = e; |
| 112 |
|
write (fd, tmp, 3); |
| 113 |
|
continue; |
| 114 |
|
} |
| 115 |
|
if ((d == 251 || d == 252) && (e == 1 || e == 3 || e == 24)) |
| 116 |
|
{ |
| 117 |
|
tmp[0] = 255; |
| 118 |
|
tmp[1] = 253; |
| 119 |
|
tmp[2] = e; |
| 120 |
|
write (fd, tmp, 3); |
| 121 |
|
continue; |
| 122 |
|
} |
| 123 |
|
if (d == 251 || d == 252) |
| 124 |
|
{ |
| 125 |
|
tmp[0] = 255; |
| 126 |
|
tmp[1] = 254; |
| 127 |
|
tmp[2] = e; |
| 128 |
|
write (fd, tmp, 3); |
| 129 |
|
continue; |
| 130 |
|
} |
| 131 |
|
if (d == 253 || d == 254) |
| 132 |
|
{ |
| 133 |
|
tmp[0] = 255; |
| 134 |
|
tmp[1] = 252; |
| 135 |
|
tmp[2] = e; |
| 136 |
|
write (fd, tmp, 3); |
| 137 |
|
continue; |
| 138 |
|
} |
| 139 |
|
if (d == 250) |
| 140 |
|
{ |
| 141 |
|
while (e != 240 && pp < max) |
| 142 |
|
e = buf[pp++]; |
| 143 |
|
tmp[0] = 255; |
| 144 |
|
tmp[1] = 250; |
| 145 |
|
tmp[2] = 24; |
| 146 |
|
tmp[3] = 0; |
| 147 |
|
tmp[4] = 65; |
| 148 |
|
tmp[5] = 78; |
| 149 |
|
tmp[6] = 83; |
| 150 |
|
tmp[7] = 73; |
| 151 |
|
tmp[8] = 255; |
| 152 |
|
tmp[9] = 240; |
| 153 |
|
write (fd, tmp, 10); |
| 154 |
|
} |
| 155 |
|
} |
| 156 |
|
else |
| 157 |
|
outc (c); |
| 158 |
|
} |
| 159 |
|
iflush (); |
| 160 |
|
return 0; |
| 161 |
|
} |