# 2.11BSD#431 - /usr/src/local/zmodem/genie.c

##### Functions

    cucheck           X
    flushmo           X
    from_cu           X
    mode              X
    purgeline         X
    readline          X
    sendbrk           X

##### Variables

    Fromcu            X
    Myattn            X
    Twostop           X

##### Macros

    ALTCANOFF         X
    XARGSFILE         X
    XX                X

       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

- in /usr/src/local/zmodem/sz.c line 924, 971, 1900, 2081

from_cu defined in line 34; never used
mode defined in line 55; never used
purgeline defined in line 108; used 3 times

- in /usr/src/local/zmodem/sz.c line 922, 1262, 1732

readline defined in line 94; used 16 times

- in /usr/src/local/zmodem/sz.c line 858, 878, 898, 927, 976, 1003, 1568, 1678, 1687, 1715, 1726, 1774, 1790, 2075, 2085, 2093

sendbrk defined in line 87; never used

#### Defined variables

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

- in /usr/src/local/zmodem/sz.c line 1518, 1531

Twostop defined in line 43; never used

#### Defined macros

ALTCANOFF defined in line 22; used 2 times

- in /usr/src/local/zmodem/sz.c line 1523-1524(2)

XARGSFILE defined in line 16; used 7 times

- in /usr/src/local/zmodem/sz.c line 303, 361, 534-537(3), 661, 2041

XX defined in line 17; used 4 times

- in /usr/src/local/zmodem/sz.c line 92, 211, 807, 822

#### Usage of this include

genie.c used 1 times

- in /usr/src/local/zmodem/sz.c line 208

Last modified: 1992-06-14 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1322 |