home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / atarist / astgcm.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  1KB  |  48 lines

  1. /*
  2.  * astgcm.c generic commands for ATARI ST Kermit
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include "astinc.h"
  7.  
  8. /*
  9.  *      Kermit Quit to Host Server Function
  10.  *
  11.  *      by W. G. Seaton   NASA SC-LPS-32    11/15/84
  12.  *
  13.  * 07/01/85 ral add error handling
  14.  */
  15.  
  16. gencmdsw(cmd)
  17. char cmd;
  18. {
  19.         int     len, num;
  20.         int     retries;
  21.  
  22.         for (retries = 0; retries < MAXTRY; retries++) {
  23.                 packet[0] = cmd;              /* Generic command */
  24.                 spack('G', 0, 1, packet);     /* Send Generic command  */
  25.                 switch(state = rpack(&len, &num, packet)) { /* get response  */
  26.                 case 'Y':
  27.                         if (num == 0) {
  28.                                 return(TRUE);
  29.                         }
  30.                         break;  /* not the ack for this packet */
  31.                 case 'N':       /* remote NAKed packet */
  32.                 case FALSE:     /* timeout or bad packet */
  33.                         nakcnt++;
  34.                         break;
  35.                 case 'A':
  36.                         return(FALSE); /* user abort*/
  37.                 case 'E':
  38.                         prerrpkt(packet);
  39.                         return(FALSE);
  40.                 default:
  41.                         nakcnt++;
  42.                         break;
  43.                 };
  44.              dt_packets(TRUE);
  45.         }
  46.         return(FALSE);
  47. }
  48.