|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1988 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted provided ! 6: * that: (1) source distributions retain this entire copyright notice and ! 7: * comment, and (2) distributions including binaries display the following ! 8: * acknowledgement: ``This product includes software developed by the ! 9: * University of California, Berkeley and its contributors'' in the ! 10: * documentation or other materials provided with the distribution and in ! 11: * all advertising materials mentioning features or use of this software. ! 12: * Neither the name of the University nor the names of its contributors may ! 13: * be used to endorse or promote products derived from this software without ! 14: * specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 16: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 17: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: * ! 19: * @(#)externs.h 1.25 (Berkeley) 6/28/90 ! 20: */ ! 21: ! 22: #ifndef BSD ! 23: # define BSD 43 ! 24: #endif ! 25: ! 26: #if (BSD > 43 || defined(SYSV_TERMIO)) && !defined(USE_TERMIO) ! 27: # define USE_TERMIO ! 28: #endif ! 29: ! 30: #include <stdio.h> ! 31: #include <setjmp.h> ! 32: #ifndef FILIO_H ! 33: #include <sys/ioctl.h> ! 34: #else ! 35: #include <sys/filio.h> ! 36: #endif ! 37: #ifdef USE_TERMIO ! 38: # ifndef VINTR ! 39: # ifdef SYSV_TERMIO ! 40: # include <sys/termio.h> ! 41: # else ! 42: # include <sys/termios.h> ! 43: # define termio termios ! 44: # endif ! 45: # endif ! 46: #endif ! 47: #if defined(NO_CC_T) || !defined(USE_TERMIO) ! 48: # if !defined(USE_TERMIO) ! 49: typedef char cc_t; ! 50: # else ! 51: typedef unsigned char cc_t; ! 52: # endif ! 53: #endif ! 54: ! 55: #define SUBBUFSIZE 256 ! 56: ! 57: extern int errno; /* outside this world */ ! 58: ! 59: extern char ! 60: *strcat(), ! 61: *strcpy(); /* outside this world */ ! 62: ! 63: extern int ! 64: flushout, /* flush output */ ! 65: connected, /* Are we connected to the other side? */ ! 66: globalmode, /* Mode tty should be in */ ! 67: In3270, /* Are we in 3270 mode? */ ! 68: telnetport, /* Are we connected to the telnet port? */ ! 69: localflow, /* Flow control handled locally */ ! 70: localchars, /* we recognize interrupt/quit */ ! 71: donelclchars, /* the user has set "localchars" */ ! 72: showoptions, ! 73: net, /* Network file descriptor */ ! 74: tin, /* Terminal input file descriptor */ ! 75: tout, /* Terminal output file descriptor */ ! 76: crlf, /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */ ! 77: autoflush, /* flush output when interrupting? */ ! 78: autosynch, /* send interrupt characters with SYNCH? */ ! 79: SYNCHing, /* Is the stream in telnet SYNCH mode? */ ! 80: donebinarytoggle, /* the user has put us in binary */ ! 81: dontlecho, /* do we suppress local echoing right now? */ ! 82: crmod, ! 83: netdata, /* Print out network data flow */ ! 84: #ifdef KERBEROS ! 85: kerberized, /* Try to use Kerberos */ ! 86: #endif ! 87: prettydump, /* Print "netdata" output in user readable format */ ! 88: #if defined(unix) ! 89: #if defined(TN3270) ! 90: cursesdata, /* Print out curses data flow */ ! 91: apitrace, /* Trace API transactions */ ! 92: #endif /* defined(TN3270) */ ! 93: termdata, /* Print out terminal data flow */ ! 94: #endif /* defined(unix) */ ! 95: debug; /* Debug level */ ! 96: ! 97: extern cc_t escape; /* Escape to command mode */ ! 98: #ifdef KLUDGELINEMODE ! 99: extern cc_t echoc; /* Toggle local echoing */ ! 100: #endif ! 101: ! 102: extern char ! 103: *prompt; /* Prompt for command. */ ! 104: ! 105: extern char ! 106: doopt[], ! 107: dont[], ! 108: will[], ! 109: wont[], ! 110: options[], /* All the little options */ ! 111: *hostname; /* Who are we connected to? */ ! 112: ! 113: /* ! 114: * We keep track of each side of the option negotiation. ! 115: */ ! 116: ! 117: #define MY_STATE_WILL 0x01 ! 118: #define MY_WANT_STATE_WILL 0x02 ! 119: #define MY_STATE_DO 0x04 ! 120: #define MY_WANT_STATE_DO 0x08 ! 121: ! 122: /* ! 123: * Macros to check the current state of things ! 124: */ ! 125: ! 126: #define my_state_is_do(opt) (options[opt]&MY_STATE_DO) ! 127: #define my_state_is_will(opt) (options[opt]&MY_STATE_WILL) ! 128: #define my_want_state_is_do(opt) (options[opt]&MY_WANT_STATE_DO) ! 129: #define my_want_state_is_will(opt) (options[opt]&MY_WANT_STATE_WILL) ! 130: ! 131: #define my_state_is_dont(opt) (!my_state_is_do(opt)) ! 132: #define my_state_is_wont(opt) (!my_state_is_will(opt)) ! 133: #define my_want_state_is_dont(opt) (!my_want_state_is_do(opt)) ! 134: #define my_want_state_is_wont(opt) (!my_want_state_is_will(opt)) ! 135: ! 136: #define set_my_state_do(opt) {options[opt] |= MY_STATE_DO;} ! 137: #define set_my_state_will(opt) {options[opt] |= MY_STATE_WILL;} ! 138: #define set_my_want_state_do(opt) {options[opt] |= MY_WANT_STATE_DO;} ! 139: #define set_my_want_state_will(opt) {options[opt] |= MY_WANT_STATE_WILL;} ! 140: ! 141: #define set_my_state_dont(opt) {options[opt] &= ~MY_STATE_DO;} ! 142: #define set_my_state_wont(opt) {options[opt] &= ~MY_STATE_WILL;} ! 143: #define set_my_want_state_dont(opt) {options[opt] &= ~MY_WANT_STATE_DO;} ! 144: #define set_my_want_state_wont(opt) {options[opt] &= ~MY_WANT_STATE_WILL;} ! 145: ! 146: /* ! 147: * Make everything symetrical ! 148: */ ! 149: ! 150: #define HIS_STATE_WILL MY_STATE_DO ! 151: #define HIS_WANT_STATE_WILL MY_WANT_STATE_DO ! 152: #define HIS_STATE_DO MY_STATE_WILL ! 153: #define HIS_WANT_STATE_DO MY_WANT_STATE_WILL ! 154: ! 155: #define his_state_is_do my_state_is_will ! 156: #define his_state_is_will my_state_is_do ! 157: #define his_want_state_is_do my_want_state_is_will ! 158: #define his_want_state_is_will my_want_state_is_do ! 159: ! 160: #define his_state_is_dont my_state_is_wont ! 161: #define his_state_is_wont my_state_is_dont ! 162: #define his_want_state_is_dont my_want_state_is_wont ! 163: #define his_want_state_is_wont my_want_state_is_dont ! 164: ! 165: #define set_his_state_do set_my_state_will ! 166: #define set_his_state_will set_my_state_do ! 167: #define set_his_want_state_do set_my_want_state_will ! 168: #define set_his_want_state_will set_my_want_state_do ! 169: ! 170: #define set_his_state_dont set_my_state_wont ! 171: #define set_his_state_wont set_my_state_dont ! 172: #define set_his_want_state_dont set_my_want_state_wont ! 173: #define set_his_want_state_wont set_my_want_state_dont ! 174: ! 175: ! 176: extern FILE ! 177: *NetTrace; /* Where debugging output goes */ ! 178: extern unsigned char ! 179: NetTraceFile[]; /* Name of file where debugging output goes */ ! 180: extern void ! 181: SetNetTrace(); /* Function to change where debugging goes */ ! 182: ! 183: extern jmp_buf ! 184: peerdied, ! 185: toplevel; /* For error conditions. */ ! 186: ! 187: extern void ! 188: command(), ! 189: #if !defined(NOT43) ! 190: dosynch(), ! 191: #endif /* !defined(NOT43) */ ! 192: get_status(), ! 193: Dump(), ! 194: init_3270(), ! 195: printoption(), ! 196: printsub(), ! 197: sendnaws(), ! 198: setconnmode(), ! 199: setcommandmode(), ! 200: setneturg(), ! 201: sys_telnet_init(), ! 202: telnet(), ! 203: TerminalFlushOutput(), ! 204: TerminalNewMode(), ! 205: TerminalRestoreState(), ! 206: TerminalSaveState(), ! 207: tninit(), ! 208: upcase(), ! 209: willoption(), ! 210: wontoption(); ! 211: ! 212: #if defined(NOT43) ! 213: extern int ! 214: dosynch(); ! 215: #endif /* defined(NOT43) */ ! 216: ! 217: #ifndef USE_TERMIO ! 218: ! 219: extern struct tchars ntc; ! 220: extern struct ltchars nltc; ! 221: extern struct sgttyb nttyb; ! 222: ! 223: # define termEofChar ntc.t_eofc ! 224: # define termEraseChar nttyb.sg_erase ! 225: # define termFlushChar nltc.t_flushc ! 226: # define termIntChar ntc.t_intrc ! 227: # define termKillChar nttyb.sg_kill ! 228: # define termLiteralNextChar nltc.t_lnextc ! 229: # define termQuitChar ntc.t_quitc ! 230: # define termSuspChar nltc.t_suspc ! 231: # define termRprntChar nltc.t_rprntc ! 232: # define termWerasChar nltc.t_werasc ! 233: # define termStartChar ntc.t_startc ! 234: # define termStopChar ntc.t_stopc ! 235: # define termForw1Char ntc.t_brkc ! 236: extern cc_t termForw2Char; ! 237: ! 238: # define termEofCharp (cc_t *)&ntc.t_eofc ! 239: # define termEraseCharp (cc_t *)&nttyb.sg_erase ! 240: # define termFlushCharp (cc_t *)&nltc.t_flushc ! 241: # define termIntCharp (cc_t *)&ntc.t_intrc ! 242: # define termKillCharp (cc_t *)&nttyb.sg_kill ! 243: # define termLiteralNextCharp (cc_t *)&nltc.t_lnextc ! 244: # define termQuitCharp (cc_t *)&ntc.t_quitc ! 245: # define termSuspCharp (cc_t *)&nltc.t_suspc ! 246: # define termRprntCharp (cc_t *)&nltc.t_rprntc ! 247: # define termWerasCharp (cc_t *)&nltc.t_werasc ! 248: # define termStartCharp (cc_t *)&ntc.t_startc ! 249: # define termStopCharp (cc_t *)&ntc.t_stopc ! 250: # define termForw1Charp (cc_t *)&ntc.t_brkc ! 251: # define termForw2Charp (cc_t *)&termForw2Char ! 252: ! 253: # else ! 254: ! 255: extern struct termio new_tc; ! 256: ! 257: # define termEofChar new_tc.c_cc[VEOF] ! 258: # define termEraseChar new_tc.c_cc[VERASE] ! 259: # define termIntChar new_tc.c_cc[VINTR] ! 260: # define termKillChar new_tc.c_cc[VKILL] ! 261: # define termQuitChar new_tc.c_cc[VQUIT] ! 262: ! 263: # ifndef VSUSP ! 264: extern cc_t termSuspChar; ! 265: # else ! 266: # define termSuspChar new_tc.c_cc[VSUSP] ! 267: # endif ! 268: # if !defined(VFLUSHO) && defined(VDISCARD) ! 269: # define VFLUSHO VDISCARD ! 270: # endif ! 271: # ifndef VFLUSHO ! 272: extern cc_t termFlushChar; ! 273: # else ! 274: # define termFlushChar new_tc.c_cc[VFLUSHO] ! 275: # endif ! 276: # ifndef VWERASE ! 277: extern cc_t termWerasChar; ! 278: # else ! 279: # define termWerasChar new_tc.c_cc[VWERASE] ! 280: # endif ! 281: # ifndef VREPRINT ! 282: extern cc_t termRprntChar; ! 283: # else ! 284: # define termRprntChar new_tc.c_cc[VREPRINT] ! 285: # endif ! 286: # ifndef VLNEXT ! 287: extern cc_t termLiteralNextChar; ! 288: # else ! 289: # define termLiteralNextChar new_tc.c_cc[VLNEXT] ! 290: # endif ! 291: # ifndef VSTART ! 292: extern cc_t termStartChar; ! 293: # else ! 294: # define termStartChar new_tc.c_cc[VSTART] ! 295: # endif ! 296: # ifndef VSTOP ! 297: extern cc_t termStopChar; ! 298: # else ! 299: # define termStopChar new_tc.c_cc[VSTOP] ! 300: # endif ! 301: # ifndef VEOL ! 302: extern cc_t termForw1Char; ! 303: # else ! 304: # define termForw1Char new_tc.c_cc[VEOL] ! 305: # endif ! 306: # ifndef VEOL2 ! 307: extern cc_t termForw2Char; ! 308: # else ! 309: # define termForw2Char new_tc.c_cc[VEOL] ! 310: # endif ! 311: ! 312: # ifndef CRAY ! 313: # define termEofCharp &termEofChar ! 314: # define termEraseCharp &termEraseChar ! 315: # define termIntCharp &termIntChar ! 316: # define termKillCharp &termKillChar ! 317: # define termQuitCharp &termQuitChar ! 318: # define termSuspCharp &termSuspChar ! 319: # define termFlushCharp &termFlushChar ! 320: # define termWerasCharp &termWerasChar ! 321: # define termRprntCharp &termRprntChar ! 322: # define termLiteralNextCharp &termLiteralNextChar ! 323: # define termStartCharp &termStartChar ! 324: # define termStopCharp &termStopChar ! 325: # define termForw1Charp &termForw1Char ! 326: # define termForw2Charp &termForw2Char ! 327: # else ! 328: /* Work around a compiler bug */ ! 329: # define termEofCharp 0 ! 330: # define termEraseCharp 0 ! 331: # define termIntCharp 0 ! 332: # define termKillCharp 0 ! 333: # define termQuitCharp 0 ! 334: # define termSuspCharp 0 ! 335: # define termFlushCharp 0 ! 336: # define termWerasCharp 0 ! 337: # define termRprntCharp 0 ! 338: # define termLiteralNextCharp 0 ! 339: # define termStartCharp 0 ! 340: # define termStopCharp 0 ! 341: # define termForw1Charp 0 ! 342: # define termForw2Charp 0 ! 343: # endif ! 344: #endif ! 345: ! 346: ! 347: /* Ring buffer structures which are shared */ ! 348: ! 349: extern Ring ! 350: netoring, ! 351: netiring, ! 352: ttyoring, ! 353: ttyiring; ! 354: ! 355: /* Tn3270 section */ ! 356: #if defined(TN3270) ! 357: ! 358: extern int ! 359: HaveInput, /* Whether an asynchronous I/O indication came in */ ! 360: noasynchtty, /* Don't do signals on I/O (SIGURG, SIGIO) */ ! 361: noasynchnet, /* Don't do signals on I/O (SIGURG, SIGIO) */ ! 362: sigiocount, /* Count of SIGIO receptions */ ! 363: shell_active; /* Subshell is active */ ! 364: ! 365: extern char ! 366: *Ibackp, /* Oldest byte of 3270 data */ ! 367: Ibuf[], /* 3270 buffer */ ! 368: *Ifrontp, /* Where next 3270 byte goes */ ! 369: tline[], ! 370: *transcom; /* Transparent command */ ! 371: ! 372: extern int ! 373: settranscom(); ! 374: ! 375: extern void ! 376: inputAvailable(); ! 377: #endif /* defined(TN3270) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.