home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 110_01 / yam.h < prev    next >
Text File  |  1984-03-03  |  6KB  |  176 lines

  1. /*
  2. >>: yam.h
  3. */
  4. #include "yamsys.h"        /* installation specific stuff */
  5.  
  6. #ifndef XMODEM
  7. #define VERSION "YAM 2.11 Rev 9-06-81\n"
  8. #define lprintf printf
  9. #else
  10. #define VERSION "XYAM 2.11 Rev 9-06-81\n"
  11. #endif
  12. /*
  13.  * yam    -Yet Another Modem program
  14.  *        Chuck Forsberg 7-16-81
  15.  *
  16.  *    Design goals: A general program performing the functions
  17.  *    of MODEM, BYE, and XMODEM, portable to non-timesharing
  18.  *    systems.
  19.  *
  20.  *    Coding style is/was aimed at portability and clarity.
  21.  *    File transfer routines are written without timing assumptions
  22.  *   allowing error free high speed operation even if view selected
  23.  *
  24.  *    Comments to me at:
  25.  *    Chuck Forsberg 503/621-3406 Voice
  26.  *        RBBS RCP/M 503/621-3193    (latest source code)
  27.  *          At 300, 450, or 1200 bps
  28.  *        Portland ABBS 503/224-6409 or CBBS NW 503/284-5260
  29.  *        Source TCE022, CPS 70715,131
  30.  *
  31.  *    Files:
  32.  *        yam.h        header and globals
  33.  *        yamsys.h    Modem port adresses, installation specific data
  34.  *        yam1.c        First time initialization
  35.  *                    Main command decoding
  36.  *        yam2.c        Christensen protocol handler
  37.  *        yam3.c        Conversation with data capture
  38.  *                    File xmsn w/o error checking.
  39.  *    (yam4 reserved for a Forward Error Correcting technique for Telemail)
  40.  *        yam5.c        Misc modem related functions, such as baudrate
  41.  *        yam7.c        Disk i/o open,close, directory
  42.  *                    Wild card expansion, CP/M related stuff
  43.  *
  44.  *        compiled with -e 5800 for all files and -o for yam[235]
  45.  *        (-e 6000 for XYAM)
  46.  */
  47.  
  48. #ifdef CPM
  49. char defdisk;        /* default disk */
  50. char user;
  51. #define PATHLEN 20    /* plenty long */
  52. #endif
  53.  
  54. #ifdef BDSC
  55. #define FLAG char
  56. FILE fin,fout;        /* #define FILE struct _buf */
  57. int logfd;        /* used by logfile */
  58. #define stdin 0
  59. #define stdout 1
  60. #define stderr 1
  61. char cfast;    /* BDS C fastest access is to extern's */
  62. char checksum;    /* delcared here for speed */
  63. int wcj, firstch;
  64. #endif
  65.  
  66. #define CMDLEN 132
  67.  
  68. #define BRKCHR 200
  69. #define ENQ 005
  70. #define CAN ('X'&037)
  71. #define XOFF ('s'&037)
  72. #define XON ('q'&037)
  73. #define SOH 01
  74. #define EOT 4
  75. #define ACK 6
  76. #define NAK 025
  77. #define BDNMCH 0x75
  78. #define OKMNCH ACK
  79. #define TIMEOUT (-1)
  80. #define ERRORMAX 5
  81. #define RETRYMAX 5
  82.  
  83. /* declare all globally used functions not returning int */
  84. char *index(), *cisubstr();
  85.  
  86. FLAG Quiet;
  87. char Ttycol, Lpcol;    /* column for tab expansion */
  88. unsigned Numsecs;    /* Number of 128 byte sectors, used by compsec */
  89. unsigned Numblks;    /* Number of CP/M blocks, used by compsec */
  90. unsigned Numfiles;    /* Total number of files expanded */
  91. unsigned Secpblk;    /* Number of sectors per block */
  92. FLAG Rfile;        /* receiving into a file */
  93. FLAG Tfile;        /* transmitting from a file */
  94. FLAG Batch;        /* Batch (multi-file) xfer */
  95. FLAG Creamfile;        /* true means o.k. to blast old file on rx */
  96. FLAG Txgo;        /* file sending start/stop (XON/XOFF) */
  97. FLAG Dumping;        /* not Squelched ^R */
  98. FLAG Pflag;        /* printing the rx stuff */
  99. FLAG Ctlview;        /* Term function shows control chars as ^char */
  100. FLAG View;    /* View data being transmitted/received if file xfer */
  101. FLAG Echo;    /* Echo modem data back to itself only in chat */
  102. FLAG Hdx;    /* Half Duplex connection -no echo from far end */
  103. FLAG Gototerm;    /* go to term after file xfer */
  104. FLAG Exoneof;    /* exit from term() when finished with file */
  105. /* Following flags affect data as it is written to file, not captured */
  106. FLAG Image;    /* Tell it like it is. */
  107. FLAG Zeof;    /* Terminate data capture & close file on ^Z */
  108. FLAG Squelch;    /* Turn capture on after ^R, off before ^T */
  109. char *Txmoname;        /* asciz string corresponding to Txeoln mode */
  110. FLAG Txeoln;    /* what to do at the end of a line */
  111. #define EOL_NOTHING 0    /* send it all as is */
  112. #define EOL_CR    1        /* send /r only */
  113. #define EOL_NL    2        /* send \n only */
  114. #define EOL_CRWAIT 3    /* send \r then wait for \n echo */
  115. #define EOL_CRPROMPT 4    /* send \r then wait for silence. */
  116. #define TX_BINARY 0200    /* don't stop on CPMEOF or whatever **/
  117.  
  118. /* For controls based on time since last RX char mostly */
  119. unsigned Timeout;    /* measure of how long since last rx char */
  120. unsigned Tpause;    /* when ++Timeout==Tpause, do something ... */
  121. FLAG Xoffflg;        /* !=0 if we sent XOFF to stop the bubble machine */
  122. FLAG Waitecho;        /* Wait for echo to stop when sending file */
  123.  
  124. /* If Waitbunch, Wait for Throttle loops each waitnum tx chars */
  125. FLAG Waitbunch;
  126. unsigned Waitnum;    /* do Waitecho each time chars_sent == Waitnum */
  127. unsigned Throttle;
  128. FLAG Txwait;        /* used with throttle */
  129. unsigned Txtimeout;    /* counted down to 0, then Txwait becomes false */
  130.  
  131. unsigned T1pause;    /* for setting 0.1 second timeout for readline */
  132. char Lastrx;        /* last char received, for detecting CAN CAN */
  133.  
  134. /*
  135.  * start, end, input, output, printer-output pointers and marker
  136.  * used with data capture
  137.  */
  138. char *bufst, *bufend, *bufcq, *bufcdq, *buffcdq, *bufpcdq, *bufmark;
  139. unsigned Free;        /* Number of characters free in capture buf */
  140. unsigned Low;        /* when free==low, send the XOFF */
  141. unsigned Bufsize;
  142. FLAG Wrapped;        /* Circular buffer insertion pointer has wrapped around */
  143. char Dport,Sport;    /* data and status port addresses */
  144. unsigned Baudrate;  /* current baudrate */
  145. FLAG Originate;    /* Originate mode requested */
  146. FLAG Parity;
  147. #define SEND8 0    /* RAW on Unix */
  148. #define NORMAL 1    /* cooked o.k. on Unix */
  149.     /* following would be CBREAK on Unix */
  150. #define EVEN7 2
  151. #define ODD7 3
  152. #define EVEN8 4
  153. #define ODD8 5
  154.  
  155. char cmdbuf[CMDLEN+2], *cp;  /* for commands entered directly (not argv) */
  156. char Rname[PATHLEN], Tname[PATHLEN];    /* saved file names */
  157. char Phone[80];        /* phone number read in from file */
  158.  
  159. /*
  160.  * Unix is a trademark of Western Electric
  161.  * CP/M, Digital Research
  162.  * Coherent, Mark Willams Co., Chicago IL
  163.  * IDRIS, Whitesmiths Co.
  164.  */
  165.  
  166. /*
  167. Some #DEFINES you should know about:
  168.     RESTRICTED disallows downloading of TAG2 files, upload .com>.obj
  169.     LOGFILE logs all file xmsn attempts, also is the file
  170.     TERMRESET string initializes terminal to desired mode
  171.     PHONES file with phone numbers
  172.     FILE means struct _buf for BDS C
  173. */
  174.  pointer has wrapped around */
  175. char Dport,Sport;    /* data and status port addresses */
  176.