133685Sbostic /* 233685Sbostic * Copyright (c) 1988 Regents of the University of California. 333685Sbostic * All rights reserved. 433685Sbostic * 533685Sbostic * Redistribution and use in source and binary forms are permitted 634898Sbostic * provided that the above copyright notice and this paragraph are 734898Sbostic * duplicated in all such forms and that any documentation, 834898Sbostic * advertising materials, and other materials related to such 934898Sbostic * distribution and use acknowledge that the software was developed 1034898Sbostic * by the University of California, Berkeley. The name of the 1134898Sbostic * University may not be used to endorse or promote products derived 1234898Sbostic * from this software without specific prior written permission. 1334898Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1434898Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1534898Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1633685Sbostic * 17*38208Sminshall * @(#)externs.h 1.16 (Berkeley) 05/30/89 1833685Sbostic */ 1933685Sbostic 2032141Sminshall #include <stdio.h> 2132141Sminshall #include <setjmp.h> 2232141Sminshall 2332141Sminshall #define SUBBUFSIZE 100 2432141Sminshall 2532141Sminshall extern int errno; /* outside this world */ 2632141Sminshall 2733802Sminshall extern char 2833802Sminshall *strcat(), 2933802Sminshall *strcpy(); /* outside this world */ 3033802Sminshall 3132141Sminshall extern int 3233802Sminshall flushout, /* flush output */ 3333802Sminshall connected, /* Are we connected to the other side? */ 3433802Sminshall globalmode, /* Mode tty should be in */ 3533802Sminshall In3270, /* Are we in 3270 mode? */ 3633802Sminshall telnetport, /* Are we connected to the telnet port? */ 3737219Sminshall localflow, /* Flow control handled locally */ 3833802Sminshall localchars, /* we recognize interrupt/quit */ 3933802Sminshall donelclchars, /* the user has set "localchars" */ 4033802Sminshall showoptions, 4136274Sminshall net, /* Network file descriptor */ 4236274Sminshall tin, /* Terminal input file descriptor */ 4333802Sminshall tout, /* Terminal output file descriptor */ 4433802Sminshall crlf, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */ 4533802Sminshall autoflush, /* flush output when interrupting? */ 4633802Sminshall autosynch, /* send interrupt characters with SYNCH? */ 4733802Sminshall SYNCHing, /* Is the stream in telnet SYNCH mode? */ 4833802Sminshall donebinarytoggle, /* the user has put us in binary */ 4933802Sminshall dontlecho, /* do we suppress local echoing right now? */ 5033802Sminshall crmod, 5133802Sminshall netdata, /* Print out network data flow */ 52*38208Sminshall #if defined(unix) 53*38208Sminshall #if defined(TN3270) 54*38208Sminshall cursesdata, /* Print out curses data flow */ 55*38208Sminshall #endif /* defined(TN3270) */ 56*38208Sminshall termdata, /* Print out terminal data flow */ 57*38208Sminshall #endif /* defined(unix) */ 5833802Sminshall debug; /* Debug level */ 5932141Sminshall 6032141Sminshall extern char 6133802Sminshall echoc, /* Toggle local echoing */ 6233802Sminshall escape, /* Escape to command mode */ 6333802Sminshall doopt[], 6433802Sminshall dont[], 6533802Sminshall will[], 6633802Sminshall wont[], 6737226Sminshall options[], /* All the little options */ 6833802Sminshall *hostname, /* Who are we connected to? */ 6933802Sminshall *prompt; /* Prompt for command. */ 7032141Sminshall 7137226Sminshall /* 7237226Sminshall * We keep track of each side of the option negotiation. 7337226Sminshall */ 7437226Sminshall 7537226Sminshall #define OPT_HE_SAID_DO 0x01 7637226Sminshall #define OPT_HE_SAID_WILL 0x02 7737226Sminshall #define OPT_I_SAID_DO 0x04 7837226Sminshall #define OPT_I_SAID_WILL 0x08 7937226Sminshall 8037226Sminshall /* 8137226Sminshall * Macros to check out what has been said. 8237226Sminshall */ 8337226Sminshall 8437226Sminshall #define did_he_say_do(opt) (options[opt]&OPT_HE_SAID_DO) 8537226Sminshall #define did_he_say_will(opt) (options[opt]&OPT_HE_SAID_WILL) 8637226Sminshall #define did_I_say_do(opt) (options[opt]&OPT_I_SAID_DO) 8737226Sminshall #define did_I_say_will(opt) (options[opt]&OPT_I_SAID_WILL) 8837226Sminshall 8937226Sminshall #define should_he(opt) \ 9037226Sminshall (did_he_say_will(opt) && did_I_say_do(opt)) 9137226Sminshall #define should_I(opt) \ 9237226Sminshall (did_I_say_will(opt) && did_he_say_do(opt)) 9337226Sminshall 9432141Sminshall extern FILE 9533802Sminshall *NetTrace; /* Where debugging output goes */ 9632141Sminshall 9732141Sminshall extern jmp_buf 9833802Sminshall peerdied, 9933802Sminshall toplevel; /* For error conditions. */ 10032141Sminshall 10132141Sminshall extern void 10234848Sminshall command(), 10334313Sminshall #if !defined(NOT43) 10433802Sminshall dosynch(), 10534313Sminshall #endif /* !defined(NOT43) */ 10634848Sminshall Dump(), 10734848Sminshall init_3270(), 10834848Sminshall printoption(), 10934848Sminshall printsub(), 11037219Sminshall sendnaws(), 11133802Sminshall setconnmode(), 11234848Sminshall setcommandmode(), 11334848Sminshall setneturg(), 11434848Sminshall sys_telnet_init(), 11534848Sminshall telnet(), 11634848Sminshall TerminalFlushOutput(), 11734848Sminshall TerminalNewMode(), 11834848Sminshall TerminalRestoreState(), 11934848Sminshall TerminalSaveState(), 12034848Sminshall tninit(), 12134848Sminshall upcase(), 12234848Sminshall willoption(), 12334848Sminshall wontoption(); 12432141Sminshall 12534313Sminshall #if defined(NOT43) 12634313Sminshall extern int 12734313Sminshall dosynch(); 12834313Sminshall #endif /* defined(NOT43) */ 12934313Sminshall 13032141Sminshall extern char 13132141Sminshall termEofChar, 13232141Sminshall termEraseChar, 13332141Sminshall termFlushChar, 13432141Sminshall termIntChar, 13532141Sminshall termKillChar, 13632141Sminshall termLiteralNextChar, 13732141Sminshall termQuitChar; 13832381Sminshall 13932381Sminshall /* Ring buffer structures which are shared */ 14032381Sminshall 14132381Sminshall extern Ring 14233802Sminshall netoring, 14333802Sminshall netiring, 14433802Sminshall ttyoring, 14533802Sminshall ttyiring; 14633802Sminshall 14733802Sminshall /* Tn3270 section */ 14833802Sminshall #if defined(TN3270) 14933802Sminshall 15033802Sminshall extern int 15133802Sminshall HaveInput, /* Whether an asynchronous I/O indication came in */ 15236241Sminshall noasynchtty, /* Don't do signals on I/O (SIGURG, SIGIO) */ 15336241Sminshall noasynchnet, /* Don't do signals on I/O (SIGURG, SIGIO) */ 15436241Sminshall sigiocount, /* Count of SIGIO receptions */ 15533802Sminshall shell_active; /* Subshell is active */ 15633802Sminshall 15733802Sminshall extern char 15833802Sminshall *Ibackp, /* Oldest byte of 3270 data */ 15933802Sminshall Ibuf[], /* 3270 buffer */ 16033802Sminshall *Ifrontp, /* Where next 3270 byte goes */ 16133802Sminshall tline[], 16233802Sminshall *transcom; /* Transparent command */ 16333802Sminshall 16433802Sminshall extern int 16533802Sminshall settranscom(); 16633802Sminshall 16733802Sminshall extern void 16833802Sminshall inputAvailable(); 16933802Sminshall #endif /* defined(TN3270) */ 170