home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / honeywellgcosa / hd6ker.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  12KB  |  302 lines

  1. /************************************************************************
  2.  *
  3.  *       HD6KER.H    Global definitions and function
  4.  *             prototypes for both HD6KER.C and HD6PRI.C.
  5.  *
  6.  ***********************************************************************/  
  7.  
  8. #define NULL 0
  9.  
  10. /* ---  library includes files  --- */
  11.  
  12. #include <sgtty.h>
  13. #include <stdio.h>          /* Standard UNIX definitions   */
  14. #include <ctype.h>          /* isascii definitions         */
  15. #include <signal.h>         /* signal catcher definitions  */
  16.  
  17. /* ---  MOD400 wild card and file management stuff  --- */
  18.  
  19. #include <star_name.h>        /* wild card filename routines */
  20. #define MOD4_NAME   12        /* maximum size of Honeywell file name */
  21. #define SVQ        1        /* sequential file; multi-volume set; ASCII */ 
  22. #define SEQ        2        /* reqular sequential file; ASCII */
  23. #define S_R        18        /* string_relative file; ASCII */
  24. #define F_R        13        /* fixed_relative file; BINARY */
  25. #define ASCII       0           /* MOD400 SEQ, S_R, and SVQ file types */
  26. #define BINARY      2           /* MOD400 F_R file type */
  27. #define FOREIGN     1           /* MOD400 SEQ (DATA_CODE=BINARY) file type */ 
  28.  
  29. /* ---  symbol definitions  --- */
  30.  
  31. #define MAXPACKSIZ  2000    /* Maximum packet size */
  32. #define MAXTIM      60      /* Maximum timeout interval */
  33. #define MAXTRY      10      /* Times to retry a packet */
  34. #define MINTIM      2       /* Minumum timeout interval */
  35.  
  36. #define MYEOL       13    /* End-Of-Line character I need */
  37. #define MYPAD       0       /* Number of padding characters I will need */
  38. #define MYPCHAR     0       /* Padding character I need (NULL) */
  39. #define MYQUOTE     '#'     /* Quote character I will use */
  40. #define MYTIME      10      /* Seconds after which I should be timed out */
  41.  
  42. #define TRUE        -1
  43. #define FALSE       0
  44.  
  45. #define LF          10
  46. #define CR          13      /* ASCII Carriage Return */
  47. #define SUB         26      /* ASCII Sub character */
  48. #define DEL         127     /* Delete (rubout) */
  49. #define ESC         0x1b    /* real escape char        */
  50. #define SOH         1       /* Start of header 'ack' */
  51. #define SP          32      /* ASCII space */
  52. #define _ioeof 0x20
  53. #define TANDEM 0
  54.  
  55.  
  56. /* ---  Macro Definitions  --- */
  57.  
  58. /*
  59.  * tochar: converts a control character to a printable one by adding a space.
  60.  * unchar: undoes tochar.
  61.  * ctl:    converts between control characters and printable characters by
  62.  *         toggling the control bit (ie. ^A becomes A and A becomes ^A).
  63.  */
  64. #define tochar(ch)  ((ch) + ' ')
  65. #define unchar(ch)  ((ch) - ' ')
  66. #define ctl(ch)     ((ch) ^ 64 )
  67.  
  68. #define forever     while(1)
  69.  
  70. /************************************************************************
  71.  *
  72.  *                     Definitions for HD6KER.C 
  73.  *
  74.  ***********************************************************************/  
  75.  
  76. #ifdef MAINDEF
  77.  
  78. /* ---  procedures passed as arguments etc.  --- */
  79.  
  80. char cread();
  81.                        /* recv procs */
  82. extern  char rinit(), rfile(), rdata();                   
  83.                        /* send procs */
  84. extern  char sinit(), sfile(), sattru(), sdata(), seof(), sbreak(); 
  85. int     m4_errno, decfil(), syserr();
  86.  
  87. /* ---  procedures in other source files --- */
  88.  
  89. char   ascout(), ascedit(), filerr(), nextin();
  90. int    flushinput(), cooktty(), rawtty();
  91. int    get_time(), wildname(), timoset(), unbuffer();
  92.  
  93. /* ---  forward declarations  --- */
  94.  
  95. extern unsigned chk2();
  96. extern unsigned fsize();
  97.  
  98. /* ---  global variables  --- */
  99.  
  100. int
  101.           aflg, rflg, sflg,   /* flags for AUTO, RECEIVE, SEND */
  102.           debug,              /* indicates level of debug output (0=none) */
  103.           filnamcnv,          /* -1 means do file name case conversions */
  104.           filecount,          /* Number of files left to send */
  105.           image, oimage,      /* 0 = 7-bit, 1 = 8-bit mode, 2 = prefixing */
  106.           fileimage, ofi,     /* 0 = open text file; 2 = open binary file */
  107.           n,                  /* Packet number */
  108.           oldt,               /* previous char in encode() */
  109.           numtry,             /* Times this packet retried */
  110.           oldtry,             /* Times previous packet retried */
  111.           pad,                /* How much padding to send */
  112.           qu8,
  113.           rpt,
  114.           rptflg,
  115.           sz,
  116.           size,               /* Size of present data */
  117.           spsiz,              /* Maximum send packet size */
  118.           sattrib,            /* Attribute packet indicator FRANK DREANO */
  119.           senda,              /* Another attribute flag */
  120.           slongp,             /* Extended packet indicators FRANK DREANO  */
  121.           bctr = 3,           /* CRC type block-check requested */
  122.           bctu = 1,           /* block-check used */
  123.           sysint,
  124.           addsub,
  125.           timint = 10,        /* Timeout for foreign host on sends */
  126.           lrsz_6 = 512,       /* Fixed-relative, BU, record size */
  127.           cmdstat,            /* Return status for system commands */
  128.           dlflag;             /* Flag to overwrite incoming files */
  129.  
  130. char
  131.           c,                  /* dummy char               */
  132.           *dname,             /* name of debug file DH+S   */
  133.           *dt,                /* data-block code/decode   */
  134.           eol = '\015',       /* End-Of-Line character to send */
  135.           **filelist,         /* List of files to be sent */
  136.           *filenames[99],
  137.           *filnam,            /* Current file name */
  138.           getfiles[MAXPACKSIZ],
  139.           iflg = 0,           /* 8th-bit-mode set */
  140.           packet[MAXPACKSIZ], /* Packet buffer */
  141.           padchar,            /* Padding character to send */
  142.           quote = '#',        /* Quote character in incoming data */
  143.           recpkt[MAXPACKSIZ], /* Receive packet buffer */
  144.           state,              /* Present state of the automaton */
  145.           timflag,            /* timeout flag DH+S         */
  146.           type,               /* received-packet type     */
  147.           fo_name[56],        /* pathname for server commands */
  148.           cmdstg[80],         /* String to hold system commands */
  149.           cmdstring[80],      /* String to hold system commands */
  150.           attrib[80];         /* String to hold file attributes */
  151.           
  152. char  amauto[]   = "%sI am in server mode!";
  153. char  badpack[]  = "%sYour Kermit sent invalid packet, type \"%c\"!";
  154. char  crlf[]     = "\r\n";
  155. char  *eighths[] = {"7-bit character","binary-image-mode","8th-bit prefixed"};
  156. char  goodbye[]  = "Returning to MOD400; goodbye.";
  157. char  logout[] = "Logging off the host; goodbye.";
  158. char  *logicval[]= {"OFF", "ON"};
  159. char  noname[]   = "%sNo valid names in GET request";
  160. char  xnull[]    = "";                        /* xnull string              */
  161. char  onlyg[]    = "%sUnimplemented server command!";
  162. char  prompt[]   = "Superkerm: ";
  163.  
  164. /*  The following MOD400 command causes the Superkermit server to log off
  165.     the DPS-6 when done.  It causes a 'C' siqquit trap that isn't very pretty
  166.     and could be avoided if a deferred 'BYE' task could be spawned. However
  167.     the -DFR argument to the spawn task command (ST) is illegal in swappools, 
  168.     so to keep it working in all environments the trap will be tolerated.  */
  169.  
  170. char  byenow[]   = ">SYSLIB2>BYE -BF";
  171. char  buname[]   = ">SYSLIB2>EC";
  172. char  hostok[]   = "Kermit server command EXECUTED!";
  173. char  hostng[]   = "ERROR: Kermit server command NOT EXECUTED!";
  174.  
  175. FILE    *fp,                /* current disk file */
  176.           *dfp;               /* debug file DH+S           */
  177.  
  178. struct  sgttyb  cookedmode, rawmode;          
  179.  
  180. /* ---  Identification string  --- */
  181.  
  182. char ident[] =
  183.     "\033\140\nSuperKermit   09 Apr 91   (Ver 2.01)   Frank Dreano.\n";
  184.  
  185. /* ---  Old (and I mean OLD) setups for cooked and raw TTY...Dreano  --- */
  186. /* 
  187. char tset[] =
  188.  ">>SYSLIB2>STTY -DEV VIP7801 -DSW1 8800 -DSW2 0800 -TERM 04 -IN A -OUT N";
  189. char tclr[] =
  190.  ">>SYSLIB2>STTY -DEV VIP7301 -RESET";
  191. */
  192.  
  193. /* ---  These cooked and raw TTY settings are for 3.1/4.0 op. system  --- */
  194.  
  195. char tset[] =
  196.  ">SYSLIB2>STTY -DEV VIP7801 -LL 4096 -MODES ^CR,^EC,LF -IN A -OUT N";
  197. char tclr[] =
  198.  ">SYSLIB2>STTY -DEV VIP7808 -RESET";
  199.  
  200. #else
  201.  
  202. /************************************************************************
  203.  *
  204.  *                     Definitions for HD6PRI.C 
  205.  *
  206.  ***********************************************************************/  
  207.  
  208. /* ---  procedures passed as arguments etc.  --- */
  209.  
  210. extern  char cread();
  211.                        /* recv procs */
  212. char rinit(), rfile(), rdata();                   
  213.                        /* send procs */
  214. char sinit(), sfile(), sattru(), sdata(), seof(), sbreak(); 
  215. extern  int   m4_errno, decfil();
  216.  
  217. /* ---  procedures in other source files --- */
  218.  
  219. extern char   ascout(), ascedit(), filerr(), nextin();
  220. extern int    flushinput(), cooktty(), rawtty();
  221. extern int    get_time(), wildname(), timoset(), unbuffer();
  222.  
  223. /* ---  forward declarations  --- */
  224.  
  225. unsigned chk2();
  226. unsigned fsize();
  227.  
  228. /* ---  global variables  --- */
  229.  
  230. extern int
  231.           aflg, rflg, sflg,   /* flags for AUTO, RECEIVE, SEND */
  232.           debug,              /* level of debugging output (0=none) */
  233.           filnamcnv,          /* -1 means do file name case conversions */
  234.           filecount,          /* Number of files left to send */
  235.           image, oimage,      /* 0 = 7-bit, 1 = 8-bit mode, 2 = prefixing */
  236.           fileimage, ofi,     /* 0 = open text file; 1 = open binary file */
  237.           n,                  /* Packet number */
  238.           oldt,               /* previous char in encode()        */
  239.           numtry,             /* Times this packet retried */
  240.           oldtry,             /* Times previous packet retried */
  241.           pad,                /* How much padding to send */
  242.           qu8,
  243.           rpt,
  244.           rptflg,
  245.           sz,
  246.           size,              /* Size of present data */
  247.           spsiz,             /* Maximum send packet size */
  248.           sattrib,           /* Attribute packet indicator FRANK DREANO */
  249.           senda,             /* Another attribute flag */
  250.           slongp,            /* Extended packet indicators FRANK DREANO  */
  251.           bctr,              /* block-check requested */
  252.           bctu,              /* block-check used */
  253.           sysint,
  254.           addsub,
  255.           timint,             /* Timeout for foreign host on sends */
  256.           lrsz_6,             /* Fixed-relative, BU, record size */
  257.           cmdstat,            /* Return status for system commands */
  258.           dlflag;             /* Flag to overwrite incoming files */
  259.  
  260. extern char
  261.           c,                  /* dummy char               */
  262.           *dname,             /* name of debug file DH+S   */
  263.           *dt,                /* data-block code/decode   */
  264.           eol,                /* End-Of-Line character to send */
  265.           **filelist,         /* List of files to be sent */
  266.           *filenames[],
  267.           *filnam,            /* Current file name */
  268.           getfiles[],
  269.           iflg,               /* 8th-bit-mode set */
  270.           packet[],           /* Packet buffer */
  271.           padchar,            /* Padding character to send */
  272.           quote,              /* Quote character in incoming data */
  273.           recpkt[],           /* Receive packet buffer */
  274.           state,              /* Present state of the automaton */
  275.           timflag,            /* timeout flag DH+S         */
  276.           type,               /* received-packet type     */
  277.           fo_name[],          /* pathname for server commands */
  278.           cmdstg[],           /* String to hold system commands */
  279.           cmdstring[],      /* String to hold system commands */
  280.           attrib[];           /* String to hold file attributes */
  281.  
  282. extern char  amauto[],
  283.              badpack[],
  284.              crlf[],
  285.              *eighths[],
  286.              goodbye[],
  287.              logout[],
  288.              *logicval[],
  289.              noname[],
  290.              xnull[],
  291.              onlyg[],
  292.              prompt[],
  293.              byenow[],    
  294.              buname[] ;
  295.  
  296. extern FILE    *fp,                /* current disk file */
  297.                *dfp;               /* debug file DH+S           */
  298.  
  299. #endif
  300.  
  301. /********************   End of File  hd6ker.h *****************************/
  302.