diff --git a/devamlc.h b/devamlc.h index b238029..e857960 100644 --- a/devamlc.h +++ b/devamlc.h @@ -139,6 +139,22 @@ int devamlc (int class, int func, int device) { #define TS_SUBOPT 2 /* inside a suboption */ #define TS_OPTION 3 /* inside an option */ + /* telnet protocol special characters */ + +#define TN_IAC 255 +#define TN_WILL 251 +#define TN_WONT 252 +#define TN_DO 253 +#define TN_DONT 254 + + /* telnet options */ + +#define TN_BINARY 0 +#define TN_ECHO 1 +#define TN_SGA 3 /* means this is a full-duplex connection */ +#define TN_KERMIT 47 +#define TN_SUBOPT 250 + static short inited = 0; static int pollspeedup = 1; static int baudtable[16] = {1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}; @@ -191,7 +207,7 @@ int devamlc (int class, int func, int device) { fd_set fds; struct timeval timeout; unsigned char ch; - int state; + int tstate, toper; int msgfd; int allbusy; unsigned short qtop, qbot, qtemp; @@ -805,15 +821,15 @@ endconnect: methods, this stuff might be better off in a very thin connection server */ - buf[0] = 255; /* IAC */ - buf[1] = 251; /* will */ - buf[2] = 1; /* echo */ - buf[3] = 255; /* IAC */ - buf[4] = 251; /* will */ - buf[5] = 3; /* supress go ahead */ - buf[6] = 255; /* IAC */ - buf[7] = 253; /* do */ - buf[8] = 0; /* binary mode */ + buf[0] = TN_IAC; + buf[1] = TN_WILL; + buf[2] = TN_ECHO; + buf[3] = TN_IAC; + buf[4] = TN_WILL; + buf[5] = TN_SGA; + buf[6] = TN_IAC; + buf[7] = TN_DO; + buf[8] = TN_BINARY; write(fd, buf, 9); /* send out the ttymsg greeting */ @@ -1031,13 +1047,13 @@ endconnect: if (n > 0) { //printf("devamlc: RECV dx=%d, lx=%d, b=%d, tried=%d, read=%d\n", dx, lx, dc[dx].bufnum, n2, n); - state = dc[dx].tstate[lx]; + tstate = dc[dx].tstate[lx]; for (i=0; i