1: /*
   2:  *
   3:  *  Rev 5-25-89
   4:  *  This file contains GEnie specific code for setting terminal modes,
   5:  *  very little is specific to ZMODEM or YMODEM per se (that code is in
   6:  *  sz.c and rz.c).  The CRC-16 routines used by XMODEM, YMODEM, and ZMODEM
   7:  *  are also in this file, a fast table driven macro version
   8:  *
   9:  *   This file is #included so the main file can set parameters such as HOWMANY.
  10:  *   See the main file rz.c for compile instructions.
  11:  */
  12: 
  13: #include <string.h>
  14: #include <fcntl.h>
  15: 
  16: #define XARGSFILE "/"
  17: #define XX
  18: 
  19: STATIC char Myattn[] = { 0335, 0336, 0336, 0,
  20:      0335, 0336, 0336, 24,24,24,24,24,24,24,24,24,24,13
  21: };
  22: #define ALTCANOFF 4
  23: 
  24: /*
  25: extern unsigned int _fmode = O_BINARY;
  26: */
  27: 
  28: /*
  29:  * return 1 iff stdout and stderr are different devices
  30:  *  indicating this program operating with a modem on a
  31:  *  different line
  32:  */
  33: int Fromcu;     /* Were called from cu or yam */
  34: from_cu()
  35: {
  36:     return 0;
  37: }
  38: cucheck()
  39: {
  40: }
  41: 
  42: 
  43: int Twostop;        /* Use two stop bits */
  44: 
  45: 
  46: 
  47: 
  48: /*
  49:  * mode(n)
  50:  *  3: save old tty stat, set raw mode with flow control
  51:  *  2: set XON/XOFF for sb/sz with ZMODEM or YMODEM-g
  52:  *  1: save old tty stat, set raw mode
  53:  *  0: restore original tty mode
  54:  */
  55: mode(n)
  56: {
  57:     static did0 = FALSE;
  58: 
  59:     vfile("mode:%d", n);
  60:     switch(n) {
  61:     case 2:     /* Un-raw mode used by sz, sb when -g detected */
  62:     case 1:
  63:     case 3:
  64:         did0 = TRUE;
  65:         system("set x on");
  66:         system("set e off");
  67:         system("set t13,10");
  68: /*
  69: 		system("set b3");
  70: */
  71:         reset(1);
  72:         binary(1);
  73:         /* Assume fd 1 is stdout (not documented in GEnie) */
  74:         fcntl(1, F_SETFL,
  75:           ((fcntl(1, F_GETFL, 0)|O_BINARY)& ~O_POST_BREAK));
  76:         return OK;
  77:     case 0:
  78:         if(!did0)
  79:             return ERROR;
  80: 
  81:         return OK;
  82:     default:
  83:         return ERROR;
  84:     }
  85: }
  86: 
  87: sendbrk()
  88: {
  89: }
  90: /*
  91:  * readline(timeout) reads character(s) from file descriptor 0
  92:  * timeout is in tenths of seconds
  93:  */
  94: readline(timeout)
  95: {
  96:     static char byt[1];
  97: 
  98:     fflush(stdout);
  99:     read(0, byt, 1);
 100:     return (byt[0]&0377);
 101: }
 102: 
 103: flushmo()
 104: {
 105:     fflush(stdout);
 106: }
 107: 
 108: purgeline() {}
 109: 
 110: 
 111: /* End of genie.c */

Defined functions

cucheck defined in line 38; never used
flushmo defined in line 103; used 4 times
from_cu defined in line 34; never used
mode defined in line 55; never used
purgeline defined in line 108; used 3 times
readline defined in line 94; used 16 times
sendbrk defined in line 87; never used

Defined variables

Fromcu defined in line 33; never used
Myattn defined in line 19; used 2 times
Twostop defined in line 43; never used

Defined macros

ALTCANOFF defined in line 22; used 2 times
XARGSFILE defined in line 16; used 7 times
XX defined in line 17; used 4 times

Usage of this include

genie.c used 1 times
Last modified: 1992-06-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1139
Valid CSS Valid XHTML 1.0 Strict