home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 150 / MODEM5.ZIP / AUTO_D.SLT < prev    next >
Encoding:
Text File  |  1990-05-25  |  3.8 KB  |  115 lines

  1.  
  2. //  This script is to be called by an auto-logon script
  3. //  for the purpose of allowing automatic Puma and DSZ Zmodem
  4. //  downloads.
  5.  
  6. main ()
  7.    {
  8.    str puma_start[] = "^022Puma^022";   // Puma auto-packet
  9.    str dsz_start[] = "**^024";          // Zmodem auto-packet
  10.    str cmd_line[50];                    // Holds the command line
  11.    str port[1], speed[5], e_speed[5];   // Dummy variables
  12.    int p, d, c;                         // More dummy variables
  13.  
  14.    if (_zmod_auto)    // It don't work if Telix beats us to the punch!
  15.       {
  16.          status_wind ("Automatic Zmodem downloads must be deactivated!", 20);
  17.          status_wind ("Script aborting...", 20);
  18.          return;
  19.       }
  20.  
  21.       p = track (puma_start, 0);    // Keep our eyes open for Puma...
  22.       d = track (dsz_start, 0);     // Ditto for Zmodem...
  23.  
  24.    check:
  25.       terminal ();            // So the user can still use Telix...
  26.       if (track_hit (p))      // We've got Puma!
  27.          goto puma;
  28.       if (track_hit (d))      // We've got Zmodem!
  29.          goto dsz;
  30.       goto check;
  31.  
  32.    dsz:
  33.       itos (get_port (), port);  // Build up the command line...
  34.       cmd_line = "port ";
  35.       strcat (cmd_line, port);
  36.       strcat (cmd_line, " speed ");
  37.       itos (get_baud (), speed);
  38.       strcat (cmd_line, speed);
  39.       strcat (cmd_line, " rz -mrr");
  40.       newdir (_down_dir);        // So DSZ dumps the file in the right place
  41.       c = run ("c:\joshua\telix\dsz ", cmd_line, 0);
  42.       if (!c)
  43.          {
  44.             d = track (dsz_start, 0);  // Set the trap again...
  45.             goto check;
  46.          }
  47.       else
  48.          {
  49.             if (c == -1)   // The script couldn't load DSZ.COM
  50.                {
  51.                   status_wind ("Error loading DSZ!  Script aborting...", 20);
  52.                   return;
  53.                }
  54.             else           // DSZ had an error
  55.                {
  56.                   status_wind ("Error in Zmodem download!", 20);
  57.                   d = track (dsz_start, 0);
  58.                   goto check;
  59.                }
  60.          }
  61.  
  62.    puma:
  63.       itos (get_port (), port);
  64.       cmd_line = "P";
  65.       strcat (cmd_line, port);
  66.       strcat (cmd_line, " S");
  67.       itos (get_baud (), speed);
  68.       strcat (cmd_line, speed);
  69.       strcat (cmd_line, " E");
  70.       e_speed = speed;
  71.       if (speed == "19200")      // HST connections...
  72.          e_speed = "9600";
  73.       if (_entry_enum == 1)      // Abiogenetic...
  74.          e_speed = "2400";
  75.       strcat (cmd_line, e_speed);
  76.       strcat (cmd_line, " r ");
  77.       strcat (cmd_line, _down_dir);
  78.       c = run ("c:\joshua\telix\puma ", cmd_line, 0);
  79.       if (!c)
  80.          {
  81.             p = track (puma_start, 0);  // Set the trap again
  82.             goto check;
  83.          }
  84.       else
  85.          {
  86.             if (c == -1)  // Script couldn't load PUMA.EXE
  87.                {
  88.                   status_wind ("Error loading Puma!  Script aborting...", 20);
  89.                   return;
  90.                }
  91.             if (c == 1)
  92.                {
  93.                   status_wind ("Puma transfer aborted!", 20);
  94.                   p = track (puma_start, 0);
  95.                   goto check;
  96.                }
  97.             if (c == 2)  // Session ended before transfer began
  98.                          // (Probably a bogus command line)
  99.                {
  100.                   status_wind ("Local Puma error!  Script aborting...", 20);
  101.                   return;
  102.                }
  103.             if (c == 3)  // Somebody tried to hack Puma
  104.                {
  105.                   status_wind ("Invalid Puma registration!  Script aborting...", 20);
  106.                   return;
  107.                }
  108.             else  // We sent no command line...
  109.                {
  110.                   status_wind ("Script fuckup...", 20);
  111.                   return;
  112.                }
  113.          }
  114.    }
  115.