home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume1 / pcurses / part09 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  53.9 KB

  1. Subject:  Terminfo/Curses Part 9 of 11
  2.  
  3. : Run this shell script with "sh" not "csh"
  4. PATH=:/bin:/usr/bin:/usr/ucb
  5. export PATH
  6. if test ! -d =src
  7. then
  8.     echo 'Making directory "=src"'
  9.     mkdir =src
  10. fi
  11. echo 'x - =src/lib_tputs.c'
  12. sed 's/^X//' <<'//go.sysin dd *' >=src/lib_tputs.c
  13. X/*********************************************************************
  14. *                         COPYRIGHT NOTICE                           *
  15. **********************************************************************
  16. *        This software is copyright (C) 1982 by Pavel Curtis         *
  17. *                                                                    *
  18. *        Permission is granted to reproduce and distribute           *
  19. *        this file by any means so long as no fee is charged         *
  20. *        above a nominal handling fee and so long as this            *
  21. *        notice is always included in the copies.                    *
  22. *                                                                    *
  23. *        Other rights are reserved except as explicitly granted      *
  24. *        by written permission of the author.                        *
  25. *                Pavel Curtis                                        *
  26. *                Computer Science Dept.                              *
  27. *                405 Upson Hall                                      *
  28. *                Cornell University                                  *
  29. *                Ithaca, NY 14853                                    *
  30. *                                                                    *
  31. *                Ph- (607) 256-4934                                  *
  32. *                                                                    *
  33. *                Pavel.Cornell@Udel-Relay   (ARPAnet)                *
  34. *                decvax!cornell!pavel       (UUCPnet)                *
  35. *********************************************************************/
  36.  
  37. X/*
  38.  *    tputs.c
  39.  *
  40.  *  $Log:    lib_tputs.c,v $
  41.  * Revision 3.1  84/12/13  11:21:03  john
  42.  * Revisions by Mark Horton
  43.  * 
  44.  * Revision 2.1  82/10/25  14:49:31  pavel
  45.  * Added Copyright Notice
  46.  * 
  47.  * Revision 2.0  82/10/24  15:18:06  pavel
  48.  * Beta-one Test Release
  49.  * 
  50.  * Revision 1.3  82/08/23  22:30:52  pavel
  51.  * The REAL Alpha-one Release Version
  52.  * 
  53.  * Revision 1.2  82/08/19  19:11:38  pavel
  54.  * Alpha Test Release One
  55.  * 
  56.  * Revision 1.1  82/08/12  18:46:00  pavel
  57.  * Initial revision
  58.  * 
  59.  *
  60.  */
  61.  
  62. static char RCSid[] =
  63.     "$Header: lib_tputs.c,v 3.1 84/12/13 11:21:03 john Exp $";
  64.  
  65. #include <ctype.h>
  66. #include <stdio.h>
  67. #include "curses.h"
  68. #include "curses.priv.h"
  69. #include "term.h"
  70.  
  71.  
  72. tputs(string, affcnt, outc)
  73. char    *string;
  74. int    affcnt;
  75. int    (*outc)();
  76. {
  77.     float    number;
  78.     int    baud = baudrate();
  79.     char    null = '\0';
  80.     int    i;
  81.  
  82. #ifdef TRACE
  83.     if (_tracing)
  84.         _tracef("tputs(%s,%d,%o) called", string, affcnt, outc);
  85. #endif
  86.  
  87.     if (pad_char)
  88.         null = pad_char[0];
  89.  
  90.     while (*string)
  91.     {
  92.         if (*string != '$')
  93.         (*outc)(*string);
  94.         else
  95.         {
  96.         string++;
  97.         if (*string != '<')
  98.         {
  99.             (*outc)('$');
  100.             (*outc)(*string);
  101.         }
  102.         else
  103.         {
  104.  
  105.             number = 0;
  106.             string++;
  107.  
  108.             if (!isdigit(*string) && *string != '.' || !index(string, '>')) {
  109.             (*outc)('$');
  110.             (*outc)('<');
  111.             continue;
  112.             }
  113.             while (isdigit(*string))
  114.             {
  115.             number = number * 10 + *string - '0';
  116.             string++;
  117.             }
  118.  
  119.             if (*string == '.')
  120.             {
  121.             string++;
  122.             if (isdigit(*string))
  123.             {
  124.                 number += (float) (*string - '0') / 10.;
  125.                 string++;
  126.             }
  127.             }
  128.  
  129.             if (*string == '*')
  130.             {
  131.             number *= affcnt;
  132.             string++;
  133.             }
  134.  
  135.             if (padding_baud_rate  &&  baud >= padding_baud_rate && !xon_xoff)
  136.             {
  137.             number = ((baud / 10.) * number) / 1000.;
  138.             
  139.             for (i=0; i < number; i++)
  140.                 (*outc)(null);
  141.             }
  142.  
  143.         } /* endelse (*string == '<') */
  144.         } /* endelse (*string == '$') */
  145.  
  146.         if (*string == '\0')
  147.         break;
  148.  
  149.         string++;
  150.     }
  151. }
  152.  
  153.  
  154. void
  155. _outc(ch)
  156. {
  157.     putchar(ch);
  158. }
  159.  
  160.  
  161. putp(string)
  162. {
  163. #ifdef TRACE
  164.     if (_tracing)
  165.         _tracef("putp(%s) called", string);
  166. #endif
  167.     tputs(string, 1, _outc);
  168. }
  169. //go.sysin dd *
  170. echo 'x - =src/lib_trace.c'
  171. sed 's/^X//' <<'//go.sysin dd *' >=src/lib_trace.c
  172. X/*********************************************************************
  173. *                         COPYRIGHT NOTICE                           *
  174. **********************************************************************
  175. *        This software is copyright (C) 1982 by Pavel Curtis         *
  176. *                                                                    *
  177. *        Permission is granted to reproduce and distribute           *
  178. *        this file by any means so long as no fee is charged         *
  179. *        above a nominal handling fee and so long as this            *
  180. *        notice is always included in the copies.                    *
  181. *                                                                    *
  182. *        Other rights are reserved except as explicitly granted      *
  183. *        by written permission of the author.                        *
  184. *                Pavel Curtis                                        *
  185. *                Computer Science Dept.                              *
  186. *                405 Upson Hall                                      *
  187. *                Cornell University                                  *
  188. *                Ithaca, NY 14853                                    *
  189. *                                                                    *
  190. *                Ph- (607) 256-4934                                  *
  191. *                                                                    *
  192. *                Pavel.Cornell@Udel-Relay   (ARPAnet)                *
  193. *                decvax!cornell!pavel       (UUCPnet)                *
  194. *********************************************************************/
  195.  
  196. X/*
  197.  *    lib_trace.c - Tracing/Debugging routines
  198.  *
  199.  *  $Log:    RCS/lib_trace.v $
  200.  * Revision 2.1  82/10/25  14:49:35  pavel
  201.  * Added Copyright Notice
  202.  * 
  203.  * Revision 2.0  82/10/24  15:18:09  pavel
  204.  * Beta-one Test Release
  205.  * 
  206.  * Revision 1.3  82/08/23  22:30:57  pavel
  207.  * The REAL Alpha-one Release Version
  208.  * 
  209.  * Revision 1.2  82/08/19  19:11:41  pavel
  210.  * Alpha Test Release One
  211.  * 
  212.  * Revision 1.1  82/08/15  17:59:45  pavel
  213.  * Initial revision
  214.  * 
  215.  *
  216.  */
  217.  
  218. static char RCSid[] =
  219.     "$Header:   RCS/lib_trace.v  Revision 2.1  82/10/25  14:49:35  pavel  Exp$";
  220.  
  221. #include "term.h"
  222. #include "curses.h"
  223. #include "curses.priv.h"
  224.  
  225.  
  226. static int    tracefd;
  227.  
  228. _init_trace()
  229. {
  230.         static int    been_here = 0;
  231.     extern int    errno;
  232.     extern char    *sys_errlist[];
  233.  
  234.     if (! been_here)
  235.     {
  236.         been_here = 1;
  237.  
  238.         if ((tracefd = creat("trace", 0644)) < 0)
  239.         {
  240.         write(2, "curses: Can't open 'trace' file: ", 33);
  241.         write(2, sys_errlist[errno], strlen(sys_errlist[errno]));
  242.         write(2, "\n", 1);
  243.         exit(1);
  244.         }
  245.     }
  246. }
  247.  
  248.  
  249. traceon()
  250. {
  251.     _tracef("traceon() called");
  252.  
  253.         _tracing = 1;
  254. }
  255.  
  256.  
  257. traceoff()
  258. {
  259.     _tracef("traceoff() called");
  260.  
  261.         _tracing = 0;
  262. }
  263.  
  264.  
  265. _tracef(fmt, args)
  266. char    *fmt;
  267. int    args;
  268. {
  269.         int    *parm = &args;
  270.     char    buffer[256];
  271.     char    *bufp = buffer;
  272.  
  273.     while (*fmt)
  274.     {
  275.         if (*fmt == '%')
  276.         {
  277.         fmt++;
  278.         switch (*fmt)
  279.         {
  280.             case 'd':
  281.             addnum(&bufp, *(parm++), 10);
  282.             break;
  283.  
  284.             case 'o':
  285.             addnum(&bufp, *(parm++), 8);
  286.             break;
  287.  
  288.             case 'c':
  289.             *(bufp++) = *(parm++);
  290.             break;
  291.  
  292.             case 's':
  293.             if (*parm)
  294.             {
  295.                 *(bufp++) = '"';
  296.                 strcpy(bufp, *parm);
  297.                 bufp += strlen(*parm);
  298.                 *(bufp++) = '"';
  299.             }
  300.             else
  301.             {
  302.                 strcpy(bufp, "NULL");
  303.                 bufp += 4;
  304.             }
  305.             parm++;
  306.             break;
  307.         }
  308.         }
  309.         else
  310.         *(bufp++) = *fmt;
  311.  
  312.         fmt++;
  313.     }
  314.  
  315.     *(bufp++) = '\n';
  316.     *bufp = '\0';
  317.     write(tracefd, buffer, strlen(buffer));
  318. }
  319.  
  320.  
  321. static addnum(bufp, num, base)
  322. char    **bufp;
  323. int    num, base;
  324. {
  325.     int    a;
  326.  
  327.         if (num < 0)
  328.     {
  329.         num = -num;
  330.         *((*bufp)++) = '-';
  331.     }
  332.  
  333.     if ((a = num / base) != 0)
  334.         addnum(bufp, a, base);
  335.     *((*bufp)++) = '0' + (num % base);
  336. }
  337. //go.sysin dd *
  338. echo 'x - =src/lib_tstp.c'
  339. sed 's/^X//' <<'//go.sysin dd *' >=src/lib_tstp.c
  340. X/*********************************************************************
  341. *                         COPYRIGHT NOTICE                           *
  342. **********************************************************************
  343. *        This software is copyright (C) 1982 by Pavel Curtis         *
  344. *                                                                    *
  345. *        Permission is granted to reproduce and distribute           *
  346. *        this file by any means so long as no fee is charged         *
  347. *        above a nominal handling fee and so long as this            *
  348. *        notice is always included in the copies.                    *
  349. *                                                                    *
  350. *        Other rights are reserved except as explicitly granted      *
  351. *        by written permission of the author.                        *
  352. *                Pavel Curtis                                        *
  353. *                Computer Science Dept.                              *
  354. *                405 Upson Hall                                      *
  355. *                Cornell University                                  *
  356. *                Ithaca, NY 14853                                    *
  357. *                                                                    *
  358. *                Ph- (607) 256-4934                                  *
  359. *                                                                    *
  360. *                Pavel.Cornell@Udel-Relay   (ARPAnet)                *
  361. *                decvax!cornell!pavel       (UUCPnet)                *
  362. *********************************************************************/
  363.  
  364. X/*
  365. **    lib_tstp.c
  366. **
  367. **    The routine tstp().
  368. **
  369. ** $Log:    RCS/lib_tstp.v $
  370.  * Revision 2.1  82/10/25  14:49:39  pavel
  371.  * Added Copyright Notice
  372.  * 
  373.  * Revision 2.0  82/10/25  13:50:01  pavel
  374.  * Beta-one Test Release
  375.  * 
  376. **
  377. */
  378.  
  379. static char RCSid[] =
  380.     "$Header:   RCS/lib_tstp.v  Revision 2.1  82/10/25  14:49:39  pavel  Exp$";
  381.  
  382. #include "term.h"
  383. #include "curses.h"
  384. #include "curses.priv.h"
  385. #include <signal.h>
  386.  
  387.  
  388. static
  389. outc(ch)
  390. char    ch;
  391. {
  392.         putc(ch, SP->_ofp);
  393. }
  394.  
  395.  
  396. tstp()
  397. {
  398. #ifdef TRACE
  399.     if (_tracing)
  400.         _tracef("tstp() called");
  401. #endif
  402.  
  403.     endwin();
  404.  
  405.     kill(0, SIGTSTP);
  406.     signal(SIGTSTP, tstp);
  407.  
  408.     fixterm();
  409.     flushinp();
  410.     tputs(enter_ca_mode, 1, outc);
  411.     wrefresh(curscr);
  412. }
  413. //go.sysin dd *
  414. echo 'x - =src/lib_unctrl.c'
  415. sed 's/^X//' <<'//go.sysin dd *' >=src/lib_unctrl.c
  416. X/*********************************************************************
  417. *                         COPYRIGHT NOTICE                           *
  418. **********************************************************************
  419. *        This software is copyright (C) 1982 by Pavel Curtis         *
  420. *                                                                    *
  421. *        Permission is granted to reproduce and distribute           *
  422. *        this file by any means so long as no fee is charged         *
  423. *        above a nominal handling fee and so long as this            *
  424. *        notice is always included in the copies.                    *
  425. *                                                                    *
  426. *        Other rights are reserved except as explicitly granted      *
  427. *        by written permission of the author.                        *
  428. *                Pavel Curtis                                        *
  429. *                Computer Science Dept.                              *
  430. *                405 Upson Hall                                      *
  431. *                Cornell University                                  *
  432. *                Ithaca, NY 14853                                    *
  433. *                                                                    *
  434. *                Ph- (607) 256-4934                                  *
  435. *                                                                    *
  436. *                Pavel.Cornell@Udel-Relay   (ARPAnet)                *
  437. *                decvax!cornell!pavel       (UUCPnet)                *
  438. *********************************************************************/
  439.  
  440. X/*
  441.  * define unctrl codes for each character
  442.  *
  443.  *  $Log:    RCS/lib_unctrl.v $
  444.  * Revision 2.1  82/10/25  14:49:42  pavel
  445.  * Added Copyright Notice
  446.  * 
  447.  * Revision 2.0  82/10/24  15:18:12  pavel
  448.  * Beta-one Test Release
  449.  * 
  450.  * Revision 1.3  82/08/23  22:31:04  pavel
  451.  * The REAL Alpha-one Release Version
  452.  * 
  453.  * Revision 1.2  82/08/19  19:11:43  pavel
  454.  * Alpha Test Release One
  455.  * 
  456.  * Revision 1.1  82/08/12  18:46:42  pavel
  457.  * Initial revision
  458.  * 
  459.  *
  460.  */
  461.  
  462. static char RCSid[] =
  463.     "$Header:   RCS/lib_unctrl.v  Revision 2.1  82/10/25  14:49:42  pavel  Exp$";
  464.  
  465. X/* LINTLIBRARY */
  466. char    *_unctrl[]    = {    /* unctrl codes for ttys        */
  467.     "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K",
  468.     "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
  469.     "^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_",
  470.     " ", "!", "\"", "#", "$",  "%", "&", "'", "(", ")", "*", "+", ",", "-",
  471.     ".", "/", "0",  "1", "2",  "3", "4", "5", "6", "7", "8", "9", ":", ";",
  472.     "<", "=", ">",  "?", "@",  "A", "B", "C", "D", "E", "F", "G", "H", "I",
  473.     "J", "K", "L",  "M", "N",  "O", "P", "Q", "R", "S", "T", "U", "V", "W",
  474.     "X", "Y", "Z",  "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
  475.     "f", "g", "h",  "i", "j",  "k", "l", "m", "n", "o", "p", "q", "r", "s",
  476.     "t", "u", "v",  "w", "x",  "y", "z", "{", "|", "}", "~", "^?"
  477. };
  478. //go.sysin dd *
  479. echo 'x - =src/lib_vidattr.c'
  480. sed 's/^X//' <<'//go.sysin dd *' >=src/lib_vidattr.c
  481. X/*********************************************************************
  482. *                         COPYRIGHT NOTICE                           *
  483. **********************************************************************
  484. *        This software is copyright (C) 1982 by Pavel Curtis         *
  485. *                                                                    *
  486. *        Permission is granted to reproduce and distribute           *
  487. *        this file by any means so long as no fee is charged         *
  488. *        above a nominal handling fee and so long as this            *
  489. *        notice is always included in the copies.                    *
  490. *                                                                    *
  491. *        Other rights are reserved except as explicitly granted      *
  492. *        by written permission of the author.                        *
  493. *                Pavel Curtis                                        *
  494. *                Computer Science Dept.                              *
  495. *                405 Upson Hall                                      *
  496. *                Cornell University                                  *
  497. *                Ithaca, NY 14853                                    *
  498. *                                                                    *
  499. *                Ph- (607) 256-4934                                  *
  500. *                                                                    *
  501. *                Pavel.Cornell@Udel-Relay   (ARPAnet)                *
  502. *                decvax!cornell!pavel       (UUCPnet)                *
  503. *********************************************************************/
  504.  
  505. X/*
  506.  *    vidputs(newmode, outc)
  507.  *
  508.  *    newmode is taken to be the logical 'or' of the symbols in curses.h
  509.  *    representing graphic renditions.  The teminal is set to be in all of
  510.  *    the given modes, if possible.
  511.  *
  512.  *    if set-attributes exists
  513.  *        use it to set exactly what you want
  514.  *    else
  515.  *        if exit-attribute-mode exists
  516.  *            turn off everything
  517.  *        else
  518.  *            turn off those which can be turned off and aren't in
  519.  *            newmode.
  520.  *        turn on each mode which should be on and isn't, one by one
  521.  *
  522.  *    NOTE that this algorithm won't achieve the desired mix of attributes
  523.  *    in some cases, but those are probably just those cases in which it is
  524.  *    actually impossible, anyway, so...
  525.  *
  526.  *  $Log:    RCS/lib_vidattr.v $
  527.  * Revision 2.1  82/10/25  14:49:45  pavel
  528.  * Added Copyright Notice
  529.  * 
  530.  * Revision 2.0  82/10/24  15:18:15  pavel
  531.  * Beta-one Test Release
  532.  * 
  533.  * Revision 1.3  82/08/23  22:31:08  pavel
  534.  * The REAL Alpha-one Release Version
  535.  * 
  536.  * Revision 1.2  82/08/19  19:11:46  pavel
  537.  * Alpha Test Release One
  538.  * 
  539.  * Revision 1.1  82/08/12  18:48:23  pavel
  540.  * Initial revision
  541.  * 
  542.  *
  543.  */
  544.  
  545. static char RCSid[] =
  546.     "$Header:   RCS/lib_vidattr.v  Revision 2.1  82/10/25  14:49:45  pavel  Exp$";
  547.  
  548. #include "curses.h"
  549. #include "curses.priv.h"
  550. #include "term.h"
  551.  
  552.  
  553. vidputs(newmode, outc)
  554. unsigned newmode;
  555. int     (*outc)();
  556. {
  557.     static unsigned        previous_attr = 0;
  558.            unsigned        turn_off, turn_on;
  559.  
  560. #ifdef TRACE
  561.     if (_tracing)
  562.         _tracef("vidputs(%o,%o) called", newmode, outc);
  563. #endif
  564.  
  565.     if (set_attributes)
  566.     {
  567.         tputs(tparm(set_attributes,
  568.             (newmode & A_STANDOUT) != 0,
  569.             (newmode & A_UNDERLINE) != 0,
  570.             (newmode & A_REVERSE) != 0,
  571.             (newmode & A_BLINK) != 0,
  572.             (newmode & A_DIM) != 0,
  573.             (newmode & A_BOLD) != 0,
  574.             (newmode & A_INVIS) != 0,
  575.             (newmode & A_PROTECT) != 0,
  576.             (newmode & A_ALTCHARSET) != 0), 1, outc);
  577.     }
  578.     else
  579.     {
  580.         if (exit_attribute_mode)
  581.         tputs(exit_attribute_mode, 1, outc);
  582.         else
  583.         {
  584.         turn_off = ~newmode & previous_attr;
  585.  
  586.         if ((turn_off & A_UNDERLINE)  &&  exit_underline_mode)
  587.             tputs(exit_underline_mode, 1, outc);
  588.  
  589.         if ((turn_off & A_STANDOUT)  &&  exit_standout_mode)
  590.             tputs(exit_standout_mode, 1, outc);
  591.  
  592.         if ((turn_off & A_ALTCHARSET)  &&  exit_alt_charset_mode)
  593.             tputs(exit_alt_charset_mode, 1, outc);
  594.         }
  595.  
  596.         turn_on = newmode & ~previous_attr;
  597.  
  598.         if ((turn_on & A_ALTCHARSET)  &&  enter_alt_charset_mode)
  599.         tputs(enter_alt_charset_mode, 1, outc);
  600.  
  601.         if ((turn_on & A_BLINK)  &&  enter_blink_mode)
  602.         tputs(enter_blink_mode, 1, outc);
  603.  
  604.         if ((turn_on & A_BOLD)  &&  enter_bold_mode)
  605.         tputs(enter_bold_mode, 1, outc);
  606.  
  607.         if ((turn_on & A_INVIS)  &&  enter_secure_mode)
  608.         tputs(enter_secure_mode, 1, outc);
  609.  
  610.         if ((turn_on & A_DIM)  &&  enter_dim_mode)
  611.         tputs(enter_dim_mode, 1, outc);
  612.  
  613.         if ((turn_on & A_PROTECT)  &&  enter_protected_mode)
  614.         tputs(enter_protected_mode, 1, outc);
  615.  
  616.         if ((turn_on & A_REVERSE)  &&  enter_reverse_mode)
  617.         tputs(enter_reverse_mode, 1, outc);
  618.  
  619.         if ((turn_on & A_STANDOUT)  &&  enter_standout_mode)
  620.         tputs(enter_standout_mode, 1, outc);
  621.  
  622.         if ((turn_on & A_UNDERLINE)  &&  enter_underline_mode)
  623.         tputs(enter_underline_mode, 1, outc);
  624.     }
  625.  
  626.     previous_attr = newmode;
  627. }
  628.  
  629.  
  630.  
  631. vidattr(newmode)
  632. unsigned    newmode;
  633. {
  634.     void    _outc();
  635.  
  636. #ifdef TRACE
  637.     if (_tracing)
  638.         _tracef("vidattr(%o) called", newmode);
  639. #endif
  640.  
  641.     vidputs(newmode, _outc);
  642. }
  643. //go.sysin dd *
  644. echo 'x - =src/read_entry.c'
  645. sed 's/^X//' <<'//go.sysin dd *' >=src/read_entry.c
  646. X/*********************************************************************
  647. *                         COPYRIGHT NOTICE                           *
  648. **********************************************************************
  649. *        This software is copyright (C) 1982 by Pavel Curtis         *
  650. *                                                                    *
  651. *        Permission is granted to reproduce and distribute           *
  652. *        this file by any means so long as no fee is charged         *
  653. *        above a nominal handling fee and so long as this            *
  654. *        notice is always included in the copies.                    *
  655. *                                                                    *
  656. *        Other rights are reserved except as explicitly granted      *
  657. *        by written permission of the author.                        *
  658. *                Pavel Curtis                                        *
  659. *                Computer Science Dept.                              *
  660. *                405 Upson Hall                                      *
  661. *                Cornell University                                  *
  662. *                Ithaca, NY 14853                                    *
  663. *                                                                    *
  664. *                Ph- (607) 256-4934                                  *
  665. *                                                                    *
  666. *                Pavel.Cornell@Udel-Relay   (ARPAnet)                *
  667. *                decvax!cornell!pavel       (UUCPnet)                *
  668. *********************************************************************/
  669.  
  670. X/*
  671.  *    read_entry.c -- Routine for reading in a compiled terminfo file
  672.  *
  673.  *  $Log:    read_entry.c,v $
  674.  * Revision 3.1  84/12/13  11:21:14  john
  675.  * Revisions by Mark Horton
  676.  * 
  677.  * Revision 2.1  82/10/25  14:49:55  pavel
  678.  * Added Copyright Notice
  679.  * 
  680.  * Revision 2.0  82/10/24  15:18:22  pavel
  681.  * Beta-one Test Release
  682.  * 
  683.  * Revision 1.3  82/08/23  22:31:15  pavel
  684.  * The REAL Alpha-one Release Version
  685.  * 
  686.  * Revision 1.2  82/08/19  19:11:49  pavel
  687.  * Alpha Test Release One
  688.  * 
  689.  * Revision 1.1  82/08/12  22:25:13  pavel
  690.  * Initial revision
  691.  * 
  692.  *
  693.  */
  694.  
  695. static char RCSid[] =
  696.     "$Header: read_entry.c,v 3.1 84/12/13 11:21:14 john Exp $";
  697.  
  698. #include <sys/types.h>
  699. #include <sys/stat.h>
  700. #include "term.h"
  701. #include "object.h"
  702.  
  703. #define OFFSET_BUFSIZE    100
  704.  
  705. #define min(a, b)    ((a) > (b)  ?  (b)  :  (a))
  706.  
  707. X/*
  708.  *    int
  709.  *    read_entry(filename, ptr)
  710.  *
  711.  *    Read the compiled terminfo entry in the given file into the
  712.  *    structure pointed to by ptr, allocating space for the string
  713.  *    table and placing its address in ptr->str_table.
  714.  *
  715.  */
  716.  
  717. #define swap(x)        (((x >> 8) & 0377) + 256 * (x & 0377))
  718.  
  719. static char    TermNames[128];    /* Buffer for terminal names for first term */
  720. static char    StringTable[1024];    /* String table for first terminal  */
  721.  
  722. int
  723. read_entry(filename, ptr)
  724. char        *filename;
  725. struct term    *ptr;
  726. {
  727.     struct stat    statbuf;
  728.     int        fd;
  729.     int        numread;
  730.     int        num_strings;
  731.     int        cur_string;
  732.     char        *malloc();
  733.     int        i;
  734.     struct header    header;
  735.     unsigned char    bytebuf[2];
  736.     char        ch;
  737.     union
  738.     {
  739.         unsigned char    byte[2];
  740.         short            number;
  741.     }        offset_buf[OFFSET_BUFSIZE];
  742.  
  743.     fd = open(filename, 0);
  744.  
  745.     if (fd < 0)
  746.         return(-1);
  747.  
  748.     read(fd, &header, sizeof(header));
  749.  
  750.     if (must_swap())
  751.     {
  752.         header.magic = swap(header.magic);
  753.         header.name_size = swap(header.name_size);
  754.         header.bool_count = swap(header.bool_count);
  755.         header.num_count = swap(header.num_count);
  756.         header.str_count = swap(header.str_count);
  757.         header.str_size = swap(header.str_size);
  758.     }
  759.  
  760.     if (header.magic != MAGIC)
  761.     {
  762.         close(fd);
  763.         return(-1);
  764.     }
  765.  
  766.     read(fd, TermNames, min(127, header.name_size));
  767.     TermNames[127] = '\0';
  768.     ptr->term_names = TermNames;
  769.     if (header.name_size > 127)
  770.         lseek(fd, (long) (header.name_size - 127), 1);
  771.  
  772.     read(fd, ptr->Booleans, min(BOOLCOUNT, header.bool_count));
  773.     if (header.bool_count > BOOLCOUNT)
  774.         lseek(fd, (long) (header.bool_count - BOOLCOUNT), 1);
  775.     else
  776.         for (i=header.bool_count; i < BOOLCOUNT; i++)
  777.         ptr->Booleans[i] = 0;
  778.  
  779.     if ((header.name_size + header.bool_count) % 2 != 0)
  780.         read(fd, &ch, 1);
  781.  
  782.     if (must_swap())
  783.         read(fd, ptr->Numbers, min(NUMCOUNT, header.num_count * 2));
  784.     else
  785.     {
  786.         for (i=0; i < min(header.num_count, NUMCOUNT); i++)
  787.         {
  788.         read(fd, bytebuf, 2);
  789.         if (bytebuf[0] == 0377  &&  bytebuf[1] == 0377)
  790.             ptr->Numbers[i] = -1;
  791.         else
  792.             ptr->Numbers[i] = bytebuf[0] + 256 * bytebuf[1];
  793.         }
  794.     }
  795.  
  796.     if (header.num_count > NUMCOUNT)
  797.         lseek(fd, (long) (2 * (header.num_count - NUMCOUNT)), 1);
  798.     else
  799.         for (i=header.num_count; i < NUMCOUNT; i++)
  800.         ptr->Numbers[i] = -1;
  801.  
  802.     if (cur_term)    /* cur_term is non-zero only if we've been called */
  803.     {
  804.         ptr->str_table = malloc(header.str_size);
  805.         if (ptr->str_table == NULL)
  806.         {
  807.         close(fd);
  808.         return (-1);
  809.         }
  810.     }
  811.     else
  812.         ptr->str_table = StringTable;
  813.  
  814.     num_strings = min(STRCOUNT, header.str_count);
  815.     cur_string = 0;
  816.  
  817.     while (num_strings > 0)
  818.     {
  819.         numread = read(fd, offset_buf, 2*min(num_strings, OFFSET_BUFSIZE));
  820.         if (numread <= 0)
  821.         {
  822.         close(fd);
  823.         return(-1);
  824.         }
  825.  
  826.         if (must_swap())
  827.         {
  828.         for (i = 0; i < numread / 2; i++)
  829.         {
  830.             ptr->Strings[i + cur_string] =
  831.             (offset_buf[i].byte[0] == 0377
  832.                         &&  offset_buf[i].byte[1] == 0377)
  833.             ? 0
  834.             : ((offset_buf[i].byte[0] + 256*offset_buf[i].byte[1])
  835.                                   + ptr->str_table);
  836.         }
  837.         }
  838.         else
  839.         {
  840.         for (i = 0; i < numread / 2; i++)
  841.         {
  842.             ptr->Strings[i + cur_string] =
  843.             (offset_buf[i].number == -1)
  844.             ?
  845.                 0
  846.             :
  847.                 offset_buf[i].number + ptr->str_table;
  848.         }
  849.         }
  850.  
  851.         cur_string += numread / 2;
  852.         num_strings -= numread / 2;
  853.     }
  854.  
  855.     if (header.str_count > STRCOUNT)
  856.         lseek(fd, (long) (2 * (header.str_count - STRCOUNT)), 1);
  857.     else
  858.         for (i=header.str_count; i < STRCOUNT; i++)
  859.         ptr->Strings[i] = 0;
  860.  
  861.     numread = read(fd, ptr->str_table, header.str_size);
  862.     close(fd);
  863.     if (numread != header.str_size)
  864.         return(-1);
  865.  
  866.     return(0);
  867. }
  868.  
  869.  
  870.  
  871. X/*
  872.  *    int
  873.  *    must_swap()
  874.  *
  875.  *    Test whether this machine will need byte-swapping
  876.  *
  877.  */
  878.  
  879. int
  880. must_swap()
  881. {
  882.     union
  883.     {
  884.         short num;
  885.         char  byte[2];
  886.     }        test;
  887.  
  888.     test.num = 1;
  889.     return(test.byte[1]);
  890. }
  891. //go.sysin dd *
  892. echo 'x - =src/xx.ti'
  893. sed 's/^X//' <<'//go.sysin dd *' >=src/xx.ti
  894. xaa-a|foobar a,
  895.     cud1=ctrlK, cub1=ctrlH, cuf1=esc[C, cuu1=esc[A,
  896.     use=ansi+local,
  897.     clear=esc[Hesc[J$<156>, el=esc[K$<5>, ed=esc[J,
  898. xaa-b,
  899.     is1=esc[7mesc7esc[Hesc9esc8,
  900. xaa-c|foobar c,
  901.     is2=\r\nesc[Aesc7esc[60;1;0;30pesc8, lines#29,
  902.     use=xaa-a,
  903. xaa-d|foobar d,
  904.     use=xaa-b, use=xaa-c,
  905. xaa-e|foobar e,
  906.     smcup=esc[30;1Hesc[Kesc[30;1;0;30p,
  907.     use=xaa-d,
  908. xaa-f,
  909.     cup=esc[%i%p1%d;%p2%dH, home=esc[H, bold=esc[1m,
  910. //go.sysin dd *
  911. if test ! -d =data
  912. then
  913.     echo 'Making directory "=data"'
  914.     mkdir =data
  915. fi
  916. echo 'x - =data/misc'
  917. sed 's/^X//' <<'//go.sysin dd *' >=data/misc
  918. #  # --------------------------------
  919. #    @(#)misc    1.8    5/20/82
  920. #
  921. # misc: MISCELLANEOUS TERMINALS
  922. #
  923. # ----------------------------------------------------------------
  924. #
  925. # BB&N BitGraph
  926. # The function keys kf0-kf9 are the codes generated by the keypad keys 0-9
  927. # NOTE that this means that PF1-PF4 are not represented here at all.
  928. bg|bitg|bitgraph|BBN BitGraph,
  929.     msgr, xon, cols#85, lines#64,
  930.     bel=^G, cr=^M, tbc=\E[g, clear=\E[H\E[J, el=\E[K, ed=\E[J,
  931.     cup=\E[%i%p1%d;%p2%dH, home=\E[H,
  932.     cub=\E[%p1%dD, cub1=\E[D, cuf=\E[%p1%dC, cuf1=\E[C,
  933.     cud=\E[%p1%dB, cud1=\E[B, cuu=\E[%p1%dA, cuu1=\E[A,
  934.     dl=\E[%p1%dM, dl1=\E[M, il=\E[%p1%dL, il1=\E[L,
  935. #    dch=\E[%p1%dP, dch1=\E[P, ich=\E[%p1%d@, ich1=\E[@,
  936.     smso=\E[4m, rmso=\E[m, smul=\E[4m, rmul=\E[m,
  937.     bold=\E[m, rev=\E[7m, sgr0=\E[m,
  938.     sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m,
  939.     is2=\E:e\E[m\E(B^O\E[1;64r\E[H\E[J\E[20l\E[?1;6l\E[?5;7;50;52h\E=,
  940.     kbs=^H, kcud1=\E[B, kcub1=\E[D, kcuf1=\E[C, kcuu1=\E[A,
  941.     kf0=\EOp, kf1=\EOq, kf2=\EOr, kf3=\EOs, kf4=\EOt,
  942.     kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy,
  943.     sc=\E7, rc=\E8, ind=\ED, ri=\EM, nel=\EE,
  944.     hts=\EH, ht=^I,
  945. #
  946. # Vanilla ANSI terminal.  This is assumed to implement all the normal
  947. # ANSI stuff with no extensions.  It assumes insert/delete line/char
  948. # is there, so it won't work with vt100 clones.  It assumes video
  949. # attributes for bold, blink, underline, and reverse, which won't
  950. # matter much if the terminal can't do some of those.  Padding is
  951. # assumed to be zero, which shouldn't hurt since xon/xoff is assumed.
  952. # This entry is based on the Ann Arbor Ambassador.
  953. ansi|generic ansi standard terminal,
  954.     cr=^M, cud1=^J, ind=^J, bel=^G, il1=\E[L, am, cub1=^H, ed=\E[J,
  955.     el=\E[K, clear=\E[H\E[J, cup=\E[%i%p1%d;%p2%dH, cols#80, lines#24,
  956.     dch1=\E[P, dl1=\E[M, home=\E[H,
  957.     ich=\E[%p1%d@, ich1=\E[@, smir=\E6, rmir=\E6,
  958.     bold=\E[1m, rev=\E[7m, blink=\E[5m, invis=\E[8m, sgr0=\E[0m,
  959.     sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m,
  960.     kcuu1=\E[A, kcud1=\E[B, kcub1=\E[D, kcuf1=\E[C, khome=\E[H, kbs=^H,
  961.     cuf1=\E[C, ht=^I, cuu1=\E[A, xon, rep=%p1%c\E[%p2%{1}%-%db,
  962.     rmul=\E[m, smul=\E[4m, rmso=\E[m, smso=\E[7m,
  963. # The tab 132 uses xon/xoff, so no padding needed.
  964. # smkx/rmkx have nothing to do with arrow keys.
  965. # is2 sets 80 col mode, normal video, autowrap on (for am).
  966. # Seems to be no way to get rid of status line.
  967. tab132|tab|tab 132/15,
  968.     is2=\E[?7h\E[?3l\E[?5l, smkx@, rmkx@, cr=^M, cud1=^J, ind=^J,
  969.     bel=^G, lm#96, da, db, il1=\E[L, dl1=\E[M, dch1=\E[P,
  970.     rmir=\E[4l, smir=\E[4h, cup=\E[%i%p1%d;%p2%dH,
  971.     kcuu1=\E[A, kcud1=\E[B, kcub1=\E[D, use=vt100,
  972. tab132w,
  973.     cols#132, is2=\E[?7h\E[?3h\E[?5l, use=tab132,
  974. tab132rv,
  975.     is2=\E[?7h\E[?3l\E[?5h, use=tab132,
  976. tab132wrv,
  977.     is2=\E[?7h\E[?3h\E[?5h, use=tab132w,
  978. # This used to say "de#001202" which presumably refers to the stty bits
  979. # that need to be set for some version of Unix.  We need the real delay
  980. # requirements here.
  981. mw2|Multiwriter 2,
  982.     cr=^M, cud1=^J, ind=^J, bel=^G, cols#132, hc, os,
  983. trs80|trs-80|Radio Shack TRS-80 model I,
  984.     cr=^M, cud1=^J, ind=^J, bel=^G,
  985.     am, cub1=^H, cols#64, lines#16,
  986. # I think the direct is supposed to be vt100 compatible, so all this
  987. # should probably be replaced by a use=vt100, but I can't test it.
  988. d800|direct|direct800|Direct 800/A,
  989.     cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, am,
  990.     clear=\E[1;1H\E[2J, cub1=^H, cup=\E[%i%p1%d;%p2%dH,
  991.     cuf1=\E[C, cuu1=\E[A, el=\E[K, ed=\E[J, smso=\E[7m, rmso=\E[0m,
  992.     smul=\E[4m, rmul=\E[0m, xhp, cvvis=\E[>12l, cnorm=\E[>12h,
  993.     ind=\ED, ri=\EM, da, db, rmacs=\E[1m, smacs=\E[0m, msgr, ht=^I, 
  994.     kcub1=\E[D, kcuf1=\E[C, kcuu1=\E[A, kcud1=\E[B,
  995.     kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
  996.     kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW,
  997. vc404|volker-craig 404,
  998.     cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=^W$<40>, el=^V$<20>,
  999.     clear=^X$<40>, cup=^P%p1%' '%+%c%p2%' '%+%c, cols#80, home=^Y$<40>,
  1000.     kcud1=^J, kcub1=^H, kcuf1=^U, kcuu1=^Z, lines#24, cuf1=^U, cuu1=^Z,
  1001. vc404s|volker-craig 404 w/standout mode,
  1002.     cr=^M, cud1=^J, ind=^J, bel=^G, rmso=^O, smso=^N, use=vc404,
  1003. vc404na|volker-craig 404 w/no arrow keys,
  1004.     kcuf1@, kcuu1@, use=vc404,
  1005. vc404sna|volker-craig 404 w/standout mode and no arrow keys,
  1006.     rmso=^O, smso=^N, use=vc404na,
  1007. # missing in vc303a and vc303 descriptions:  they scroll 2 lines at a time
  1008. # every other linefeed.
  1009. vc303a|vc403a|volker-craig 303a,
  1010.     cr=^M, cud1=^J, bel=^G, am, cub1=^H, el=^V$<20>, clear=^X$<40>,
  1011.     cols#80, home=^Y$<40>, kcud1=^J, kcub1=^H, kcuf1=^U,
  1012.     kcuu1=^Z, lines#24, ll=^P^@W, cuf1=^U, cuu1=^Z,
  1013. vc303|vc103|vc203|volker-craig 303,
  1014.     cr=^M, cud1=^J, bel=^G, am, cub1=^H, clear=^L$<40>, cols#80,
  1015.     home=^K$<40>, kcud1=^J, kcub1=^H, kcuf1=^I, kcuu1=^N, lines#24,
  1016.     ll=^O$<1>W, cuf1=^I, cuu1=^N,
  1017. # From cbosg!ucbvax!SRC:george Fri Sep 11 22:38:32 1981
  1018. ampex|d80|dialogue|dialogue80|ampex dialogue 80,
  1019.     tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G,
  1020.     is2=\EA, smul=\El, rmul=\Em,
  1021.     am, cub1=^H, ht=^I, clear=\E*$<75>, cup=\E=%p1%' '%+%c%p2%' '%+%c,
  1022.     il1=\EE$<5*>, cbt=\EI, ich1=\EQ, dl1=\ER$<5*>, dch1=\EW,
  1023.     el=\Et, ed=\Ey, smso=\Ej, rmso=\Ek, lines#24, cols#80, cuf1=^L, cuu1=^K,
  1024. d132|datagraphix|datagraphix 132a,
  1025.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1026.     cols#80, lines#30, clear=^l, home=\Et, da, db, ind=\Ev, ri=\Ew,
  1027.     cuu1=\Ek, cuf1=\El, cvvis=\Ex, cnorm=\Em\En,
  1028.     il1=\E3, ich1=\E5, dch1=\E6, in, ich1=\E5,
  1029. soroc|Soroc 120,
  1030.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1031.     ed=\EY, el=\ET, clear=\E*$<2>,
  1032.     kcub1=^H, kcuu1=^K, kcuf1=^L, kcud1=^J, use=adm3a,
  1033. # tec is2 untested, and taken from CB/Unix virtual terminal driver.
  1034. # Upper case terminal, uses lower case for control sequences!!!
  1035. # The driver shows the C ~ operator used on CM coordinates.
  1036. tec400|tec scope,
  1037.     cr=^M, cud1=^J, ind=^J, bel=^G, cup=l%p2%~%c%p1%~%c,
  1038.     cuu1=x, cud1=h, cuf1=g, cub1=w, home=i, smso={, rmso=|,
  1039.     xmc#1, clear=f, il1=e, dl1=u, ich1=d, dch1=t, el=c, ed=s,
  1040. # From ucbvax!geoff Mon Sep 21 21:15:45 1981 
  1041. # This entry has been tested.
  1042. tec500|tec 500,
  1043.     cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H,
  1044.     cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z$<20>,
  1045.     cols#80, home=^^, lines#24, cuf1=^L, cuu1=^K, smso=^], rmso=^\,
  1046. # I would appreciate more information on this terminal, such as the
  1047. # manufacturer and the model number.  There are too many 'tecs' in here.
  1048. tec,
  1049.     lines#24, cols#80, clear=^l, cuu1=^k, cuf1=\037, am,
  1050.     cub1=^H, home=\036, cr=^M, cud1=^J, ind=^J, bel=^G,
  1051. teletec|Teletec Datascreen,
  1052.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1053.     am, cub1=^H, cols#80, clear=^l, home=^^, lines#24, cuf1=^_, cuu1=^k,
  1054. aed512|aed|AED 512,
  1055.     if=/usr/lib/tabset/aed,
  1056.     cr=^M, cud1=^J, bel=^G,
  1057.     cols#64, lines#40, clear=^L,
  1058.     cub1=^H, cuf1=\Ei0800\001,
  1059.     cnorm=\E\072004=000200??\001,
  1060.     flash=\EK0001??0000K0001202080\001,
  1061.     smso=\E\07200>8000140[80C00\001, rmso=\E[00C80\001,
  1062.     smul=\E\07200>8000140\001, rmul=\E\07200>8000100\001,
  1063.     uc=\Ei???>l0800i0102\001,
  1064.     smcup=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001,
  1065.     rmcup=\E\07200>8000100{804<0??00001000L80\072004=000200??\001,
  1066.     ind=\E;1100\072004=000200??;1300\047\200\001\n\E\072004=0002??00;1200\001\n,
  1067.     cuu1=^K, .cup=\E;1300%p1%c%p2%c\001,
  1068. digilog|333|digilog 333,
  1069.     cub1=^H, cols#80, el=\030, home=^n, lines#16, cuf1=^i, cuu1=^o,
  1070.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1071. ep48|ep4080|execuport 4080,
  1072.     am, cub1=^H, os, cols#80, hu=\036, hd=\034,
  1073.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1074. ep40|ep4000|execuport 4000,
  1075.     am, cub1=^H, os, cols#136, hu=\036, hd=\034,
  1076.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1077. terminet1200|terminet300|tn1200|tn300|terminet|ge terminet 1200,
  1078.     cols#120, hc, os,
  1079.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1080. datapoint|dp3|dp3360|datapoint 3360,
  1081.     cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H,
  1082.     ed=^_, el=^^, clear=^]^_, cols#82, home=^], lines#25, cuf1=^x, cuu1=^z,
  1083. dg|dg6053|data general 6053,
  1084.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1085.     am, cub1=^H, cup=^P%p2%c%p1%c, clear=^L, home=^H, cuf1=^S,
  1086.     cuu1=^W, el=^K, cols#80, lines#24,
  1087. cdi|cdi1203,
  1088.     am, cub1=^H, hc, os, cols#80,
  1089.     cr=^M$<200>, cud1=^J, ind=^J, bel=^G,
  1090. # ^S is an arrow key!  Boy is this guy in for a surprise on v7!
  1091. sol,
  1092.     cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, cup=\E^1%p1%c\E^2%p2%c,
  1093.     clear=^K, home=^N, cols#64, lines#16, cuf1=^S, cuu1=^W,
  1094.     kcub1=^A, kcuf1=^S, kcuu1=^W, kcud1=^Z,
  1095. xl83|cybernex XL-83,
  1096.     cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=^P$<62>, el=^O$<3>,
  1097.     clear=^L$<62>, cup=^W%p1%' '%+%c%p2%' '%+%c, cols#80, home=^K,
  1098.     kcud1=^J, kcub1=^H, kcuu1=^N, lines#24, cuu1=^N, cuf1=^I,
  1099. omron|Omron 8025AG,
  1100.     cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL, am, cub1=^H, ed=\ER,
  1101.     cols#80, el=\EK, clear=\EJ, da, db, dch1=\EP, dl1=\EM, home=\EH,
  1102.     lines#24, cuf1=\EC, rmso=\E4, ind=\ES, smso=\Ef, ri=\ET,
  1103.     cuu1=\EA, cnorm=, cvvis=\EN,
  1104. plasma|plasma panel,
  1105.     am, cub1=^H, clear=^L, cols#85, home=^^, lines#45, cuf1=\030, cuu1=\026,
  1106.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1107. swtp|ct82|Southwest Technical Products CT82,
  1108.     cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, il1=^\^y,
  1109.     ed=^v, el=^F, clear=^L, cup=^k%p2%c%p1%c, cols#82, lines#20, dl1=^z,
  1110.     cuf1=^s, cuu1=^a, smso=^^^v, rmso=^^^F, dch1=^\^h, ich1=^\^x, home=^p,
  1111.     ind=^n, ri=^o, ll=^c,
  1112.     is2=^\^r^^^s^^^d^]^w^i^s^^^]^^^o^]^w^r^i,
  1113. terak|Terak emulating Datamedia 1520,
  1114.     use=dm1520,
  1115. remote|virtual remote terminal,
  1116.     cols#79, am@, use=virtual,
  1117. virtual|CB-UNIX virtual terminal,
  1118.     cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, am, clear=\E\112,
  1119.     cub1=^H, cup=\E\107%p2%c%p1%c, cuf1=\E\103, cuu1=\E\101, el=\E\113,
  1120.     ed=\E\114, il1=\E\120, dl1=\E\116, ich1=\E\117, lm#0, da, db,
  1121.     kcub1=\E\104, kcuf1=\E\103, kcuu1=\E\101, kcud1=\E\102, khome=\E\105,
  1122.     smso=\E\141\004, rmso=\E\142\004, smul=\E\141\001, rmul=\E\142\001,
  1123. # This is untested.  The cup sequence is hairy enough that it probably
  1124. # needs work.  The idea is ctrl(O), dd(row), dd(col), where dd(x)
  1125. # is x - 2*(x%16) + '9'
  1126. delta|dd5000|delta data 5000,
  1127.     cud1=^J, ind=^J, bel=^G, am, cub1=^H, clear=^NR,
  1128.     cup=^O%p1%p1%{16}%m%{2}%*%-%'9'%+%c%p2%p2%{16}%m%{2}%*%-%'9'%+%c,
  1129.     cols#80, lines#27, home=^NQ, cuf1=^Y, cuu1=^Z, el=^NU, dch1=^NV,
  1130. mdl110|cybernex mdl-110,
  1131.     cup=^P%p1%' '%+%c%p2%' '%+%c, cols#80, lines#24, am, clear=^X$<70>,
  1132.     cub1=^H, cr=^M, cud1=^J, ind=^J, bel=^G, cuf1=^U, cuu1=^Z, home=^Y,
  1133.     el=^N@^V$<145>, ed=^NA^W$<145>, il1=^NA^N^]$<65>, dl1=^NA^N^^$<40>,
  1134.     ich1=^NA^]$<3.5>, smdc=, rmdc=, dch1=^NA^^$<3.5>, smso=^NF, rmso=^NG,
  1135.     ht=\t$<43>, ed=^N@^V$<6>,
  1136. zen30|z30|zentec 30,
  1137.     cr=^M, cud1=^J, ind=^J, bel=^G, mir, cols#80, lines#24,
  1138.     ul, il1=\EE$<1.5*>, cub1=^H, el=\ET$<1.0*>,
  1139.     cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=\E*, home=^^, cuf1=^L,
  1140.     rmso=\EG0, smso=\EG6, cuu1=^K, smir=\Eq, rmir=\Er,
  1141.     am, dch1=\EW, dl1=\ER$<1.5*>, ed=\EY,
  1142. # Test version for Falco ts-1. See "arpavax.hickman@ucb" for info
  1143. falco|ts1|ts-1|falco ts-1,
  1144.     cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, ht=^I,
  1145.     is2=\Eu\E3, il1=\EE, am, el=\ET\EG0^H, cup=\E=%p1%' '%+%c%p2%' '%+%c,
  1146.     clear=\E*, ed=\EY, dch1=\EW, cub1=^H, dl1=\ER, rmir=\Er, smir=\Eq,
  1147.     home=^^, kf0=^A0\r, kcud1=^J, kcub1=^H, kcuf1=^L, kcuu1=^K, cuf1=^L,
  1148.     rmso=\Eg0, smso=\Eg1, cuu1=^K, smul=\Eg1, rmul=\Eg0,
  1149. //go.sysin dd *
  1150. echo 'x - =data/perkinelmer'
  1151. sed 's/^X//' <<'//go.sysin dd *' >=data/perkinelmer
  1152. #  # --------------------------------
  1153. #    @(#)perkinelmer    1.4    5/19/82
  1154. #
  1155. # perkinelmer: PERKIN ELMER
  1156. #
  1157. bantam|pe550|perkin elmer 550,
  1158.     cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, cols#80, el=\EI$<20>,
  1159.     clear=\EK$<20>, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c, home=\EH,
  1160.     lines#24, ll=\EH\EA, cuf1=\EC, cuu1=\EA, ed=^N@^V$<6>,
  1161. fox|perkin elmer 1100,
  1162.     tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H,
  1163.     ed=\EJ$<5.5*>, el=\EI, clear=\EH\EJ$<132>, cols#80, home=\EH, lines#24,
  1164.     ll=\EH\EA, cuf1=\EC, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c,
  1165.     cuu1=\EA, flash=^P^B^P^C,
  1166. owl|perkin elmer 1200,
  1167.     tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL$<5.5*>,
  1168.     am, cub1=^H, ed=\EJ$<5.5*>, el=\EI$<5.5>, clear=\EH\EJ$<132>, home=\EH,
  1169.     ll=\EH\EA, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c, cols#80, dch1=\EO$<5.5*>,
  1170.     dl1=\EM$<5.5*>, ich1=\EN, ip=$<5.5*>, kbs=^h, in, lines#24,
  1171.     cuf1=\EC, cuu1=\EA, rmso=\E!\200, smso=\E!^H, flash=^P^B^P^C,
  1172.     kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, kf5=\ERE, kf6=\ERF,
  1173.     kf7=\ERG, kf8=\ERH, kf9=\ERI, kf0=\ERJ,
  1174. //go.sysin dd *
  1175. echo 'x - =data/print'
  1176. sed 's/^X//' <<'//go.sysin dd *' >=data/print
  1177. #  # --------------------------------
  1178. #    @(#)print    1.1 print 5/19/82
  1179. #
  1180. # print: PRINTERS
  1181. #
  1182. # Generic line printer.  We assume it can backspace, since even those
  1183. # line printers that can't have this hidden by UNIX lpr driver.
  1184. lpr|lp|printer|print|printing|line printer,
  1185.     cr=^M, cud1=^J, ff=^L, bel=^G, cub1=^H, cols#132, hc, os,
  1186. citoh|ci8510|8510|c.itoh 8510a,
  1187.     cols#80, ri=\Er, bold=\E!, smul=\EX, rmul=\EY, sgr0=\E"\EY, 
  1188.     is2=\E(009\054017\054025\054033\054041\054049\054057\054065\054073.,
  1189.     rep=\ER%p2%3d%p1%c, use=lpr,
  1190. //go.sysin dd *
  1191. echo 'x - =data/special'
  1192. sed 's/^X//' <<'//go.sysin dd *' >=data/special
  1193. #  # --------------------------------
  1194. #    @(#)special    1.5    5/19/82
  1195. #
  1196. # special: SPECIALS
  1197. #
  1198. # Generic "terminals".  These are used to label tty lines when you don't
  1199. # know what kind of terminal is on it.  The characteristics of an unknown
  1200. # terminal are the lowest common denominator - they look about like a ti 700.
  1201. arpanet|network,
  1202.     use=unknown,
  1203. bussiplexer,
  1204.     use=unknown,
  1205. dialup,
  1206.     use=unknown,
  1207. ethernet|network,
  1208.     use=unknown,
  1209. plugboard|patch|patchboard,
  1210.     use=unknown,
  1211. dumb,
  1212.     am, bel=^G, cols#80, cr=^M, cud1=^J, ind=^J,
  1213. unknown,
  1214.     gn, use=dumb,
  1215. switch|intelligent switch,
  1216.     use=unknown,
  1217. //go.sysin dd *
  1218. echo 'x - =data/tektronix'
  1219. sed 's/^X//' <<'//go.sysin dd *' >=data/tektronix
  1220. #  # --------------------------------
  1221. #    @(#)tektronix    1.5    5/20/82
  1222. #
  1223. # tektronix: TEKTRONIX
  1224. #
  1225. tek|tek4012|4012|tektronix 4012,
  1226.     cr=^M, cud1=^J, bel=^G, ff=^L$<1000>,
  1227.     is2=\E^O, cub1=^H, clear=\E^L$<1000>, cols#75, lines#35, os,
  1228. tek4013|4013|tektronix 4013,
  1229.     rmacs=\E^N, smacs=\E^O, use=4012,
  1230. tek4014|4014|tektronix 4014,
  1231.     is2=\E^O\E9, cols#81, lines#38, use=tek4012,
  1232. tek4015|4015|tektronix 4015,
  1233.     rmacs=\E^N, smacs=\E^O, use=4014,
  1234. tek4014-sm|4014-sm|tektronix 4014 in small font,
  1235.     is2=\E^O\E\072, cols#121, lines#58, use=tek4014,
  1236. tek4015-sm|4015-sm|tektronix 4015 in small font,
  1237.     rmacs=\E^N, smacs=\E^O, use=4014-sm,
  1238. tek4023|4023|tex|tektronix 4023,
  1239.     cr=^M, cud1=^J, ind=^J, bel=^G, smso=^_P, rmso=^_@,
  1240.     cup=\034%p2%' '%+%c%p1%' '%+%c, cuf1=\t, cub1=^H,
  1241.     clear=\E^L$<4>, cols#80, lines#24, am, vt#4,
  1242. # Can't use cursor motion because it's memory relative, and because
  1243. # it only works in the workspace, not the monitor.  Same for home.
  1244. # Likewise, standout only works in the workspace.
  1245. # el was commented out since vi and rogue seem to work better simulating
  1246. # it with lots of spaces!
  1247. 4025|4027|4024|tek4025|tek4027|tek4024|4025cu|4027cu|tektronix 4024/4025/4027,
  1248.     cr=^M, ind=^F^J, cud1=^F^J, bel=^G, am, da, db, ht=^I, 
  1249.     cub1=^H, lm#0, lines#34, cols#80, clear=^_era\r\n\n,
  1250.     is2=\41com 31\r\n^_sto 9 17 25 33 41 49 57 65 73\r,
  1251.     smkx=^_lea p4 /h/\r^_lea p8 /k/\r^_lea p6 / /\r^_lea p2 /j/\r^_lea f5 /H/\r,
  1252.     rmkx=^_lea p2\r^_lea p4\r^_lea p6\r^_lea p8\r^_lea f5\r,
  1253.     cuu1=^K, cuf1=^_rig\r, il1=^_up\r^_ili\r$<145>, dl1=^_dli\r^F,
  1254.     dch1=^_dch\r, smir=^_ich\r, rmir=^F^_dow\r^K,
  1255.     .el=^_dch 80\r, ed=^_dli 50\r, CC=^_,
  1256.     il=^_up\r^_ili %p1%d\r$<145>, dl1=^_dli %p1%d\r^F,
  1257.     cuu=^_up %p1%d\r, cud=^_dow %p1%d\r, cub=^_lef %p1%d\r, cuf=^_rig %p1%d\r,
  1258. 4025-17|4027-17|tek 4025 17 line window,
  1259.     lines#17, use=4025,
  1260. 4025-17ws|4027-17ws|tek 4025 17 line window in workspace,
  1261.     is2=\41com 31\r\n^_sto 9 17 25 33 41 49 57 65 73\r^_wor 17\r^_mon 17\r,
  1262.     smcup=^_wor h\r, rmcup=^_mon h\r, smso=^_att e\r, rmso=^_att s\r, use=4025-17,
  1263. 4025ex|4027ex|tek 4025 w/!,
  1264.     smcup=\41com 31\r, rmcup=^_com 33\r,
  1265.     is2=^_com 33\r\n\41sto 9 17 25 33 41 49 57 65 73\r, use=4025,
  1266. # The 4110 series may be a wonderful graphics series, but they make the 4025
  1267. # look good for screen editing.  In the dialog area, you can't move the cursor
  1268. # off the bottom line.  Out of the dialog area, ^K moves it up, but there
  1269. # is no way to scroll.  Note that there is a floppy for free from Tek that
  1270. # makes the 4112 emulate the vt52 (use the vt52 termcap).  There is also
  1271. # an expected enhancement that will use ANSI standard sequences.
  1272. 4112|4113|4114|tek4112|tektronix 4110 series,
  1273.     cub1=^H, cr=^M, cud1=^J, bel=^G, am,
  1274.     clear=\ELZ, lines#34, cols#80,
  1275. # 4112 in non-dialog area pretending to scroll.  It really wraps but vi is
  1276. # said to work (more or less) in this mode.
  1277. 4112-fs,
  1278.     ind=^J, ri=^K,
  1279. 4112-nd|4112 not in dialog area,
  1280.     cuu1=^K, use=4112,
  1281. 4112-5|4112 in 5 line dialog area,
  1282.     lines#5, use=4112,
  1283. //go.sysin dd *
  1284. echo 'x - =data/teleray'
  1285. sed 's/^X//' <<'//go.sysin dd *' >=data/teleray
  1286. #  # --------------------------------
  1287. #    @(#)teleray    1.4    5/19/82
  1288. #
  1289. # teleray: TELERAY
  1290. #
  1291. # Note two things called "teleray".  Reorder should move the common one
  1292. # to the front if you have either.  A dumb teleray with the cursor stuck
  1293. # on the bottom and no obvious model number is probably a 3700.
  1294. t3700|teleray|dumb teleray 3700,
  1295.     cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, clear=^L, cols#80, lines#24,
  1296. t3800|teleray 3800 series,
  1297.     cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=\EJ, el=\EK, clear=^L,
  1298.     cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80,  
  1299.     cud1=\n, home=\EH, lines#24, ll=\EY7 , cuf1=\EC, ht=^I, cuu1=^K,
  1300. t1061|t10|teleray 1061,
  1301.     tbc=\EG, hts=\EF, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL$<2*>,
  1302.     am, cub1=^H, ed=\EJ$<1>, el=\EK, clear=^L$<1>,
  1303.     cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80,
  1304.     dch1=\EQ, dl1=\EM$<2*>, home=\EH, ich1=\EP, ip=$<0.4*>,
  1305.     kf1=^Z1, kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, kf6=^Z6, kf7=^Z7, kf8=^Z8,
  1306.     lines#24, cuf1=\EC, ht=^I, rmso=\ER@, smso= \ERD, km,
  1307.     is2=\Ee\EU01^Z1\EV\EU02^Z2\EV\EU03^Z3\EV\EU04^Z4\EV\EU05^Z5\EV\EU06^Z6\EV\EU07^Z7\EV\EU08^Z8\EV\Ef,
  1308.     cuu1=\EA, smul=\ERH, rmul=\ER@, xhp, xt, xmc#1,
  1309. t1061f|teleray 1061 with fast PROMs,
  1310.     il1=\EL, ip@, dl1=\EM, use=t1061,
  1311. //go.sysin dd *
  1312. echo 'x - =data/teletype'
  1313. sed 's/^X//' <<'//go.sysin dd *' >=data/teletype
  1314. #  # --------------------------------
  1315. #    @(#)teletype    1.7    5/19/82
  1316. #
  1317. # teletype: TELETYPE
  1318. #
  1319. # This works on the default blit, except that output is by exclusive or,
  1320. # and insert line leaves 1/2 line at the bottom of the screen.
  1321. blit|jerq,
  1322.     cr=^M, cud1=^J, ind=^J, bel=^G, cols#88, lines#72, ht=^I,
  1323.     am, ul, eo, mir, il=\Ef%p1%' '%+%c, dl=\Ee%p1%' '%+%c,
  1324.     dl1=\EE, rmir=\ER, smir=\EQ, dch1=\EO, cub1=\ED, da, db,
  1325.     il1=\EF, ed=\EJ, el=\EK, clear=^L, cup=\EY%p2%' '%+%c%p1%' '%+%c,
  1326.     cuf1=\EC, cuu1=\EA, kcuu1=\EA, kcud1=\EB, kcuf1=\EC, kcub1=\ED,
  1327.     flash=\E^G, smso=\EU!, rmso=\EV!, smul=\EU", rmul=\EV",
  1328. blitlayer|layer|vitty,
  1329.     cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, ht=^I,
  1330.     am, clear=^L, cup=\EY%p2%' '%+%c%p1%' '%+%c, el=\EK, il=\EI, dl=\ED,
  1331. 33|tty33|tty|model 33 teletype,
  1332.     cr=^M, cud1=^J, ind=^J, bel=^G, cols#72, hc, os,
  1333. # The Dataspeed 40's have lots of braindamage, such as xmc (?) and printing
  1334. # a visible newline indicator after each newline.  The 40-1 is a half duplex
  1335. # terminal and is hopeless.  The 40-2 is braindamaged but has hope and is
  1336. # described here.  The 40-4 is a 3270 lookalike and beyond hope.
  1337. # The terminal has blinking standout.  It also has visible bell but I don't
  1338. # know it - it's null here to prevent it from showing the BL character.
  1339. # I am not sure if the 40 has xmc or not, it looked like it didn't.
  1340. # Note also that the control characters have been randomly rearranged,
  1341. # for example, to get escape you type control-P!
  1342. 40|tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2,
  1343.     clear=\ER$<160>, ed=\EJ$<160>, il1=\EL$<160>, dl1=\EM$<160>,
  1344.     dch1=\EP$<50>, ich1=\E\^$<50>, cuf1=\EC, cuu1=\E7, cub1=^H, cr=\EG,
  1345.     ind=^J, cud1=\EB, cols#80, lines#24, flash=, smso=\E3, rmso=\E4,
  1346. 43|tty43|model 43 teletype,
  1347.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1348.     kbs=^h, am, cub1=^H, hc, os, cols#132,
  1349. 37|tty37|model 37 teletype,
  1350.     cr=^M, cud1=^J, ind=^J, bel=^G,
  1351.     cub1=^H, hc, hu=\E8, hd=\E9, cuu1=\E7, os,
  1352. # From jwb Wed Mar 31 13:25:09 1982 remote from ihuxp
  1353. # This description seems to avoid line 1 - I don't know why.
  1354. # It looks a lot like a vt100 with ins/del line/char.
  1355. # But the insert char is not ANSI standard!
  1356. 4424|tty4424|teletype 4424m,
  1357.     il1=\EL, da, db, ip=$<2>, ich1=\E^, dch1=\EP, dl1=\EM,
  1358.     cols#80, lines#23, am, clear=\E[2;H\E[J, cub1=^H,
  1359.     cup=\E[%i%p1%2d;%p2%2dH\E[B,
  1360.     cuf1=\E[C, cuu1=\E[A, mir, ri=\ET,
  1361.     el=\E[K, smso=\E[7m, rmso=\E[m, smul=\E[4m, rmul=\E[m,
  1362.     is2=\E[m\E[2;24r,
  1363.     kcud1=\E[B, kcub1=\E[D, kcuu1=\E[A, kcuf1=\E[C,
  1364.     khome=\E[H, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
  1365. //go.sysin dd *
  1366. echo 'x - =data/televideo'
  1367. sed 's/^X//' <<'//go.sysin dd *' >=data/televideo
  1368. #  # --------------------------------
  1369. #    @(#)televideo    1.4    5/19/82
  1370. #
  1371. # televideo: TELEVIDEO
  1372. #
  1373. # There are some tvi's that require incredible amounts of padding and
  1374. # some that don't.  I'm assuming 912 and 920 are the old slow ones,
  1375. # and 912b, 912c, 920b, 920c are the new ones that don't need padding.
  1376. tvi912|912|920|tvi920|old televideo,
  1377.     tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE$<33*>, am,
  1378.     cub1=^H, el=\ET, cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z,
  1379.     cols#80, dch1=\EW, dl1=\ER$<33*>,
  1380.     kbs=^h, kcuu1=^K, kcud1=^J, kcub1=^H, kcuf1=^L,
  1381.     kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r,
  1382.     kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r,
  1383.     home=^^, ich1=\EQ, lines#24, cuf1=^L, ht=^I, 
  1384.     rmso=\Ek, smso=\Ej, cuu1=^K, smul=\El, rmul=\Em, xmc#1,
  1385. # the 912 has a <funct> key that's like shift: <funct>8 xmits "^A8\r".
  1386. # The 920 has this plus real function keys that xmit different things.
  1387. # Terminfo makes you use the funct key on the 912 but the real keys on the 920.
  1388. 912b|912c|tvi912b|tvi912c|tvi|new televideo 912,
  1389.     il1=\EE$<5*>, dl1=\ER$<5*>, use=tvi912,
  1390. 920b|920c|tvi920b|tvi920c|new televideo 920,
  1391.     kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r,
  1392.     kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, use=tvi912b,
  1393. # Two page TVI 912/920.
  1394. # set to page 1 when entering ex (\E-17 )
  1395. # reset to page 0 when exiting ex (\E-07 )
  1396. tvi912-2p|tvi920-2p|912-2p|920-2p|tvi-2p|televideo w/2 pages,
  1397.     smcup=\E-17 , rmcup=\E-07 , use=tvi912,
  1398. tvi950-ap|tvi 950 w/alt pages,
  1399.     is2=\E\\1, smcup=\E-06 , rmcup=\E-16 , use=tvi950,
  1400. tvi950-b|bare tvi950 no is2,
  1401.     is2@, smkx=\El, rmkx=\Ek, use=tvi950,
  1402. tvi950-ns|tvi950 w/no standout,
  1403.     smso@, rmso@, smul@, rmul@, use=tvi950,
  1404. # The following tvi descriptions from B:pjphar
  1405. # Now that we have is1, is2, and is3, these should be factored.
  1406. #
  1407. # is2 for all 950's.  It sets the following attributes:
  1408. # full duplex (\EDF)        write protect off (\E()
  1409. # conversation mode (\EC)    graphics mode off (\E%)
  1410. # white on black (\Ed)        auto page flip off (\Ew)
  1411. # turn off status line (\Eg)    clear status line (\Ef\r)
  1412. # normal video (\E0)        monitor mode off (\EX or \Eu)
  1413. # edit mode (\Er)        load blank char to space (\Ee\040)
  1414. # line edit mode (\EO)        enable buffer control (^O)
  1415. # protect mode off (\E\047)    local edit keys (\Ek)
  1416. # program unshifted send key to send line all (\E016)
  1417. # program shifted send key to send line unprotected (\E004)
  1418. # set the following to nulls:
  1419. #    field delimiter (\Ex0\0\0)
  1420. #    line delimiter (\Ex1\0\0)
  1421. #    start-protected field delimiter (\Ex2\0\0)
  1422. #    end-protected field delimiter (\Ex3\0\0)
  1423. # set end of text delimiter to carriage return/null (\Ex4\r\0)
  1424. #
  1425. # tvi950 sets duplex (send) edit keys (\El) when entering vi
  1426. #        sets local (no send) edit keys (\Ek) when exiting vi
  1427. #
  1428. tvi950|950|televideo950,
  1429.     tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G,
  1430.     is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
  1431.     \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
  1432.     \Ex3\0\0\Ex4\r\0\Ef\r\El,
  1433.     il1=\EE, am, cub1=^H, cbt=\EI, ed=\Ey, el=\Et, clear=\E*,
  1434.     cup=\E=%p1%' '%+%c%p2%' '%+%c, cols#80, dch1=\EW, dl1=\ER,
  1435.     cud1=^V, rmir=\Er, home=^^, smir=\Eq, kf0=^A0\r,
  1436.     kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r,
  1437.     kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, kbs=^H, kcud1=^V, khome=^^, kcub1=^H,
  1438.     kcuf1=^L, kcuu1=^K, lines#24, mir, msgr, cuf1=^L,
  1439.     ht=^I, rmso=\EG0, xmc#1, smso=\EG4, ri=\Ej,
  1440.     rmul=\EG0, cuu1=^K, smul=\EG8,
  1441.     flash=\Eb$<20>\Ed, cnorm=\Ek, cvvis=\El, xenl,
  1442.     hs, tsl=\Eg\Ef, fsl=\r,
  1443. #
  1444. # is2 for 950 with two pages adds the following:
  1445. #    set 48 line page (\E\\2)
  1446. #    place cursor at page 0, line 24, column 1 (\E-07 )
  1447. #
  1448. # two page 950 adds the following:
  1449. #    when entering ex, set 24 line page (\E\\1)
  1450. #    when exiting ex, reset 48 line page (\E\\2)
  1451. #             place cursor at 0,24,1 (\E-07 )
  1452. #
  1453. tvi950-2p|950-2p|televideo950 w/2 pages,
  1454.     is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
  1455.     \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
  1456.     \Ex3\0\0\Ex4\r\0\E\\2\E-07 
  1457.     rmcup=\E\\2\E-07 , smcup=\E\\1\E-07 , use=tvi950,
  1458. #
  1459. # is2 for 950 with four pages adds the following:
  1460. #    set 96 line page (\E\\3)
  1461. #    place cursor at page 0, line 24, column 1 (\E-07 )
  1462. #
  1463. # four page 950 adds the following:
  1464. #    when entering ex, set 24 line page (\E\\1)
  1465. #    when exiting ex, reset 96 line page (\E\\3)
  1466. #             place cursor at 0,24,1 (\E-07 )
  1467. #
  1468. tvi950-4p|950-4p|televideo950 w/4 pages,
  1469.     is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
  1470.     \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
  1471.     \Ex3\0\0\Ex4\r\0\E\\3\E-07 
  1472.     rmcup=\E\\3\E-07 , smcup=\E\\1\E-07 , use=tvi950,
  1473. #
  1474. # is2 for reverse video 950 changes the following:
  1475. #    set reverse video (\Ed)
  1476. #
  1477. # set flash accordingly (\Eb ...nulls... \Ed)
  1478. #
  1479. tvi950-rv|950-rv|televideo950 rev video,
  1480.     tbc=\E3, hts=\E1,
  1481.     is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
  1482.     \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
  1483.     \Ex3\0\0\Ex4\r\0, flash=\Ed$<20>\Eb, use=tvi950,
  1484. #
  1485. # uses the appropriate entries from 9502p and 950rv
  1486. #
  1487. tvi950-rv2p|950-rv2p|televideo950 rev video w/2 pages,
  1488.     is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
  1489.     \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
  1490.     \Ex3\0\0\Ex4\r\0\E\\2\E-07 
  1491.     rmcup=\E\\2\E-07 , smcup=\E\\1\E-07 , use=tvi950rv,
  1492. #
  1493. # uses the appropriate entries from 9504p and 950rv
  1494. #
  1495. tvi950-rv4p|950-rv4p|televideo950 rev video w/4 pages,
  1496.     is2=\EDF\EC\Eb\EG0\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
  1497.     \Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
  1498.     \Ex3\0\0\Ex4\r\0\E\\3\E-07 
  1499.     rmcup=\E\\3\E-07 , smcup=\E\\1\E-07 , use=tvi950rv,
  1500. //go.sysin dd *
  1501. echo 'x - =data/ti'
  1502. sed 's/^X//' <<'//go.sysin dd *' >=data/ti
  1503. #  # --------------------------------
  1504. #    @(#)ti    1.4    5/20/82
  1505. #
  1506. # ti: TEXAS INSTRUMENTS
  1507. #
  1508. ti700|ti733|735|ti735|ti silent 700,
  1509.     cr=^M$<162>, use=ti745,
  1510. ti|ti745|745|743|ti silent 745,
  1511.     cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, cols#80, hc, os,
  1512. ti800|ti omni 800,
  1513.     cols#132, use=ti745,
  1514. //go.sysin dd *
  1515. echo 'x - =data/trailer'
  1516. sed 's/^X//' <<'//go.sysin dd *' >=data/trailer
  1517. #  # ------------------------
  1518. #
  1519. # The following have been included for upward compatibility with previous
  1520. # names.  They are considered obsolete and the new name (which typically
  1521. # contains an extra dash) should be used instead.  These names will go
  1522. # away eventually (read: "soon") so you should start converting!
  1523. #
  1524. aaa20, use=aaa-20,
  1525. aaa20rev, use=aaa-20-rv,
  1526. aaa30, use=aaa-30,
  1527. aaa30rev, use=aaa-30-rv,
  1528. aaa40, use=aaa-40,
  1529. aaa40rev, use=aaa-40-rv,
  1530. aaa48, use=aaa-48,
  1531. aaa48rev, use=aaa-48-rv,
  1532. aaarev, use=aaa-48-rv,
  1533. aaa60, use=aaa-60,
  1534. aaa60rev, use=aaa-60-rv,
  1535. vt100-np, use=vt100,
  1536. aaa-29-np, use=aaa-29,
  1537. hp2621nl|2621nl, use=2621-nl,
  1538. hp2621nt|2621nt, use=2621-nt,
  1539. hp2621wl|2621wl, use=2621-wl,
  1540. 9122p, use=912-2p,
  1541. 9202p, use=920-2p,
  1542. 9502p, use=950-2p,
  1543. 9504p, use=950-4p,
  1544. 950rv, use=950-rv,
  1545. 950rv2p, use=950-rv2p,
  1546. 950rv4p, use=950-rv4p,
  1547. aaadb, use=aaa-db,
  1548. c1004p, use=c100-4p,
  1549. c100rv, use=c100-rv,
  1550. c100rv4p, use=c100-rv4p,
  1551. c100rv4pna, use=c100-rv4pna,
  1552. c100rv4ppp, use=c100-rv4ppp,
  1553. c100rvna, use=c100-rvna,
  1554. c100rvpp, use=c100-rvpp,
  1555. c100rvs, use=c100-rvs,
  1556. c100s, use=c100-s,
  1557. c108-4, use=c108-4p,
  1558. c108-8, use=c108-8p,
  1559. c100-s|concept-s|concept100-s, use=c100,
  1560. c100-rvs|concept-rvs|concept100-rvs, use=c100-rv,
  1561. h19a|h19A, use=h19-a,
  1562. h19b, use=h19-b,
  1563. h19bs, use=h19-bs,
  1564. h19u, use=h19-u,
  1565. mime2as, use=mime2a-s,
  1566. mime2av, use=mime2a-v,
  1567. mimefb, use=mime-fb,
  1568. mimehb, use=mime-hb,
  1569. tvi2p, use=tvi-2p,
  1570. tvi9122p, use=tvi912-2p,
  1571. tvi9202p, use=tvi920-2p,
  1572. tvi9502p, use=tvi950-2p,
  1573. tvi9504p, use=tvi950-4p,
  1574. tvi950b, use=tvi950-b,
  1575. tvi950ns, use=tvi950-ns,
  1576. tvi950rv, use=tvi950-rv,
  1577. tvi950rv2p, use=tvi950-rv2p,
  1578. tvi950rv4p, use=tvi950-rv4p,
  1579. vt100am, use=vt100-am,
  1580. vt100nam, use=vt100-nam,
  1581. vt100s, use=vt100-s,
  1582. vt100w, use=vt100-w,
  1583. #
  1584. # END OF TERMINFO
  1585. #  ------------------------
  1586. //go.sysin dd *
  1587. echo 'x - =data/visual'
  1588. sed 's/^X//' <<'//go.sysin dd *' >=data/visual
  1589. #  # --------------------------------
  1590. #    @(#)visual    1.4    5/20/82
  1591. #
  1592. # visual: VISUAL
  1593. #
  1594. # The Visual 200 beeps when you type a character in insert mode.
  1595. # This is a horribly obnoxious misfeature, and some of the entries
  1596. # below try to get around the problem by ignoring the feature or
  1597. # turning it off when inputting a character.  They are said not to
  1598. # work well at 300 baud.  (You could always cut the wire to the bell!)
  1599. vi200|visual 200 with function keys,
  1600.     cr=^M, cud1=^J, ind=^J, bel=^G, lines#24, cols#80,
  1601.     il1=\EL, am, cub1=^H, ed=\Ey, el=\Ex$<4*>, clear=\Ev,
  1602.     cup=\EY%p1%' '%+%c%p2%' '%+%c, dch1=\EO$<4*>, dl1=\EM$<4*>,
  1603.     home=\EH, ich1=\Ei \b\Ej, is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek,
  1604.     kf0=\EP, kf1=\EQ, kf2=\ER, kf3=\E , kf4=\E!, kf5=\E", kf6=\E#,
  1605.     kf7=\E$, kf8=\E%, kf9=\E&,
  1606.     kcub1=\ED, kcuf1=\EC, kcuu1=\EA, kcud1=\EB, khome=\EH,
  1607.     cuf1=\EC, ht=^I, ri=\EI, cuu1=\EA, cvvis=\Ed, cnorm=\Ec,
  1608. vi200-rv-ic|visual 200 reverse video using insert char,
  1609.     rmir=\Ej, smir=\Ei, ich1@, use=vi200-rv,
  1610. # The older Visuals didn't come with function keys. This entry uses
  1611. # smkx and rmkx so that the keypad keys can be used as function keys.
  1612. # If your version of vi doesn't support function keys you may want
  1613. # to use vi200-f.
  1614. vi200-f|visual|visual 200 no function keys,
  1615.     cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24,
  1616.     il1=\EL, am, cub1=^H, ed=\Ey, el=\Ex$<4*>, clear=\Ev,
  1617.     cup=\EY%p1%' '%+%c%p2%' '%+%c, dch1=\EO$<4*>, dl1=\EM$<4*>,
  1618.     home=\EH, ich1=\Ei \b\Ej, is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek,
  1619.     smkx=\E=, rmkx=\E>,
  1620.     kf0=\E?p, kf1=\E?q, kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v,
  1621.     kf7=\E?w, kf8=\E?x, kf9=\E?y,
  1622.     kcub1=\ED, kcuf1=\EC, kcuu1=\EA, kcud1=\EB, khome=\EH,
  1623.     cuf1=\EC, ht=^I, ri=\EI, cuu1=\EA, cvvis=\Ed, cnorm=\Ec,
  1624. vi200-rv|visual 200 reverse video,
  1625.     smso=\E4, rmso=\E3, ri@, cvvis@, cnorm@, use=vi200,
  1626. vi200-ic|visual 200 using insert char,
  1627.     rmir=\Ej, smir=\Ei, ich1@, use=vi200,
  1628. //go.sysin dd *
  1629. exit
  1630.