PD Terminfo/Curses (part 9 of 11)

sources at genrad.UUCP sources at genrad.UUCP
Fri Dec 21 12:08:23 AEST 1984


This is part of a distribution of a public domain version of terminfo/curses
It is a rather large distribution, so I have broken it up into 11 modules
(each less than 64K long.) Each shar format module should end with the line
"exit".  This code is completely public domain, originally written by Pavel
Curtis of Cornell University.  This version has some small improvements and
bug fixes.

This unit contains:
	The last of the library, and the start of the terminal data.

Part 10 will be
	The end of the terminfo terminal data base.

----------------- cut here ----------------
: Run this shell script with "sh" not "csh"
PATH=:/bin:/usr/bin:/usr/ucb
export PATH
if test ! -d =src
then
    echo 'Making directory "=src"'
    mkdir =src
fi
echo 'x - =src/lib_tputs.c'
sed 's/^X//' <<'//go.sysin dd *' >=src/lib_tputs.c
X/*********************************************************************
*                         COPYRIGHT NOTICE                           *
**********************************************************************
*        This software is copyright (C) 1982 by Pavel Curtis         *
*                                                                    *
*        Permission is granted to reproduce and distribute           *
*        this file by any means so long as no fee is charged         *
*        above a nominal handling fee and so long as this            *
*        notice is always included in the copies.                    *
*                                                                    *
*        Other rights are reserved except as explicitly granted      *
*        by written permission of the author.                        *
*                Pavel Curtis                                        *
*                Computer Science Dept.                              *
*                405 Upson Hall                                      *
*                Cornell University                                  *
*                Ithaca, NY 14853                                    *
*                                                                    *
*                Ph- (607) 256-4934                                  *
*                                                                    *
*                Pavel.Cornell at Udel-Relay   (ARPAnet)                *
*                decvax!cornell!pavel       (UUCPnet)                *
*********************************************************************/

X/*
 *	tputs.c
 *
 *  $Log:	lib_tputs.c,v $
 * Revision 3.1  84/12/13  11:21:03  john
 * Revisions by Mark Horton
 * 
 * Revision 2.1  82/10/25  14:49:31  pavel
 * Added Copyright Notice
 * 
 * Revision 2.0  82/10/24  15:18:06  pavel
 * Beta-one Test Release
 * 
 * Revision 1.3  82/08/23  22:30:52  pavel
 * The REAL Alpha-one Release Version
 * 
 * Revision 1.2  82/08/19  19:11:38  pavel
 * Alpha Test Release One
 * 
 * Revision 1.1  82/08/12  18:46:00  pavel
 * Initial revision
 * 
 *
 */

static char RCSid[] =
	"$Header: lib_tputs.c,v 3.1 84/12/13 11:21:03 john Exp $";

#include <ctype.h>
#include <stdio.h>
#include "curses.h"
#include "curses.priv.h"
#include "term.h"


tputs(string, affcnt, outc)
char	*string;
int	affcnt;
int	(*outc)();
{
	float	number;
	int	baud = baudrate();
	char	null = '\0';
	int	i;

#ifdef TRACE
	if (_tracing)
	    _tracef("tputs(%s,%d,%o) called", string, affcnt, outc);
#endif

	if (pad_char)
	    null = pad_char[0];

	while (*string)
	{
	    if (*string != '$')
		(*outc)(*string);
	    else
	    {
		string++;
		if (*string != '<')
		{
		    (*outc)('$');
		    (*outc)(*string);
		}
		else
		{

		    number = 0;
		    string++;

		    if (!isdigit(*string) && *string != '.' || !index(string, '>')) {
			(*outc)('$');
			(*outc)('<');
			continue;
		    }
		    while (isdigit(*string))
		    {
			number = number * 10 + *string - '0';
			string++;
		    }

		    if (*string == '.')
		    {
			string++;
			if (isdigit(*string))
			{
			    number += (float) (*string - '0') / 10.;
			    string++;
			}
		    }

		    if (*string == '*')
		    {
			number *= affcnt;
			string++;
		    }

		    if (padding_baud_rate  &&  baud >= padding_baud_rate && !xon_xoff)
		    {
			number = ((baud / 10.) * number) / 1000.;
			
			for (i=0; i < number; i++)
			    (*outc)(null);
		    }

		} /* endelse (*string == '<') */
	    } /* endelse (*string == '$') */

	    if (*string == '\0')
		break;

	    string++;
	}
}


void
_outc(ch)
{
    putchar(ch);
}


putp(string)
{
#ifdef TRACE
	if (_tracing)
	    _tracef("putp(%s) called", string);
#endif
	tputs(string, 1, _outc);
}
//go.sysin dd *
echo 'x - =src/lib_trace.c'
sed 's/^X//' <<'//go.sysin dd *' >=src/lib_trace.c
X/*********************************************************************
*                         COPYRIGHT NOTICE                           *
**********************************************************************
*        This software is copyright (C) 1982 by Pavel Curtis         *
*                                                                    *
*        Permission is granted to reproduce and distribute           *
*        this file by any means so long as no fee is charged         *
*        above a nominal handling fee and so long as this            *
*        notice is always included in the copies.                    *
*                                                                    *
*        Other rights are reserved except as explicitly granted      *
*        by written permission of the author.                        *
*                Pavel Curtis                                        *
*                Computer Science Dept.                              *
*                405 Upson Hall                                      *
*                Cornell University                                  *
*                Ithaca, NY 14853                                    *
*                                                                    *
*                Ph- (607) 256-4934                                  *
*                                                                    *
*                Pavel.Cornell at Udel-Relay   (ARPAnet)                *
*                decvax!cornell!pavel       (UUCPnet)                *
*********************************************************************/

X/*
 *	lib_trace.c - Tracing/Debugging routines
 *
 *  $Log:	RCS/lib_trace.v $
 * Revision 2.1  82/10/25  14:49:35  pavel
 * Added Copyright Notice
 * 
 * Revision 2.0  82/10/24  15:18:09  pavel
 * Beta-one Test Release
 * 
 * Revision 1.3  82/08/23  22:30:57  pavel
 * The REAL Alpha-one Release Version
 * 
 * Revision 1.2  82/08/19  19:11:41  pavel
 * Alpha Test Release One
 * 
 * Revision 1.1  82/08/15  17:59:45  pavel
 * Initial revision
 * 
 *
 */

static char RCSid[] =
    "$Header:   RCS/lib_trace.v  Revision 2.1  82/10/25  14:49:35  pavel  Exp$";

#include "term.h"
#include "curses.h"
#include "curses.priv.h"


static int	tracefd;

_init_trace()
{
    	static int	been_here = 0;
	extern int	errno;
	extern char	*sys_errlist[];

	if (! been_here)
	{
	    been_here = 1;

	    if ((tracefd = creat("trace", 0644)) < 0)
	    {
		write(2, "curses: Can't open 'trace' file: ", 33);
		write(2, sys_errlist[errno], strlen(sys_errlist[errno]));
		write(2, "\n", 1);
		exit(1);
	    }
	}
}


traceon()
{
	_tracef("traceon() called");

    	_tracing = 1;
}


traceoff()
{
	_tracef("traceoff() called");

    	_tracing = 0;
}


_tracef(fmt, args)
char	*fmt;
int	args;
{
    	int	*parm = &args;
	char	buffer[256];
	char	*bufp = buffer;

	while (*fmt)
	{
	    if (*fmt == '%')
	    {
		fmt++;
		switch (*fmt)
		{
		    case 'd':
			addnum(&bufp, *(parm++), 10);
			break;

		    case 'o':
			addnum(&bufp, *(parm++), 8);
			break;

		    case 'c':
			*(bufp++) = *(parm++);
			break;

		    case 's':
			if (*parm)
			{
			    *(bufp++) = '"';
			    strcpy(bufp, *parm);
			    bufp += strlen(*parm);
			    *(bufp++) = '"';
			}
			else
			{
			    strcpy(bufp, "NULL");
			    bufp += 4;
			}
			parm++;
			break;
		}
	    }
	    else
		*(bufp++) = *fmt;

	    fmt++;
	}

	*(bufp++) = '\n';
	*bufp = '\0';
	write(tracefd, buffer, strlen(buffer));
}


static addnum(bufp, num, base)
char	**bufp;
int	num, base;
{
	int	a;

    	if (num < 0)
	{
	    num = -num;
	    *((*bufp)++) = '-';
	}

	if ((a = num / base) != 0)
	    addnum(bufp, a, base);
	*((*bufp)++) = '0' + (num % base);
}
//go.sysin dd *
echo 'x - =src/lib_tstp.c'
sed 's/^X//' <<'//go.sysin dd *' >=src/lib_tstp.c
X/*********************************************************************
*                         COPYRIGHT NOTICE                           *
**********************************************************************
*        This software is copyright (C) 1982 by Pavel Curtis         *
*                                                                    *
*        Permission is granted to reproduce and distribute           *
*        this file by any means so long as no fee is charged         *
*        above a nominal handling fee and so long as this            *
*        notice is always included in the copies.                    *
*                                                                    *
*        Other rights are reserved except as explicitly granted      *
*        by written permission of the author.                        *
*                Pavel Curtis                                        *
*                Computer Science Dept.                              *
*                405 Upson Hall                                      *
*                Cornell University                                  *
*                Ithaca, NY 14853                                    *
*                                                                    *
*                Ph- (607) 256-4934                                  *
*                                                                    *
*                Pavel.Cornell at Udel-Relay   (ARPAnet)                *
*                decvax!cornell!pavel       (UUCPnet)                *
*********************************************************************/

X/*
**	lib_tstp.c
**
**	The routine tstp().
**
** $Log:	RCS/lib_tstp.v $
 * Revision 2.1  82/10/25  14:49:39  pavel
 * Added Copyright Notice
 * 
 * Revision 2.0  82/10/25  13:50:01  pavel
 * Beta-one Test Release
 * 
**
*/

static char RCSid[] =
	"$Header:   RCS/lib_tstp.v  Revision 2.1  82/10/25  14:49:39  pavel  Exp$";

#include "term.h"
#include "curses.h"
#include "curses.priv.h"
#include <signal.h>


static
outc(ch)
char	ch;
{
    	putc(ch, SP->_ofp);
}


tstp()
{
#ifdef TRACE
	if (_tracing)
	    _tracef("tstp() called");
#endif

	endwin();

	kill(0, SIGTSTP);
	signal(SIGTSTP, tstp);

	fixterm();
	flushinp();
	tputs(enter_ca_mode, 1, outc);
	wrefresh(curscr);
}
//go.sysin dd *
echo 'x - =src/lib_unctrl.c'
sed 's/^X//' <<'//go.sysin dd *' >=src/lib_unctrl.c
X/*********************************************************************
*                         COPYRIGHT NOTICE                           *
**********************************************************************
*        This software is copyright (C) 1982 by Pavel Curtis         *
*                                                                    *
*        Permission is granted to reproduce and distribute           *
*        this file by any means so long as no fee is charged         *
*        above a nominal handling fee and so long as this            *
*        notice is always included in the copies.                    *
*                                                                    *
*        Other rights are reserved except as explicitly granted      *
*        by written permission of the author.                        *
*                Pavel Curtis                                        *
*                Computer Science Dept.                              *
*                405 Upson Hall                                      *
*                Cornell University                                  *
*                Ithaca, NY 14853                                    *
*                                                                    *
*                Ph- (607) 256-4934                                  *
*                                                                    *
*                Pavel.Cornell at Udel-Relay   (ARPAnet)                *
*                decvax!cornell!pavel       (UUCPnet)                *
*********************************************************************/

X/*
 * define unctrl codes for each character
 *
 *  $Log:	RCS/lib_unctrl.v $
 * Revision 2.1  82/10/25  14:49:42  pavel
 * Added Copyright Notice
 * 
 * Revision 2.0  82/10/24  15:18:12  pavel
 * Beta-one Test Release
 * 
 * Revision 1.3  82/08/23  22:31:04  pavel
 * The REAL Alpha-one Release Version
 * 
 * Revision 1.2  82/08/19  19:11:43  pavel
 * Alpha Test Release One
 * 
 * Revision 1.1  82/08/12  18:46:42  pavel
 * Initial revision
 * 
 *
 */

static char RCSid[] =
	"$Header:   RCS/lib_unctrl.v  Revision 2.1  82/10/25  14:49:42  pavel  Exp$";

X/* LINTLIBRARY */
char	*_unctrl[]	= {	/* unctrl codes for ttys		*/
	"^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K",
	"^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
	"^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_",
	" ", "!", "\"", "#", "$",  "%", "&", "'", "(", ")", "*", "+", ",", "-",
	".", "/", "0",  "1", "2",  "3", "4", "5", "6", "7", "8", "9", ":", ";",
	"<", "=", ">",  "?", "@",  "A", "B", "C", "D", "E", "F", "G", "H", "I",
	"J", "K", "L",  "M", "N",  "O", "P", "Q", "R", "S", "T", "U", "V", "W",
	"X", "Y", "Z",  "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e",
	"f", "g", "h",  "i", "j",  "k", "l", "m", "n", "o", "p", "q", "r", "s",
	"t", "u", "v",  "w", "x",  "y", "z", "{", "|", "}", "~", "^?"
};
//go.sysin dd *
echo 'x - =src/lib_vidattr.c'
sed 's/^X//' <<'//go.sysin dd *' >=src/lib_vidattr.c
X/*********************************************************************
*                         COPYRIGHT NOTICE                           *
**********************************************************************
*        This software is copyright (C) 1982 by Pavel Curtis         *
*                                                                    *
*        Permission is granted to reproduce and distribute           *
*        this file by any means so long as no fee is charged         *
*        above a nominal handling fee and so long as this            *
*        notice is always included in the copies.                    *
*                                                                    *
*        Other rights are reserved except as explicitly granted      *
*        by written permission of the author.                        *
*                Pavel Curtis                                        *
*                Computer Science Dept.                              *
*                405 Upson Hall                                      *
*                Cornell University                                  *
*                Ithaca, NY 14853                                    *
*                                                                    *
*                Ph- (607) 256-4934                                  *
*                                                                    *
*                Pavel.Cornell at Udel-Relay   (ARPAnet)                *
*                decvax!cornell!pavel       (UUCPnet)                *
*********************************************************************/

X/*
 *	vidputs(newmode, outc)
 *
 *	newmode is taken to be the logical 'or' of the symbols in curses.h
 *	representing graphic renditions.  The teminal is set to be in all of
 *	the given modes, if possible.
 *
 *	if set-attributes exists
 *		use it to set exactly what you want
 *	else
 *		if exit-attribute-mode exists
 *			turn off everything
 *		else
 *			turn off those which can be turned off and aren't in
 *			newmode.
 *		turn on each mode which should be on and isn't, one by one
 *
 *	NOTE that this algorithm won't achieve the desired mix of attributes
 *	in some cases, but those are probably just those cases in which it is
 *	actually impossible, anyway, so...
 *
 *  $Log:	RCS/lib_vidattr.v $
 * Revision 2.1  82/10/25  14:49:45  pavel
 * Added Copyright Notice
 * 
 * Revision 2.0  82/10/24  15:18:15  pavel
 * Beta-one Test Release
 * 
 * Revision 1.3  82/08/23  22:31:08  pavel
 * The REAL Alpha-one Release Version
 * 
 * Revision 1.2  82/08/19  19:11:46  pavel
 * Alpha Test Release One
 * 
 * Revision 1.1  82/08/12  18:48:23  pavel
 * Initial revision
 * 
 *
 */

static char RCSid[] =
	"$Header:   RCS/lib_vidattr.v  Revision 2.1  82/10/25  14:49:45  pavel  Exp$";

#include "curses.h"
#include "curses.priv.h"
#include "term.h"


vidputs(newmode, outc)
unsigned newmode;
int	 (*outc)();
{
	static unsigned		previous_attr = 0;
	       unsigned		turn_off, turn_on;

#ifdef TRACE
	if (_tracing)
	    _tracef("vidputs(%o,%o) called", newmode, outc);
#endif

	if (set_attributes)
	{
	    tputs(tparm(set_attributes,
			(newmode & A_STANDOUT) != 0,
			(newmode & A_UNDERLINE) != 0,
			(newmode & A_REVERSE) != 0,
			(newmode & A_BLINK) != 0,
			(newmode & A_DIM) != 0,
			(newmode & A_BOLD) != 0,
			(newmode & A_INVIS) != 0,
			(newmode & A_PROTECT) != 0,
			(newmode & A_ALTCHARSET) != 0), 1, outc);
	}
	else
	{
	    if (exit_attribute_mode)
		tputs(exit_attribute_mode, 1, outc);
	    else
	    {
		turn_off = ~newmode & previous_attr;

		if ((turn_off & A_UNDERLINE)  &&  exit_underline_mode)
		    tputs(exit_underline_mode, 1, outc);

		if ((turn_off & A_STANDOUT)  &&  exit_standout_mode)
		    tputs(exit_standout_mode, 1, outc);

		if ((turn_off & A_ALTCHARSET)  &&  exit_alt_charset_mode)
		    tputs(exit_alt_charset_mode, 1, outc);
	    }

	    turn_on = newmode & ~previous_attr;

	    if ((turn_on & A_ALTCHARSET)  &&  enter_alt_charset_mode)
		tputs(enter_alt_charset_mode, 1, outc);

	    if ((turn_on & A_BLINK)  &&  enter_blink_mode)
		tputs(enter_blink_mode, 1, outc);

	    if ((turn_on & A_BOLD)  &&  enter_bold_mode)
		tputs(enter_bold_mode, 1, outc);

	    if ((turn_on & A_INVIS)  &&  enter_secure_mode)
		tputs(enter_secure_mode, 1, outc);

	    if ((turn_on & A_DIM)  &&  enter_dim_mode)
		tputs(enter_dim_mode, 1, outc);

	    if ((turn_on & A_PROTECT)  &&  enter_protected_mode)
		tputs(enter_protected_mode, 1, outc);

	    if ((turn_on & A_REVERSE)  &&  enter_reverse_mode)
		tputs(enter_reverse_mode, 1, outc);

	    if ((turn_on & A_STANDOUT)  &&  enter_standout_mode)
		tputs(enter_standout_mode, 1, outc);

	    if ((turn_on & A_UNDERLINE)  &&  enter_underline_mode)
		tputs(enter_underline_mode, 1, outc);
	}

	previous_attr = newmode;
}



vidattr(newmode)
unsigned	newmode;
{
    void	_outc();

#ifdef TRACE
	if (_tracing)
	    _tracef("vidattr(%o) called", newmode);
#endif

    vidputs(newmode, _outc);
}
//go.sysin dd *
echo 'x - =src/read_entry.c'
sed 's/^X//' <<'//go.sysin dd *' >=src/read_entry.c
X/*********************************************************************
*                         COPYRIGHT NOTICE                           *
**********************************************************************
*        This software is copyright (C) 1982 by Pavel Curtis         *
*                                                                    *
*        Permission is granted to reproduce and distribute           *
*        this file by any means so long as no fee is charged         *
*        above a nominal handling fee and so long as this            *
*        notice is always included in the copies.                    *
*                                                                    *
*        Other rights are reserved except as explicitly granted      *
*        by written permission of the author.                        *
*                Pavel Curtis                                        *
*                Computer Science Dept.                              *
*                405 Upson Hall                                      *
*                Cornell University                                  *
*                Ithaca, NY 14853                                    *
*                                                                    *
*                Ph- (607) 256-4934                                  *
*                                                                    *
*                Pavel.Cornell at Udel-Relay   (ARPAnet)                *
*                decvax!cornell!pavel       (UUCPnet)                *
*********************************************************************/

X/*
 *	read_entry.c -- Routine for reading in a compiled terminfo file
 *
 *  $Log:	read_entry.c,v $
 * Revision 3.1  84/12/13  11:21:14  john
 * Revisions by Mark Horton
 * 
 * Revision 2.1  82/10/25  14:49:55  pavel
 * Added Copyright Notice
 * 
 * Revision 2.0  82/10/24  15:18:22  pavel
 * Beta-one Test Release
 * 
 * Revision 1.3  82/08/23  22:31:15  pavel
 * The REAL Alpha-one Release Version
 * 
 * Revision 1.2  82/08/19  19:11:49  pavel
 * Alpha Test Release One
 * 
 * Revision 1.1  82/08/12  22:25:13  pavel
 * Initial revision
 * 
 *
 */

static char RCSid[] =
	"$Header: read_entry.c,v 3.1 84/12/13 11:21:14 john Exp $";

#include <sys/types.h>
#include <sys/stat.h>
#include "term.h"
#include "object.h"

#define OFFSET_BUFSIZE	100

#define min(a, b)	((a) > (b)  ?  (b)  :  (a))

X/*
 *	int
 *	read_entry(filename, ptr)
 *
 *	Read the compiled terminfo entry in the given file into the
 *	structure pointed to by ptr, allocating space for the string
 *	table and placing its address in ptr->str_table.
 *
 */

#define swap(x)		(((x >> 8) & 0377) + 256 * (x & 0377))

static char	TermNames[128];	/* Buffer for terminal names for first term */
static char	StringTable[1024];	/* String table for first terminal  */

int
read_entry(filename, ptr)
char		*filename;
struct term	*ptr;
{
	struct stat	statbuf;
	int		fd;
	int		numread;
	int		num_strings;
	int		cur_string;
	char		*malloc();
	int		i;
	struct header	header;
	unsigned char	bytebuf[2];
	char		ch;
	union
	{
	    unsigned char    byte[2];
	    short            number;
	}		offset_buf[OFFSET_BUFSIZE];

	fd = open(filename, 0);

	if (fd < 0)
	    return(-1);

	read(fd, &header, sizeof(header));

	if (must_swap())
	{
	    header.magic = swap(header.magic);
	    header.name_size = swap(header.name_size);
	    header.bool_count = swap(header.bool_count);
	    header.num_count = swap(header.num_count);
	    header.str_count = swap(header.str_count);
	    header.str_size = swap(header.str_size);
	}

	if (header.magic != MAGIC)
	{
	    close(fd);
	    return(-1);
	}

	read(fd, TermNames, min(127, header.name_size));
	TermNames[127] = '\0';
	ptr->term_names = TermNames;
	if (header.name_size > 127)
	    lseek(fd, (long) (header.name_size - 127), 1);

	read(fd, ptr->Booleans, min(BOOLCOUNT, header.bool_count));
	if (header.bool_count > BOOLCOUNT)
	    lseek(fd, (long) (header.bool_count - BOOLCOUNT), 1);
	else
	    for (i=header.bool_count; i < BOOLCOUNT; i++)
		ptr->Booleans[i] = 0;

	if ((header.name_size + header.bool_count) % 2 != 0)
	    read(fd, &ch, 1);

	if (must_swap())
	    read(fd, ptr->Numbers, min(NUMCOUNT, header.num_count * 2));
	else
	{
	    for (i=0; i < min(header.num_count, NUMCOUNT); i++)
	    {
		read(fd, bytebuf, 2);
		if (bytebuf[0] == 0377  &&  bytebuf[1] == 0377)
		    ptr->Numbers[i] = -1;
		else
		    ptr->Numbers[i] = bytebuf[0] + 256 * bytebuf[1];
	    }
	}

	if (header.num_count > NUMCOUNT)
	    lseek(fd, (long) (2 * (header.num_count - NUMCOUNT)), 1);
	else
	    for (i=header.num_count; i < NUMCOUNT; i++)
		ptr->Numbers[i] = -1;

	if (cur_term)	/* cur_term is non-zero only if we've been called */
	{
	    ptr->str_table = malloc(header.str_size);
	    if (ptr->str_table == NULL)
	    {
		close(fd);
		return (-1);
	    }
	}
	else
	    ptr->str_table = StringTable;

	num_strings = min(STRCOUNT, header.str_count);
	cur_string = 0;

	while (num_strings > 0)
	{
	    numread = read(fd, offset_buf, 2*min(num_strings, OFFSET_BUFSIZE));
	    if (numread <= 0)
	    {
		close(fd);
		return(-1);
	    }

	    if (must_swap())
	    {
		for (i = 0; i < numread / 2; i++)
		{
		    ptr->Strings[i + cur_string] =
			(offset_buf[i].byte[0] == 0377
					    &&  offset_buf[i].byte[1] == 0377)
			? 0
			: ((offset_buf[i].byte[0] + 256*offset_buf[i].byte[1])
							      + ptr->str_table);
		}
	    }
	    else
	    {
		for (i = 0; i < numread / 2; i++)
		{
		    ptr->Strings[i + cur_string] =
			(offset_buf[i].number == -1)
			?
			    0
			:
			    offset_buf[i].number + ptr->str_table;
		}
	    }

	    cur_string += numread / 2;
	    num_strings -= numread / 2;
	}

	if (header.str_count > STRCOUNT)
	    lseek(fd, (long) (2 * (header.str_count - STRCOUNT)), 1);
	else
	    for (i=header.str_count; i < STRCOUNT; i++)
		ptr->Strings[i] = 0;

	numread = read(fd, ptr->str_table, header.str_size);
	close(fd);
	if (numread != header.str_size)
	    return(-1);

	return(0);
}



X/*
 *	int
 *	must_swap()
 *
 *	Test whether this machine will need byte-swapping
 *
 */

int
must_swap()
{
	union
	{
	    short num;
	    char  byte[2];
	}		test;

	test.num = 1;
	return(test.byte[1]);
}
//go.sysin dd *
echo 'x - =src/xx.ti'
sed 's/^X//' <<'//go.sysin dd *' >=src/xx.ti
xaa-a|foobar a,
	cud1=ctrlK, cub1=ctrlH, cuf1=esc[C, cuu1=esc[A,
	use=ansi+local,
	clear=esc[Hesc[J$<156>, el=esc[K$<5>, ed=esc[J,
xaa-b,
	is1=esc[7mesc7esc[Hesc9esc8,
xaa-c|foobar c,
	is2=\r\nesc[Aesc7esc[60;1;0;30pesc8, lines#29,
	use=xaa-a,
xaa-d|foobar d,
	use=xaa-b, use=xaa-c,
xaa-e|foobar e,
	smcup=esc[30;1Hesc[Kesc[30;1;0;30p,
	use=xaa-d,
xaa-f,
	cup=esc[%i%p1%d;%p2%dH, home=esc[H, bold=esc[1m,
//go.sysin dd *
if test ! -d =data
then
    echo 'Making directory "=data"'
    mkdir =data
fi
echo 'x - =data/misc'
sed 's/^X//' <<'//go.sysin dd *' >=data/misc
# # --------------------------------
#	@(#)misc	1.8	5/20/82
#
# misc: MISCELLANEOUS TERMINALS
#
# ----------------------------------------------------------------
#
# BB&N BitGraph
# The function keys kf0-kf9 are the codes generated by the keypad keys 0-9
# NOTE that this means that PF1-PF4 are not represented here at all.
bg|bitg|bitgraph|BBN BitGraph,
	msgr, xon, cols#85, lines#64,
	bel=^G, cr=^M, tbc=\E[g, clear=\E[H\E[J, el=\E[K, ed=\E[J,
	cup=\E[%i%p1%d;%p2%dH, home=\E[H,
	cub=\E[%p1%dD, cub1=\E[D, cuf=\E[%p1%dC, cuf1=\E[C,
	cud=\E[%p1%dB, cud1=\E[B, cuu=\E[%p1%dA, cuu1=\E[A,
	dl=\E[%p1%dM, dl1=\E[M, il=\E[%p1%dL, il1=\E[L,
#	dch=\E[%p1%dP, dch1=\E[P, ich=\E[%p1%d@, ich1=\E[@,
	smso=\E[4m, rmso=\E[m, smul=\E[4m, rmul=\E[m,
	bold=\E[m, rev=\E[7m, sgr0=\E[m,
	sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m,
	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=,
	kbs=^H, kcud1=\E[B, kcub1=\E[D, kcuf1=\E[C, kcuu1=\E[A,
	kf0=\EOp, kf1=\EOq, kf2=\EOr, kf3=\EOs, kf4=\EOt,
	kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy,
	sc=\E7, rc=\E8, ind=\ED, ri=\EM, nel=\EE,
	hts=\EH, ht=^I,
#
# Vanilla ANSI terminal.  This is assumed to implement all the normal
# ANSI stuff with no extensions.  It assumes insert/delete line/char
# is there, so it won't work with vt100 clones.  It assumes video
# attributes for bold, blink, underline, and reverse, which won't
# matter much if the terminal can't do some of those.  Padding is
# assumed to be zero, which shouldn't hurt since xon/xoff is assumed.
# This entry is based on the Ann Arbor Ambassador.
ansi|generic ansi standard terminal,
	cr=^M, cud1=^J, ind=^J, bel=^G, il1=\E[L, am, cub1=^H, ed=\E[J,
	el=\E[K, clear=\E[H\E[J, cup=\E[%i%p1%d;%p2%dH, cols#80, lines#24,
	dch1=\E[P, dl1=\E[M, home=\E[H,
	ich=\E[%p1%d@, ich1=\E[@, smir=\E6, rmir=\E6,
	bold=\E[1m, rev=\E[7m, blink=\E[5m, invis=\E[8m, sgr0=\E[0m,
	sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m,
	kcuu1=\E[A, kcud1=\E[B, kcub1=\E[D, kcuf1=\E[C, khome=\E[H, kbs=^H,
	cuf1=\E[C, ht=^I, cuu1=\E[A, xon, rep=%p1%c\E[%p2%{1}%-%db,
	rmul=\E[m, smul=\E[4m, rmso=\E[m, smso=\E[7m,
# The tab 132 uses xon/xoff, so no padding needed.
# smkx/rmkx have nothing to do with arrow keys.
# is2 sets 80 col mode, normal video, autowrap on (for am).
# Seems to be no way to get rid of status line.
tab132|tab|tab 132/15,
	is2=\E[?7h\E[?3l\E[?5l, smkx@, rmkx@, cr=^M, cud1=^J, ind=^J,
	bel=^G, lm#96, da, db, il1=\E[L, dl1=\E[M, dch1=\E[P,
	rmir=\E[4l, smir=\E[4h, cup=\E[%i%p1%d;%p2%dH,
	kcuu1=\E[A, kcud1=\E[B, kcub1=\E[D, use=vt100,
tab132w,
	cols#132, is2=\E[?7h\E[?3h\E[?5l, use=tab132,
tab132rv,
	is2=\E[?7h\E[?3l\E[?5h, use=tab132,
tab132wrv,
	is2=\E[?7h\E[?3h\E[?5h, use=tab132w,
# This used to say "de#001202" which presumably refers to the stty bits
# that need to be set for some version of Unix.  We need the real delay
# requirements here.
mw2|Multiwriter 2,
	cr=^M, cud1=^J, ind=^J, bel=^G, cols#132, hc, os,
trs80|trs-80|Radio Shack TRS-80 model I,
	cr=^M, cud1=^J, ind=^J, bel=^G,
	am, cub1=^H, cols#64, lines#16,
# I think the direct is supposed to be vt100 compatible, so all this
# should probably be replaced by a use=vt100, but I can't test it.
d800|direct|direct800|Direct 800/A,
	cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, am,
	clear=\E[1;1H\E[2J, cub1=^H, cup=\E[%i%p1%d;%p2%dH,
	cuf1=\E[C, cuu1=\E[A, el=\E[K, ed=\E[J, smso=\E[7m, rmso=\E[0m,
	smul=\E[4m, rmul=\E[0m, xhp, cvvis=\E[>12l, cnorm=\E[>12h,
	ind=\ED, ri=\EM, da, db, rmacs=\E[1m, smacs=\E[0m, msgr, ht=^I, 
	kcub1=\E[D, kcuf1=\E[C, kcuu1=\E[A, kcud1=\E[B,
	kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
	kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW,
vc404|volker-craig 404,
	cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=^W$<40>, el=^V$<20>,
	clear=^X$<40>, cup=^P%p1%' '%+%c%p2%' '%+%c, cols#80, home=^Y$<40>,
	kcud1=^J, kcub1=^H, kcuf1=^U, kcuu1=^Z, lines#24, cuf1=^U, cuu1=^Z,
vc404s|volker-craig 404 w/standout mode,
	cr=^M, cud1=^J, ind=^J, bel=^G, rmso=^O, smso=^N, use=vc404,
vc404na|volker-craig 404 w/no arrow keys,
	kcuf1@, kcuu1@, use=vc404,
vc404sna|volker-craig 404 w/standout mode and no arrow keys,
	rmso=^O, smso=^N, use=vc404na,
# missing in vc303a and vc303 descriptions:  they scroll 2 lines at a time
# every other linefeed.
vc303a|vc403a|volker-craig 303a,
	cr=^M, cud1=^J, bel=^G, am, cub1=^H, el=^V$<20>, clear=^X$<40>,
	cols#80, home=^Y$<40>, kcud1=^J, kcub1=^H, kcuf1=^U,
	kcuu1=^Z, lines#24, ll=^P^@W, cuf1=^U, cuu1=^Z,
vc303|vc103|vc203|volker-craig 303,
	cr=^M, cud1=^J, bel=^G, am, cub1=^H, clear=^L$<40>, cols#80,
	home=^K$<40>, kcud1=^J, kcub1=^H, kcuf1=^I, kcuu1=^N, lines#24,
	ll=^O$<1>W, cuf1=^I, cuu1=^N,
# From cbosg!ucbvax!SRC:george Fri Sep 11 22:38:32 1981
ampex|d80|dialogue|dialogue80|ampex dialogue 80,
	tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G,
	is2=\EA, smul=\El, rmul=\Em,
	am, cub1=^H, ht=^I, clear=\E*$<75>, cup=\E=%p1%' '%+%c%p2%' '%+%c,
	il1=\EE$<5*>, cbt=\EI, ich1=\EQ, dl1=\ER$<5*>, dch1=\EW,
	el=\Et, ed=\Ey, smso=\Ej, rmso=\Ek, lines#24, cols#80, cuf1=^L, cuu1=^K,
d132|datagraphix|datagraphix 132a,
	cr=^M, cud1=^J, ind=^J, bel=^G,
	cols#80, lines#30, clear=^l, home=\Et, da, db, ind=\Ev, ri=\Ew,
	cuu1=\Ek, cuf1=\El, cvvis=\Ex, cnorm=\Em\En,
	il1=\E3, ich1=\E5, dch1=\E6, in, ich1=\E5,
soroc|Soroc 120,
	cr=^M, cud1=^J, ind=^J, bel=^G,
	ed=\EY, el=\ET, clear=\E*$<2>,
	kcub1=^H, kcuu1=^K, kcuf1=^L, kcud1=^J, use=adm3a,
# tec is2 untested, and taken from CB/Unix virtual terminal driver.
# Upper case terminal, uses lower case for control sequences!!!
# The driver shows the C ~ operator used on CM coordinates.
tec400|tec scope,
	cr=^M, cud1=^J, ind=^J, bel=^G, cup=l%p2%~%c%p1%~%c,
	cuu1=x, cud1=h, cuf1=g, cub1=w, home=i, smso={, rmso=|,
	xmc#1, clear=f, il1=e, dl1=u, ich1=d, dch1=t, el=c, ed=s,
# From ucbvax!geoff Mon Sep 21 21:15:45 1981 
# This entry has been tested.
tec500|tec 500,
	cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H,
	cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z$<20>,
	cols#80, home=^^, lines#24, cuf1=^L, cuu1=^K, smso=^], rmso=^\,
# I would appreciate more information on this terminal, such as the
# manufacturer and the model number.  There are too many 'tecs' in here.
tec,
	lines#24, cols#80, clear=^l, cuu1=^k, cuf1=\037, am,
	cub1=^H, home=\036, cr=^M, cud1=^J, ind=^J, bel=^G,
teletec|Teletec Datascreen,
	cr=^M, cud1=^J, ind=^J, bel=^G,
	am, cub1=^H, cols#80, clear=^l, home=^^, lines#24, cuf1=^_, cuu1=^k,
aed512|aed|AED 512,
	if=/usr/lib/tabset/aed,
	cr=^M, cud1=^J, bel=^G,
	cols#64, lines#40, clear=^L,
	cub1=^H, cuf1=\Ei0800\001,
	cnorm=\E\072004=000200??\001,
	flash=\EK0001??0000K0001202080\001,
	smso=\E\07200>8000140[80C00\001, rmso=\E[00C80\001,
	smul=\E\07200>8000140\001, rmul=\E\07200>8000100\001,
	uc=\Ei???>l0800i0102\001,
	smcup=\E\07200>8000140{<04<0??00001010L<0\072004=0002??00\001,
	rmcup=\E\07200>8000100{804<0??00001000L80\072004=000200??\001,
	ind=\E;1100\072004=000200??;1300\047\200\001\n\E\072004=0002??00;1200\001\n,
	cuu1=^K, .cup=\E;1300%p1%c%p2%c\001,
digilog|333|digilog 333,
	cub1=^H, cols#80, el=\030, home=^n, lines#16, cuf1=^i, cuu1=^o,
	cr=^M, cud1=^J, ind=^J, bel=^G,
ep48|ep4080|execuport 4080,
	am, cub1=^H, os, cols#80, hu=\036, hd=\034,
	cr=^M, cud1=^J, ind=^J, bel=^G,
ep40|ep4000|execuport 4000,
	am, cub1=^H, os, cols#136, hu=\036, hd=\034,
	cr=^M, cud1=^J, ind=^J, bel=^G,
terminet1200|terminet300|tn1200|tn300|terminet|ge terminet 1200,
	cols#120, hc, os,
	cr=^M, cud1=^J, ind=^J, bel=^G,
datapoint|dp3|dp3360|datapoint 3360,
	cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H,
	ed=^_, el=^^, clear=^]^_, cols#82, home=^], lines#25, cuf1=^x, cuu1=^z,
dg|dg6053|data general 6053,
	cr=^M, cud1=^J, ind=^J, bel=^G,
	am, cub1=^H, cup=^P%p2%c%p1%c, clear=^L, home=^H, cuf1=^S,
	cuu1=^W, el=^K, cols#80, lines#24,
cdi|cdi1203,
	am, cub1=^H, hc, os, cols#80,
	cr=^M$<200>, cud1=^J, ind=^J, bel=^G,
# ^S is an arrow key!  Boy is this guy in for a surprise on v7!
sol,
	cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, cup=\E^1%p1%c\E^2%p2%c,
	clear=^K, home=^N, cols#64, lines#16, cuf1=^S, cuu1=^W,
	kcub1=^A, kcuf1=^S, kcuu1=^W, kcud1=^Z,
xl83|cybernex XL-83,
	cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, ed=^P$<62>, el=^O$<3>,
	clear=^L$<62>, cup=^W%p1%' '%+%c%p2%' '%+%c, cols#80, home=^K,
	kcud1=^J, kcub1=^H, kcuu1=^N, lines#24, cuu1=^N, cuf1=^I,
omron|Omron 8025AG,
	cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL, am, cub1=^H, ed=\ER,
	cols#80, el=\EK, clear=\EJ, da, db, dch1=\EP, dl1=\EM, home=\EH,
	lines#24, cuf1=\EC, rmso=\E4, ind=\ES, smso=\Ef, ri=\ET,
	cuu1=\EA, cnorm=, cvvis=\EN,
plasma|plasma panel,
	am, cub1=^H, clear=^L, cols#85, home=^^, lines#45, cuf1=\030, cuu1=\026,
	cr=^M, cud1=^J, ind=^J, bel=^G,
swtp|ct82|Southwest Technical Products CT82,
	cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H, il1=^\^y,
	ed=^v, el=^F, clear=^L, cup=^k%p2%c%p1%c, cols#82, lines#20, dl1=^z,
	cuf1=^s, cuu1=^a, smso=^^^v, rmso=^^^F, dch1=^\^h, ich1=^\^x, home=^p,
	ind=^n, ri=^o, ll=^c,
	is2=^\^r^^^s^^^d^]^w^i^s^^^]^^^o^]^w^r^i,
terak|Terak emulating Datamedia 1520,
	use=dm1520,
remote|virtual remote terminal,
	cols#79, am@, use=virtual,
virtual|CB-UNIX virtual terminal,
	cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, am, clear=\E\112,
	cub1=^H, cup=\E\107%p2%c%p1%c, cuf1=\E\103, cuu1=\E\101, el=\E\113,
	ed=\E\114, il1=\E\120, dl1=\E\116, ich1=\E\117, lm#0, da, db,
	kcub1=\E\104, kcuf1=\E\103, kcuu1=\E\101, kcud1=\E\102, khome=\E\105,
	smso=\E\141\004, rmso=\E\142\004, smul=\E\141\001, rmul=\E\142\001,
# This is untested.  The cup sequence is hairy enough that it probably
# needs work.  The idea is ctrl(O), dd(row), dd(col), where dd(x)
# is x - 2*(x%16) + '9'
delta|dd5000|delta data 5000,
	cud1=^J, ind=^J, bel=^G, am, cub1=^H, clear=^NR,
	cup=^O%p1%p1%{16}%m%{2}%*%-%'9'%+%c%p2%p2%{16}%m%{2}%*%-%'9'%+%c,
	cols#80, lines#27, home=^NQ, cuf1=^Y, cuu1=^Z, el=^NU, dch1=^NV,
mdl110|cybernex mdl-110,
	cup=^P%p1%' '%+%c%p2%' '%+%c, cols#80, lines#24, am, clear=^X$<70>,
	cub1=^H, cr=^M, cud1=^J, ind=^J, bel=^G, cuf1=^U, cuu1=^Z, home=^Y,
	el=^N@^V$<145>, ed=^NA^W$<145>, il1=^NA^N^]$<65>, dl1=^NA^N^^$<40>,
	ich1=^NA^]$<3.5>, smdc=, rmdc=, dch1=^NA^^$<3.5>, smso=^NF, rmso=^NG,
	ht=\t$<43>, ed=^N@^V$<6>,
zen30|z30|zentec 30,
	cr=^M, cud1=^J, ind=^J, bel=^G, mir, cols#80, lines#24,
	ul, il1=\EE$<1.5*>, cub1=^H, el=\ET$<1.0*>,
	cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=\E*, home=^^, cuf1=^L,
	rmso=\EG0, smso=\EG6, cuu1=^K, smir=\Eq, rmir=\Er,
	am, dch1=\EW, dl1=\ER$<1.5*>, ed=\EY,
# Test version for Falco ts-1. See "arpavax.hickman at ucb" for info
falco|ts1|ts-1|falco ts-1,
	cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, ht=^I,
	is2=\Eu\E3, il1=\EE, am, el=\ET\EG0^H, cup=\E=%p1%' '%+%c%p2%' '%+%c,
	clear=\E*, ed=\EY, dch1=\EW, cub1=^H, dl1=\ER, rmir=\Er, smir=\Eq,
	home=^^, kf0=^A0\r, kcud1=^J, kcub1=^H, kcuf1=^L, kcuu1=^K, cuf1=^L,
	rmso=\Eg0, smso=\Eg1, cuu1=^K, smul=\Eg1, rmul=\Eg0,
//go.sysin dd *
echo 'x - =data/perkinelmer'
sed 's/^X//' <<'//go.sysin dd *' >=data/perkinelmer
# # --------------------------------
#	@(#)perkinelmer	1.4	5/19/82
#
# perkinelmer: PERKIN ELMER
#
bantam|pe550|perkin elmer 550,
	cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, cols#80, el=\EI$<20>,
	clear=\EK$<20>, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c, home=\EH,
	lines#24, ll=\EH\EA, cuf1=\EC, cuu1=\EA, ed=^N@^V$<6>,
fox|perkin elmer 1100,
	tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, am, cub1=^H,
	ed=\EJ$<5.5*>, el=\EI, clear=\EH\EJ$<132>, cols#80, home=\EH, lines#24,
	ll=\EH\EA, cuf1=\EC, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c,
	cuu1=\EA, flash=^P^B^P^C,
owl|perkin elmer 1200,
	tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL$<5.5*>,
	am, cub1=^H, ed=\EJ$<5.5*>, el=\EI$<5.5>, clear=\EH\EJ$<132>, home=\EH,
	ll=\EH\EA, cup=\EX%p1%' '%+%c\EY%p2%' '%+%c, cols#80, dch1=\EO$<5.5*>,
	dl1=\EM$<5.5*>, ich1=\EN, ip=$<5.5*>, kbs=^h, in, lines#24,
	cuf1=\EC, cuu1=\EA, rmso=\E!\200, smso=\E!^H, flash=^P^B^P^C,
	kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, kf5=\ERE, kf6=\ERF,
	kf7=\ERG, kf8=\ERH, kf9=\ERI, kf0=\ERJ,
//go.sysin dd *
echo 'x - =data/print'
sed 's/^X//' <<'//go.sysin dd *' >=data/print
# # --------------------------------
#	@(#)print	1.1 print 5/19/82
#
# print: PRINTERS
#
# Generic line printer.  We assume it can backspace, since even those
# line printers that can't have this hidden by UNIX lpr driver.
lpr|lp|printer|print|printing|line printer,
	cr=^M, cud1=^J, ff=^L, bel=^G, cub1=^H, cols#132, hc, os,
citoh|ci8510|8510|c.itoh 8510a,
	cols#80, ri=\Er, bold=\E!, smul=\EX, rmul=\EY, sgr0=\E"\EY, 
	is2=\E(009\054017\054025\054033\054041\054049\054057\054065\054073.,
	rep=\ER%p2%3d%p1%c, use=lpr,
//go.sysin dd *
echo 'x - =data/special'
sed 's/^X//' <<'//go.sysin dd *' >=data/special
# # --------------------------------
#	@(#)special	1.5	5/19/82
#
# special: SPECIALS
#
# Generic "terminals".  These are used to label tty lines when you don't
# know what kind of terminal is on it.  The characteristics of an unknown
# terminal are the lowest common denominator - they look about like a ti 700.
arpanet|network,
	use=unknown,
bussiplexer,
	use=unknown,
dialup,
	use=unknown,
ethernet|network,
	use=unknown,
plugboard|patch|patchboard,
	use=unknown,
dumb,
	am, bel=^G, cols#80, cr=^M, cud1=^J, ind=^J,
unknown,
	gn, use=dumb,
switch|intelligent switch,
	use=unknown,
//go.sysin dd *
echo 'x - =data/tektronix'
sed 's/^X//' <<'//go.sysin dd *' >=data/tektronix
# # --------------------------------
#	@(#)tektronix	1.5	5/20/82
#
# tektronix: TEKTRONIX
#
tek|tek4012|4012|tektronix 4012,
	cr=^M, cud1=^J, bel=^G, ff=^L$<1000>,
	is2=\E^O, cub1=^H, clear=\E^L$<1000>, cols#75, lines#35, os,
tek4013|4013|tektronix 4013,
	rmacs=\E^N, smacs=\E^O, use=4012,
tek4014|4014|tektronix 4014,
	is2=\E^O\E9, cols#81, lines#38, use=tek4012,
tek4015|4015|tektronix 4015,
	rmacs=\E^N, smacs=\E^O, use=4014,
tek4014-sm|4014-sm|tektronix 4014 in small font,
	is2=\E^O\E\072, cols#121, lines#58, use=tek4014,
tek4015-sm|4015-sm|tektronix 4015 in small font,
	rmacs=\E^N, smacs=\E^O, use=4014-sm,
tek4023|4023|tex|tektronix 4023,
	cr=^M, cud1=^J, ind=^J, bel=^G, smso=^_P, rmso=^_@,
	cup=\034%p2%' '%+%c%p1%' '%+%c, cuf1=\t, cub1=^H,
	clear=\E^L$<4>, cols#80, lines#24, am, vt#4,
# Can't use cursor motion because it's memory relative, and because
# it only works in the workspace, not the monitor.  Same for home.
# Likewise, standout only works in the workspace.
# el was commented out since vi and rogue seem to work better simulating
# it with lots of spaces!
4025|4027|4024|tek4025|tek4027|tek4024|4025cu|4027cu|tektronix 4024/4025/4027,
	cr=^M, ind=^F^J, cud1=^F^J, bel=^G, am, da, db, ht=^I, 
	cub1=^H, lm#0, lines#34, cols#80, clear=^_era\r\n\n,
	is2=\41com 31\r\n^_sto 9 17 25 33 41 49 57 65 73\r,
	smkx=^_lea p4 /h/\r^_lea p8 /k/\r^_lea p6 / /\r^_lea p2 /j/\r^_lea f5 /H/\r,
	rmkx=^_lea p2\r^_lea p4\r^_lea p6\r^_lea p8\r^_lea f5\r,
	cuu1=^K, cuf1=^_rig\r, il1=^_up\r^_ili\r$<145>, dl1=^_dli\r^F,
	dch1=^_dch\r, smir=^_ich\r, rmir=^F^_dow\r^K,
	.el=^_dch 80\r, ed=^_dli 50\r, CC=^_,
	il=^_up\r^_ili %p1%d\r$<145>, dl1=^_dli %p1%d\r^F,
	cuu=^_up %p1%d\r, cud=^_dow %p1%d\r, cub=^_lef %p1%d\r, cuf=^_rig %p1%d\r,
4025-17|4027-17|tek 4025 17 line window,
	lines#17, use=4025,
4025-17ws|4027-17ws|tek 4025 17 line window in workspace,
	is2=\41com 31\r\n^_sto 9 17 25 33 41 49 57 65 73\r^_wor 17\r^_mon 17\r,
	smcup=^_wor h\r, rmcup=^_mon h\r, smso=^_att e\r, rmso=^_att s\r, use=4025-17,
4025ex|4027ex|tek 4025 w/!,
	smcup=\41com 31\r, rmcup=^_com 33\r,
	is2=^_com 33\r\n\41sto 9 17 25 33 41 49 57 65 73\r, use=4025,
# The 4110 series may be a wonderful graphics series, but they make the 4025
# look good for screen editing.  In the dialog area, you can't move the cursor
# off the bottom line.  Out of the dialog area, ^K moves it up, but there
# is no way to scroll.  Note that there is a floppy for free from Tek that
# makes the 4112 emulate the vt52 (use the vt52 termcap).  There is also
# an expected enhancement that will use ANSI standard sequences.
4112|4113|4114|tek4112|tektronix 4110 series,
	cub1=^H, cr=^M, cud1=^J, bel=^G, am,
	clear=\ELZ, lines#34, cols#80,
# 4112 in non-dialog area pretending to scroll.  It really wraps but vi is
# said to work (more or less) in this mode.
4112-fs,
	ind=^J, ri=^K,
4112-nd|4112 not in dialog area,
	cuu1=^K, use=4112,
4112-5|4112 in 5 line dialog area,
	lines#5, use=4112,
//go.sysin dd *
echo 'x - =data/teleray'
sed 's/^X//' <<'//go.sysin dd *' >=data/teleray
# # --------------------------------
#	@(#)teleray	1.4	5/19/82
#
# teleray: TELERAY
#
# Note two things called "teleray".  Reorder should move the common one
# to the front if you have either.  A dumb teleray with the cursor stuck
# on the bottom and no obvious model number is probably a 3700.
t3700|teleray|dumb teleray 3700,
	cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, clear=^L, cols#80, lines#24,
t3800|teleray 3800 series,
	cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, ed=\EJ, el=\EK, clear=^L,
	cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80,  
	cud1=\n, home=\EH, lines#24, ll=\EY7 , cuf1=\EC, ht=^I, cuu1=^K,
t1061|t10|teleray 1061,
	tbc=\EG, hts=\EF, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EL$<2*>,
	am, cub1=^H, ed=\EJ$<1>, el=\EK, clear=^L$<1>,
	cup=\EY%p1%' '%+%c%p2%' '%+%c, cols#80,
	dch1=\EQ, dl1=\EM$<2*>, home=\EH, ich1=\EP, ip=$<0.4*>,
	kf1=^Z1, kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, kf6=^Z6, kf7=^Z7, kf8=^Z8,
	lines#24, cuf1=\EC, ht=^I, rmso=\ER@, smso= \ERD, km,
	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,
	cuu1=\EA, smul=\ERH, rmul=\ER@, xhp, xt, xmc#1,
t1061f|teleray 1061 with fast PROMs,
	il1=\EL, ip@, dl1=\EM, use=t1061,
//go.sysin dd *
echo 'x - =data/teletype'
sed 's/^X//' <<'//go.sysin dd *' >=data/teletype
# # --------------------------------
#	@(#)teletype	1.7	5/19/82
#
# teletype: TELETYPE
#
# This works on the default blit, except that output is by exclusive or,
# and insert line leaves 1/2 line at the bottom of the screen.
blit|jerq,
	cr=^M, cud1=^J, ind=^J, bel=^G, cols#88, lines#72, ht=^I,
	am, ul, eo, mir, il=\Ef%p1%' '%+%c, dl=\Ee%p1%' '%+%c,
	dl1=\EE, rmir=\ER, smir=\EQ, dch1=\EO, cub1=\ED, da, db,
	il1=\EF, ed=\EJ, el=\EK, clear=^L, cup=\EY%p2%' '%+%c%p1%' '%+%c,
	cuf1=\EC, cuu1=\EA, kcuu1=\EA, kcud1=\EB, kcuf1=\EC, kcub1=\ED,
	flash=\E^G, smso=\EU!, rmso=\EV!, smul=\EU", rmul=\EV",
blitlayer|layer|vitty,
	cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24, ht=^I,
	am, clear=^L, cup=\EY%p2%' '%+%c%p1%' '%+%c, el=\EK, il=\EI, dl=\ED,
33|tty33|tty|model 33 teletype,
	cr=^M, cud1=^J, ind=^J, bel=^G, cols#72, hc, os,
# The Dataspeed 40's have lots of braindamage, such as xmc (?) and printing
# a visible newline indicator after each newline.  The 40-1 is a half duplex
# terminal and is hopeless.  The 40-2 is braindamaged but has hope and is
# described here.  The 40-4 is a 3270 lookalike and beyond hope.
# The terminal has blinking standout.  It also has visible bell but I don't
# know it - it's null here to prevent it from showing the BL character.
# I am not sure if the 40 has xmc or not, it looked like it didn't.
# Note also that the control characters have been randomly rearranged,
# for example, to get escape you type control-P!
40|tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2,
	clear=\ER$<160>, ed=\EJ$<160>, il1=\EL$<160>, dl1=\EM$<160>,
	dch1=\EP$<50>, ich1=\E\^$<50>, cuf1=\EC, cuu1=\E7, cub1=^H, cr=\EG,
	ind=^J, cud1=\EB, cols#80, lines#24, flash=, smso=\E3, rmso=\E4,
43|tty43|model 43 teletype,
	cr=^M, cud1=^J, ind=^J, bel=^G,
	kbs=^h, am, cub1=^H, hc, os, cols#132,
37|tty37|model 37 teletype,
	cr=^M, cud1=^J, ind=^J, bel=^G,
	cub1=^H, hc, hu=\E8, hd=\E9, cuu1=\E7, os,
# From jwb Wed Mar 31 13:25:09 1982 remote from ihuxp
# This description seems to avoid line 1 - I don't know why.
# It looks a lot like a vt100 with ins/del line/char.
# But the insert char is not ANSI standard!
4424|tty4424|teletype 4424m,
	il1=\EL, da, db, ip=$<2>, ich1=\E^, dch1=\EP, dl1=\EM,
	cols#80, lines#23, am, clear=\E[2;H\E[J, cub1=^H,
	cup=\E[%i%p1%2d;%p2%2dH\E[B,
	cuf1=\E[C, cuu1=\E[A, mir, ri=\ET,
	el=\E[K, smso=\E[7m, rmso=\E[m, smul=\E[4m, rmul=\E[m,
	is2=\E[m\E[2;24r,
	kcud1=\E[B, kcub1=\E[D, kcuu1=\E[A, kcuf1=\E[C,
	khome=\E[H, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
//go.sysin dd *
echo 'x - =data/televideo'
sed 's/^X//' <<'//go.sysin dd *' >=data/televideo
# # --------------------------------
#	@(#)televideo	1.4	5/19/82
#
# televideo: TELEVIDEO
#
# There are some tvi's that require incredible amounts of padding and
# some that don't.  I'm assuming 912 and 920 are the old slow ones,
# and 912b, 912c, 920b, 920c are the new ones that don't need padding.
tvi912|912|920|tvi920|old televideo,
	tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G, il1=\EE$<33*>, am,
	cub1=^H, el=\ET, cup=\E=%p1%' '%+%c%p2%' '%+%c, clear=^Z,
	cols#80, dch1=\EW, dl1=\ER$<33*>,
	kbs=^h, kcuu1=^K, kcud1=^J, kcub1=^H, kcuf1=^L,
	kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r,
	kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r,
	home=^^, ich1=\EQ, lines#24, cuf1=^L, ht=^I, 
	rmso=\Ek, smso=\Ej, cuu1=^K, smul=\El, rmul=\Em, xmc#1,
# the 912 has a <funct> key that's like shift: <funct>8 xmits "^A8\r".
# The 920 has this plus real function keys that xmit different things.
# Terminfo makes you use the funct key on the 912 but the real keys on the 920.
912b|912c|tvi912b|tvi912c|tvi|new televideo 912,
	il1=\EE$<5*>, dl1=\ER$<5*>, use=tvi912,
920b|920c|tvi920b|tvi920c|new televideo 920,
	kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r,
	kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, use=tvi912b,
# Two page TVI 912/920.
# set to page 1 when entering ex (\E-17 )
# reset to page 0 when exiting ex (\E-07 )
tvi912-2p|tvi920-2p|912-2p|920-2p|tvi-2p|televideo w/2 pages,
	smcup=\E-17 , rmcup=\E-07 , use=tvi912,
tvi950-ap|tvi 950 w/alt pages,
	is2=\E\\1, smcup=\E-06 , rmcup=\E-16 , use=tvi950,
tvi950-b|bare tvi950 no is2,
	is2@, smkx=\El, rmkx=\Ek, use=tvi950,
tvi950-ns|tvi950 w/no standout,
	smso@, rmso@, smul@, rmul@, use=tvi950,
# The following tvi descriptions from B:pjphar
# Now that we have is1, is2, and is3, these should be factored.
#
# is2 for all 950's.  It sets the following attributes:
# full duplex (\EDF)		write protect off (\E()
# conversation mode (\EC)	graphics mode off (\E%)
# white on black (\Ed)		auto page flip off (\Ew)
# turn off status line (\Eg)	clear status line (\Ef\r)
# normal video (\E0)		monitor mode off (\EX or \Eu)
# edit mode (\Er)		load blank char to space (\Ee\040)
# line edit mode (\EO)		enable buffer control (^O)
# protect mode off (\E\047)	local edit keys (\Ek)
# program unshifted send key to send line all (\E016)
# program shifted send key to send line unprotected (\E004)
# set the following to nulls:
#	field delimiter (\Ex0\0\0)
#	line delimiter (\Ex1\0\0)
#	start-protected field delimiter (\Ex2\0\0)
#	end-protected field delimiter (\Ex3\0\0)
# set end of text delimiter to carriage return/null (\Ex4\r\0)
#
# tvi950 sets duplex (send) edit keys (\El) when entering vi
#        sets local (no send) edit keys (\Ek) when exiting vi
#
tvi950|950|televideo950,
	tbc=\E3, hts=\E1, cr=^M, cud1=^J, ind=^J, bel=^G,
	is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
	\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
	\Ex3\0\0\Ex4\r\0\Ef\r\El,
	il1=\EE, am, cub1=^H, cbt=\EI, ed=\Ey, el=\Et, clear=\E*,
	cup=\E=%p1%' '%+%c%p2%' '%+%c, cols#80, dch1=\EW, dl1=\ER,
	cud1=^V, rmir=\Er, home=^^, smir=\Eq, kf0=^A0\r,
	kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r,
	kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, kbs=^H, kcud1=^V, khome=^^, kcub1=^H,
	kcuf1=^L, kcuu1=^K, lines#24, mir, msgr, cuf1=^L,
	ht=^I, rmso=\EG0, xmc#1, smso=\EG4, ri=\Ej,
	rmul=\EG0, cuu1=^K, smul=\EG8,
	flash=\Eb$<20>\Ed, cnorm=\Ek, cvvis=\El, xenl,
	hs, tsl=\Eg\Ef, fsl=\r,
#
# is2 for 950 with two pages adds the following:
#	set 48 line page (\E\\2)
#	place cursor at page 0, line 24, column 1 (\E-07 )
#
# two page 950 adds the following:
#	when entering ex, set 24 line page (\E\\1)
#	when exiting ex, reset 48 line page (\E\\2)
#			 place cursor at 0,24,1 (\E-07 )
#
tvi950-2p|950-2p|televideo950 w/2 pages,
	is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
	\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
	\Ex3\0\0\Ex4\r\0\E\\2\E-07 
	rmcup=\E\\2\E-07 , smcup=\E\\1\E-07 , use=tvi950,
#
# is2 for 950 with four pages adds the following:
#	set 96 line page (\E\\3)
#	place cursor at page 0, line 24, column 1 (\E-07 )
#
# four page 950 adds the following:
#	when entering ex, set 24 line page (\E\\1)
#	when exiting ex, reset 96 line page (\E\\3)
#			 place cursor at 0,24,1 (\E-07 )
#
tvi950-4p|950-4p|televideo950 w/4 pages,
	is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
	\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
	\Ex3\0\0\Ex4\r\0\E\\3\E-07 
	rmcup=\E\\3\E-07 , smcup=\E\\1\E-07 , use=tvi950,
#
# is2 for reverse video 950 changes the following:
#	set reverse video (\Ed)
#
# set flash accordingly (\Eb ...nulls... \Ed)
#
tvi950-rv|950-rv|televideo950 rev video,
	tbc=\E3, hts=\E1,
	is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
	\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
	\Ex3\0\0\Ex4\r\0, flash=\Ed$<20>\Eb, use=tvi950,
#
# uses the appropriate entries from 9502p and 950rv
#
tvi950-rv2p|950-rv2p|televideo950 rev video w/2 pages,
	is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
	\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
	\Ex3\0\0\Ex4\r\0\E\\2\E-07 
	rmcup=\E\\2\E-07 , smcup=\E\\1\E-07 , use=tvi950rv,
#
# uses the appropriate entries from 9504p and 950rv
#
tvi950-rv4p|950-rv4p|televideo950 rev video w/4 pages,
	is2=\EDF\EC\Eb\EG0\Er\EO\E\047\E(\E%\Ew\EX\Ee ^O
	\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0
	\Ex3\0\0\Ex4\r\0\E\\3\E-07 
	rmcup=\E\\3\E-07 , smcup=\E\\1\E-07 , use=tvi950rv,
//go.sysin dd *
echo 'x - =data/ti'
sed 's/^X//' <<'//go.sysin dd *' >=data/ti
# # --------------------------------
#	@(#)ti	1.4	5/20/82
#
# ti: TEXAS INSTRUMENTS
#
ti700|ti733|735|ti735|ti silent 700,
	cr=^M$<162>, use=ti745,
ti|ti745|745|743|ti silent 745,
	cr=^M, cud1=^J, ind=^J, bel=^G, cub1=^H, cols#80, hc, os,
ti800|ti omni 800,
	cols#132, use=ti745,
//go.sysin dd *
echo 'x - =data/trailer'
sed 's/^X//' <<'//go.sysin dd *' >=data/trailer
# # ------------------------
#
# The following have been included for upward compatibility with previous
# names.  They are considered obsolete and the new name (which typically
# contains an extra dash) should be used instead.  These names will go
# away eventually (read: "soon") so you should start converting!
#
aaa20, use=aaa-20,
aaa20rev, use=aaa-20-rv,
aaa30, use=aaa-30,
aaa30rev, use=aaa-30-rv,
aaa40, use=aaa-40,
aaa40rev, use=aaa-40-rv,
aaa48, use=aaa-48,
aaa48rev, use=aaa-48-rv,
aaarev, use=aaa-48-rv,
aaa60, use=aaa-60,
aaa60rev, use=aaa-60-rv,
vt100-np, use=vt100,
aaa-29-np, use=aaa-29,
hp2621nl|2621nl, use=2621-nl,
hp2621nt|2621nt, use=2621-nt,
hp2621wl|2621wl, use=2621-wl,
9122p, use=912-2p,
9202p, use=920-2p,
9502p, use=950-2p,
9504p, use=950-4p,
950rv, use=950-rv,
950rv2p, use=950-rv2p,
950rv4p, use=950-rv4p,
aaadb, use=aaa-db,
c1004p, use=c100-4p,
c100rv, use=c100-rv,
c100rv4p, use=c100-rv4p,
c100rv4pna, use=c100-rv4pna,
c100rv4ppp, use=c100-rv4ppp,
c100rvna, use=c100-rvna,
c100rvpp, use=c100-rvpp,
c100rvs, use=c100-rvs,
c100s, use=c100-s,
c108-4, use=c108-4p,
c108-8, use=c108-8p,
c100-s|concept-s|concept100-s, use=c100,
c100-rvs|concept-rvs|concept100-rvs, use=c100-rv,
h19a|h19A, use=h19-a,
h19b, use=h19-b,
h19bs, use=h19-bs,
h19u, use=h19-u,
mime2as, use=mime2a-s,
mime2av, use=mime2a-v,
mimefb, use=mime-fb,
mimehb, use=mime-hb,
tvi2p, use=tvi-2p,
tvi9122p, use=tvi912-2p,
tvi9202p, use=tvi920-2p,
tvi9502p, use=tvi950-2p,
tvi9504p, use=tvi950-4p,
tvi950b, use=tvi950-b,
tvi950ns, use=tvi950-ns,
tvi950rv, use=tvi950-rv,
tvi950rv2p, use=tvi950-rv2p,
tvi950rv4p, use=tvi950-rv4p,
vt100am, use=vt100-am,
vt100nam, use=vt100-nam,
vt100s, use=vt100-s,
vt100w, use=vt100-w,
#
# END OF TERMINFO
#  ------------------------
//go.sysin dd *
echo 'x - =data/visual'
sed 's/^X//' <<'//go.sysin dd *' >=data/visual
# # --------------------------------
#	@(#)visual	1.4	5/20/82
#
# visual: VISUAL
#
# The Visual 200 beeps when you type a character in insert mode.
# This is a horribly obnoxious misfeature, and some of the entries
# below try to get around the problem by ignoring the feature or
# turning it off when inputting a character.  They are said not to
# work well at 300 baud.  (You could always cut the wire to the bell!)
vi200|visual 200 with function keys,
	cr=^M, cud1=^J, ind=^J, bel=^G, lines#24, cols#80,
	il1=\EL, am, cub1=^H, ed=\Ey, el=\Ex$<4*>, clear=\Ev,
	cup=\EY%p1%' '%+%c%p2%' '%+%c, dch1=\EO$<4*>, dl1=\EM$<4*>,
	home=\EH, ich1=\Ei \b\Ej, is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek,
	kf0=\EP, kf1=\EQ, kf2=\ER, kf3=\E , kf4=\E!, kf5=\E", kf6=\E#,
	kf7=\E$, kf8=\E%, kf9=\E&,
	kcub1=\ED, kcuf1=\EC, kcuu1=\EA, kcud1=\EB, khome=\EH,
	cuf1=\EC, ht=^I, ri=\EI, cuu1=\EA, cvvis=\Ed, cnorm=\Ec,
vi200-rv-ic|visual 200 reverse video using insert char,
	rmir=\Ej, smir=\Ei, ich1@, use=vi200-rv,
# The older Visuals didn't come with function keys. This entry uses
# smkx and rmkx so that the keypad keys can be used as function keys.
# If your version of vi doesn't support function keys you may want
# to use vi200-f.
vi200-f|visual|visual 200 no function keys,
	cr=^M, cud1=^J, ind=^J, bel=^G, cols#80, lines#24,
	il1=\EL, am, cub1=^H, ed=\Ey, el=\Ex$<4*>, clear=\Ev,
	cup=\EY%p1%' '%+%c%p2%' '%+%c, dch1=\EO$<4*>, dl1=\EM$<4*>,
	home=\EH, ich1=\Ei \b\Ej, is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek,
	smkx=\E=, rmkx=\E>,
	kf0=\E?p, kf1=\E?q, kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v,
	kf7=\E?w, kf8=\E?x, kf9=\E?y,
	kcub1=\ED, kcuf1=\EC, kcuu1=\EA, kcud1=\EB, khome=\EH,
	cuf1=\EC, ht=^I, ri=\EI, cuu1=\EA, cvvis=\Ed, cnorm=\Ec,
vi200-rv|visual 200 reverse video,
	smso=\E4, rmso=\E3, ri@, cvvis@, cnorm@, use=vi200,
vi200-ic|visual 200 using insert char,
	rmir=\Ej, smir=\Ei, ich1@, use=vi200,
//go.sysin dd *
exit



More information about the Mod.sources mailing list