home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / Telecomm / st52.zoo / st52.c < prev    next >
C/C++ Source or Header  |  1991-01-28  |  2KB  |  116 lines

  1. /* Alpha release version */
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <osbind.h>
  7. #include <mintbind.h>
  8. #include <signal.h>
  9. #include "st52.h"
  10.  
  11. #define AUX 1
  12. #define CON 2
  13.  
  14. #define MINTID "MiNT"
  15.  
  16. #define MAXWAIT 1000
  17.  
  18. int
  19. main(int argc, char *argv[], char *envp[])
  20. {
  21.   long mintcookie = 0L;
  22.   int outtran[256];
  23.   int x;
  24.   long key;
  25.   register int gnsrgh = MAXWAIT;
  26.  
  27. #ifdef JUNK
  28.   char *terminal;
  29.   char *etmp;
  30.  
  31.   char *newenv;
  32.  
  33.   etmp = (char *) envp;
  34.  
  35.   
  36.  
  37.   terminal = getenv("TERM");
  38. #ifdef DEBUG
  39.     Cconws("Terminal type:  ");
  40.     puts(terminal);   
  41. #endif
  42.  
  43.   if (strcmp(terminal, "mgr") == 0)
  44.   {
  45.     
  46. #ifdef DEBUG
  47.     puts("yep");
  48.     printf("value: %d\n",   
  49. #else
  50.       (void)
  51. #endif
  52.       Pexec(200, "e:\\mint\\mgr\\bin\\vt52.prg", 
  53.                  "e:\\mint\\mgr\\bin\\vt52.prg st52", envp)
  54. #ifdef DEBUG
  55.                          )
  56. #endif
  57.                           ;
  58.   }
  59.  
  60. #endif /* JUNK */
  61.  
  62.   for (x = 0; x < 256; x++)
  63.     outtran[x] = x;
  64.  
  65.   outtran[127] = 8;
  66.   outtran[8] = 127;
  67.  
  68.   mintcookie = getcookie(MINTID);
  69.  
  70. #ifdef DEBUG
  71.   printf("MiNT cookie %lx detected\n", mintcookie);
  72. #endif
  73.  
  74.   for (;;)
  75.   {
  76.     if (Bconstat(AUX) && gnsrgh--)
  77.     {
  78.       Bconout(CON, (int) Bconin(AUX));
  79.     }
  80.     else
  81.     {
  82.       gnsrgh = MAXWAIT;
  83.       if (Bconstat(CON))
  84.       {
  85.         key = Bconin(CON);
  86. #ifdef DEBUG
  87.         printf("-%lx-\n", key);
  88. #endif
  89.         switch (key)
  90.         {
  91.           case 0x000000E3:  /* alt-c */
  92.           case 0x002E0000:  config();
  93.                             break;
  94.           case 0x000000F1:  /* alt-q */
  95.           case 0x00100000:  Cconws("\n");
  96.                             exit(0);
  97.           case 0x000000FA:  /* alt-z */
  98.           case 0x002C0000:  if (mintcookie)
  99.                             {
  100.                               Cconws("\n");
  101.                               (void) Pkill(Pgetpid(), SIGTSTP);
  102.                             }
  103.                             break;
  104.  
  105.           default:          Bconout(AUX, outtran[(int) (key & KEYMASK)]);
  106.         }
  107.       }
  108.       else
  109.       {
  110.         if (mintcookie)
  111.           (void) Syield();
  112.       }
  113.     }
  114.   }
  115. }
  116.