1*32141Sminshall #include <stdio.h> 2*32141Sminshall #include <setjmp.h> 3*32141Sminshall 4*32141Sminshall #define SUBBUFSIZE 100 5*32141Sminshall 6*32141Sminshall extern int errno; /* outside this world */ 7*32141Sminshall 8*32141Sminshall extern int 9*32141Sminshall SYNCHing, /* we are in TELNET SYNCH mode */ 10*32141Sminshall flushout, /* flush output */ 11*32141Sminshall connected, /* Are we connected to the other side? */ 12*32141Sminshall globalmode, /* Mode tty should be in */ 13*32141Sminshall In3270, /* Are we in 3270 mode? */ 14*32141Sminshall telnetport, /* Are we connected to the telnet port? */ 15*32141Sminshall localchars, /* we recognize interrupt/quit */ 16*32141Sminshall donelclchars, /* the user has set "localchars" */ 17*32141Sminshall showoptions, 18*32141Sminshall flushline, 19*32141Sminshall net, 20*32141Sminshall tin, 21*32141Sminshall tout, 22*32141Sminshall crlf, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */ 23*32141Sminshall autoflush, /* flush output when interrupting? */ 24*32141Sminshall autosynch, /* send interrupt characters with SYNCH? */ 25*32141Sminshall donebinarytoggle, /* the user has put us in binary */ 26*32141Sminshall dontlecho, /* do we suppress local echoing right now? */ 27*32141Sminshall crmod, 28*32141Sminshall netdata, /* Print out network data flow */ 29*32141Sminshall debug; /* Debug level */ 30*32141Sminshall 31*32141Sminshall extern char 32*32141Sminshall echoc, /* Toggle local echoing */ 33*32141Sminshall escape, /* Escape to command mode */ 34*32141Sminshall doopt[], 35*32141Sminshall dont[], 36*32141Sminshall will[], 37*32141Sminshall wont[], 38*32141Sminshall hisopts[], 39*32141Sminshall myopts[], 40*32141Sminshall subbuffer[SUBBUFSIZE], 41*32141Sminshall *hostname, /* Who are we connected to? */ 42*32141Sminshall *prompt, /* Prompt for command. */ 43*32141Sminshall *nfrontp, 44*32141Sminshall *nbackp, 45*32141Sminshall netobuf[2*BUFSIZ], 46*32141Sminshall ttyobuf[2*BUFSIZ], 47*32141Sminshall *tfrontp, 48*32141Sminshall *tbackp; 49*32141Sminshall 50*32141Sminshall extern FILE 51*32141Sminshall *NetTrace; /* Where debugging output goes */ 52*32141Sminshall 53*32141Sminshall extern jmp_buf 54*32141Sminshall peerdied, 55*32141Sminshall toplevel; /* For error conditions. */ 56*32141Sminshall 57*32141Sminshall extern void 58*32141Sminshall intr(), 59*32141Sminshall intr2(), 60*32141Sminshall deadpeer(), 61*32141Sminshall dosynch(), 62*32141Sminshall doflush(), 63*32141Sminshall setconnmode(), 64*32141Sminshall setcommandmode(); 65*32141Sminshall 66*32141Sminshall extern char 67*32141Sminshall termEofChar, 68*32141Sminshall termEraseChar, 69*32141Sminshall termFlushChar, 70*32141Sminshall termIntChar, 71*32141Sminshall termKillChar, 72*32141Sminshall termLiteralNextChar, 73*32141Sminshall termQuitChar; 74