home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume12 / tek.p1 / tek.patch.1 < prev   
Text File  |  1990-05-14  |  4KB  |  191 lines

  1. *** tek.c.orig    Sun Mar 18 19:44:13 1990
  2. --- tek.c    Fri May 11 12:10:40 1990
  3. ***************
  4. *** 1,6 ****
  5. --- 1,7 ----
  6.   /*
  7.    *  tek.c  
  8.    *  copyright 1988 Ronald Florence
  9. +  *  5.12.90 fixed to restore mode when source is stdin
  10.    *
  11.    *    as "tek" - Tek4014 picture files to CGI or WY99
  12.    *      -w  Accu-Weather maps
  13. ***************
  14. *** 10,20 ****
  15.    *    both:
  16.    *      -p  use plotter or printer (default display)
  17.    *      -a  preserve aspect ratio
  18. !  *
  19. !  *    bugs: SIGINT doesn't work with wy99 modes.  Possible solution is to
  20. !  *    poll terminal on every iteration, with terminal set in raw mode.
  21.    */
  22.   
  23.   #include  <signal.h>
  24.   #include  <stdio.h>
  25.   #include  <termio.h>
  26. --- 11,20 ----
  27.    *    both:
  28.    *      -p  use plotter or printer (default display)
  29.    *      -a  preserve aspect ratio
  30. !  *    -N  N is a single digit: use CGI font #N
  31.    */
  32.   
  33. + #include  <sys/machdep.h>
  34.   #include  <signal.h>
  35.   #include  <stdio.h>
  36.   #include  <termio.h>
  37. ***************
  38. *** 22,27 ****
  39. --- 22,28 ----
  40.   
  41.   #define  int        short        /* for CGI functions    */
  42.   #define     CRT        (wout[45] == 0)
  43. + #define  CGI_FONTS    wout[10]
  44.   #define     To_tek        "\033[?38h"
  45.   #define     To_vt220    "\033[?38l"
  46.   #define     Clr_tek    "\033\f"
  47. ***************
  48. *** 28,35 ****
  49.   #define  Vt_reset    "\033!p"
  50.   
  51.   int    dev;            /* device id */
  52. ! static  int    tty;
  53.   struct  termio new, old;
  54.   static  int  tek;        /* =1 if invoked as tek */
  55.   static  char  *progn;
  56.   static  char  *dspec[] = {"CGIDISP", "CGIPRNT", 0 };
  57. --- 29,37 ----
  58.   #define  Vt_reset    "\033!p"
  59.   
  60.   int    dev;            /* device id */
  61. ! static  int  tty;
  62.   struct  termio new, old;
  63. + static  int  mode;        /* video mode to reset */
  64.   static  int  tek;        /* =1 if invoked as tek */
  65.   static  char  *progn;
  66.   static  char  *dspec[] = {"CGIDISP", "CGIPRNT", 0 };
  67. ***************
  68. *** 44,49 ****
  69. --- 46,52 ----
  70.           h = 0, 
  71.       aspect = 0,        /* map to max CGI space */
  72.       opt = 0,
  73. +     font = 0,
  74.       sig_handle(), quit_wyse();
  75.       char    *device, *p, *getenv(), *strrchr(); 
  76.   
  77. ***************
  78. *** 74,79 ****
  79. --- 77,93 ----
  80.       case 'a' :
  81.         aspect = 3;
  82.         break;
  83. +     case '1':
  84. +     case '2':
  85. +     case '3':
  86. +     case '4':
  87. +     case '5':
  88. +     case '6':
  89. +     case '7':
  90. +     case '8':
  91. +     case '9':
  92. +       font = *p - '0';
  93. +       break;
  94.       default :
  95.         usage();
  96.       }
  97. ***************
  98. *** 89,94 ****
  99. --- 103,111 ----
  100.     tty = open("/dev/tty", O_RDWR);
  101.     ioctl(tty, TCGETA, &new);
  102.     ioctl(tty, TCGETA, &old);
  103. +                 /* get the current video mode */
  104. +   mode = ioctl(tty, CONS_GET, 0);
  105.                   /* wyse 99 terminal? */
  106.     if (!h && !strncmp(getenv("TERM"), "wy99", 4))
  107.       {
  108. ***************
  109. *** 134,139 ****
  110. --- 151,159 ----
  111.         printf("%s: error %d opening %s\n", progn, -vq_error(), device);
  112.         exit (-1);
  113.       }    
  114. +   if (font > 0 && font <= CGI_FONTS)
  115. +     vst_font(dev, font);
  116.     if (tek)
  117.       tekdecode(fi, opt);
  118.     else
  119. ***************
  120. *** 141,152 ****
  121.     if (CRT)  
  122.       getkey();
  123.     v_clswk(dev);
  124.   }
  125.   
  126.   
  127.   usage ()
  128.   {
  129. !   printf("usage: %s file\n", tek ? "tek [-wpa]" : "poly [-spa]");
  130.     exit (-1);
  131.   }
  132.   
  133. --- 161,174 ----
  134.     if (CRT)  
  135.       getkey();
  136.     v_clswk(dev);
  137. +   if (CRT && fi == stdin)
  138. +     ioctl(tty, (MODESWITCH | mode), 0);
  139.   }
  140.   
  141.   
  142.   usage ()
  143.   {
  144. !   printf("usage: %s [-N] file\n", tek ? "tek [-wpa]" : "poly [-spa]");
  145.     exit (-1);
  146.   }
  147.   
  148. *** tek.man.orig    Fri May 11 12:58:44 1990
  149. --- tek.man    Fri May 11 13:02:22 1990
  150. ***************
  151. *** 8,13 ****
  152. --- 8,15 ----
  153.   [
  154.   .I -wap
  155.   ] [
  156. + .I -N
  157. + ] [
  158.   .I file
  159.   ]
  160.   .br
  161. ***************
  162. *** 15,20 ****
  163. --- 17,24 ----
  164.   [
  165.   .I -sap
  166.   ] [
  167. + .I -N
  168. + ] [
  169.   .I file
  170.   ]
  171.   .SH DESCRIPTION
  172. ***************
  173. *** 60,65 ****
  174. --- 64,77 ----
  175.   be specified by declaring a (non-null)
  176.   .SM ASPECT 
  177.   environment variable.  
  178. + .PP
  179. + The 
  180. + .I -N
  181. + option, where 
  182. + .I N 
  183. + is a digit from 1 to 9, is used to specify the CGI graphics font used by
  184. + .I tek.
  185. + The fonts are system and device dependent.
  186.   .SH BUGS
  187.   The available type sizes on CGI output devices may not match the
  188.   Tektronics display.  The interactive Tektronics input functions are
  189.