head	1.9;
access;
symbols
	perseant-exfatfs-base-20250801:1.9
	perseant-exfatfs-base-20240630:1.9
	perseant-exfatfs:1.9.0.36
	perseant-exfatfs-base:1.9
	cjep_sun2x:1.9.0.34
	cjep_sun2x-base:1.9
	cjep_staticlib_x-base1:1.9
	cjep_staticlib_x:1.9.0.32
	cjep_staticlib_x-base:1.9
	phil-wifi-20200421:1.9
	phil-wifi-20200411:1.9
	phil-wifi-20200406:1.9
	pgoyette-compat-merge-20190127:1.9
	pgoyette-compat-20190127:1.9
	pgoyette-compat-20190118:1.9
	pgoyette-compat-1226:1.9
	pgoyette-compat-1126:1.9
	pgoyette-compat-1020:1.9
	pgoyette-compat-0930:1.9
	pgoyette-compat-0906:1.9
	pgoyette-compat-0728:1.9
	pgoyette-compat-0625:1.9
	pgoyette-compat-0521:1.9
	pgoyette-compat-0502:1.9
	pgoyette-compat-0422:1.9
	pgoyette-compat-0415:1.9
	pgoyette-compat-0407:1.9
	pgoyette-compat-0330:1.9
	pgoyette-compat-0322:1.9
	pgoyette-compat-0315:1.9
	pgoyette-compat:1.9.0.30
	pgoyette-compat-base:1.9
	perseant-stdc-iso10646:1.9.0.28
	perseant-stdc-iso10646-base:1.9
	prg-localcount2-base3:1.9
	prg-localcount2-base2:1.9
	prg-localcount2-base1:1.9
	prg-localcount2:1.9.0.26
	prg-localcount2-base:1.9
	pgoyette-localcount-20170426:1.9
	bouyer-socketcan-base1:1.9
	pgoyette-localcount-20170320:1.9
	bouyer-socketcan:1.9.0.24
	bouyer-socketcan-base:1.9
	pgoyette-localcount-20170107:1.9
	pgoyette-localcount-20161104:1.9
	localcount-20160914:1.9
	pgoyette-localcount-20160806:1.9
	pgoyette-localcount-20160726:1.9
	pgoyette-localcount:1.9.0.22
	pgoyette-localcount-base:1.9
	netbsd-5-2-3-RELEASE:1.9
	netbsd-5-1-5-RELEASE:1.9
	yamt-pagecache-base9:1.9
	yamt-pagecache-tag8:1.9
	tls-earlyentropy:1.9.0.18
	tls-earlyentropy-base:1.9
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.9
	riastradh-drm2-base3:1.9
	netbsd-5-2-2-RELEASE:1.9
	netbsd-5-1-4-RELEASE:1.9
	netbsd-5-2-1-RELEASE:1.9
	netbsd-5-1-3-RELEASE:1.9
	agc-symver:1.9.0.20
	agc-symver-base:1.9
	tls-maxphys-base:1.9
	yamt-pagecache-base8:1.9
	netbsd-5-2:1.9.0.16
	yamt-pagecache-base7:1.9
	netbsd-5-2-RELEASE:1.9
	netbsd-5-2-RC1:1.9
	yamt-pagecache-base6:1.9
	yamt-pagecache-base5:1.9
	yamt-pagecache-base4:1.9
	netbsd-5-1-2-RELEASE:1.9
	netbsd-5-1-1-RELEASE:1.9
	yamt-pagecache-base3:1.9
	yamt-pagecache-base2:1.9
	yamt-pagecache:1.9.0.14
	yamt-pagecache-base:1.9
	bouyer-quota2-nbase:1.9
	bouyer-quota2:1.9.0.12
	bouyer-quota2-base:1.9
	matt-nb5-pq3:1.9.0.10
	matt-nb5-pq3-base:1.9
	netbsd-5-1:1.9.0.8
	netbsd-5-1-RELEASE:1.9
	netbsd-5-1-RC4:1.9
	netbsd-5-1-RC3:1.9
	netbsd-5-1-RC2:1.9
	netbsd-5-1-RC1:1.9
	netbsd-5-0-2-RELEASE:1.9
	netbsd-5-0-1-RELEASE:1.9
	jym-xensuspend-nbase:1.9
	netbsd-5-0:1.9.0.6
	netbsd-5-0-RELEASE:1.9
	netbsd-5-0-RC4:1.9
	netbsd-5-0-RC3:1.9
	netbsd-5-0-RC2:1.9
	jym-xensuspend:1.9.0.4
	jym-xensuspend-base:1.9
	netbsd-5-0-RC1:1.9
	netbsd-5:1.9.0.2
	netbsd-5-base:1.9
	matt-mips64-base2:1.8
	matt-mips64:1.8.0.32
	mjf-devfs2:1.8.0.30
	mjf-devfs2-base:1.8
	netbsd-4-0-1-RELEASE:1.8
	wrstuden-revivesa-base-3:1.8
	wrstuden-revivesa-base-2:1.8
	wrstuden-fixsa-newbase:1.8
	wrstuden-revivesa-base-1:1.8
	yamt-pf42-base4:1.8
	yamt-pf42-base3:1.8
	hpcarm-cleanup-nbase:1.8
	yamt-pf42-baseX:1.8
	yamt-pf42-base2:1.8
	wrstuden-revivesa:1.8.0.28
	wrstuden-revivesa-base:1.8
	yamt-pf42:1.8.0.26
	yamt-pf42-base:1.8
	keiichi-mipv6-nbase:1.8
	keiichi-mipv6:1.8.0.24
	keiichi-mipv6-base:1.8
	matt-armv6-nbase:1.8
	matt-armv6-prevmlocking:1.8
	wrstuden-fixsa-base-1:1.8
	netbsd-4-0:1.8.0.22
	netbsd-4-0-RELEASE:1.8
	cube-autoconf:1.8.0.20
	cube-autoconf-base:1.8
	netbsd-4-0-RC5:1.8
	netbsd-4-0-RC4:1.8
	netbsd-4-0-RC3:1.8
	netbsd-4-0-RC2:1.8
	netbsd-4-0-RC1:1.8
	matt-armv6:1.8.0.18
	matt-armv6-base:1.8
	matt-mips64-base:1.8
	hpcarm-cleanup:1.8.0.16
	hpcarm-cleanup-base:1.8
	netbsd-3-1-1-RELEASE:1.8
	netbsd-3-0-3-RELEASE:1.8
	wrstuden-fixsa:1.8.0.14
	wrstuden-fixsa-base:1.8
	abandoned-netbsd-4-base:1.8
	abandoned-netbsd-4:1.8.0.8
	netbsd-3-1:1.8.0.10
	netbsd-3-1-RELEASE:1.8
	netbsd-3-0-2-RELEASE:1.8
	netbsd-3-1-RC4:1.8
	netbsd-3-1-RC3:1.8
	netbsd-3-1-RC2:1.8
	netbsd-3-1-RC1:1.8
	netbsd-4:1.8.0.12
	netbsd-4-base:1.8
	chap-midi-nbase:1.8
	netbsd-3-0-1-RELEASE:1.8
	chap-midi:1.8.0.6
	chap-midi-base:1.8
	netbsd-3-0:1.8.0.4
	netbsd-3-0-RELEASE:1.8
	netbsd-3-0-RC6:1.8
	netbsd-3-0-RC5:1.8
	netbsd-3-0-RC4:1.8
	netbsd-3-0-RC3:1.8
	netbsd-3-0-RC2:1.8
	netbsd-3-0-RC1:1.8
	netbsd-2-0-3-RELEASE:1.7.4.2
	netbsd-2-1:1.7.6.1.0.2
	netbsd-2-1-RELEASE:1.7.6.1
	netbsd-2-1-RC6:1.7.6.1
	netbsd-2-1-RC5:1.7.6.1
	netbsd-2-1-RC4:1.7.6.1
	netbsd-2-1-RC3:1.7.6.1
	netbsd-2-1-RC2:1.7.6.1
	netbsd-2-1-RC1:1.7.6.1
	netbsd-2-0-2-RELEASE:1.7.4.2
	netbsd-3:1.8.0.2
	netbsd-3-base:1.8
	netbsd-2-0-1-RELEASE:1.7
	netbsd-2:1.7.0.6
	netbsd-2-base:1.7
	netbsd-2-0-RELEASE:1.7
	netbsd-2-0-RC5:1.7
	netbsd-2-0-RC4:1.7
	netbsd-2-0-RC3:1.7
	netbsd-2-0-RC2:1.7
	netbsd-2-0-RC1:1.7
	netbsd-2-0:1.7.0.4
	netbsd-2-0-base:1.7
	netbsd-1-6-PATCH002-RELEASE:1.7
	netbsd-1-6-PATCH002:1.7
	netbsd-1-6-PATCH002-RC4:1.7
	netbsd-1-6-PATCH002-RC3:1.7
	netbsd-1-6-PATCH002-RC2:1.7
	netbsd-1-6-PATCH002-RC1:1.7
	netbsd-1-6-PATCH001:1.7
	netbsd-1-6-PATCH001-RELEASE:1.7
	netbsd-1-6-PATCH001-RC3:1.7
	netbsd-1-6-PATCH001-RC2:1.7
	netbsd-1-6-PATCH001-RC1:1.7
	fvdl_fs64_base:1.7
	netbsd-1-6-RELEASE:1.7
	netbsd-1-6-RC3:1.7
	netbsd-1-6-RC2:1.7
	netbsd-1-6-RC1:1.7
	netbsd-1-6:1.7.0.2
	netbsd-1-6-base:1.7
	netbsd-1-5-PATCH003:1.4
	netbsd-1-5-PATCH002:1.4
	netbsd-1-5-PATCH001:1.4
	nvi_1_79:1.1.1.2
	netbsd-1-5-RELEASE:1.4
	netbsd-1-5-BETA2:1.4
	netbsd-1-5-BETA:1.4
	netbsd-1-4-PATCH003:1.2
	netbsd-1-5-ALPHA2:1.4
	netbsd-1-5:1.4.0.2
	netbsd-1-5-base:1.4
	minoura-xpg4dl-base:1.2
	minoura-xpg4dl:1.2.0.8
	netbsd-1-4-PATCH002:1.2
	wrstuden-devbsize-19991221:1.2
	wrstuden-devbsize:1.2.0.6
	wrstuden-devbsize-base:1.2
	comdex-fall-1999:1.2.0.4
	comdex-fall-1999-base:1.2
	netbsd-1-4-PATCH001:1.2
	netbsd-1-4-RELEASE:1.2
	netbsd-1-4:1.2.0.2
	netbsd-1-4-base:1.2
	netbsd-1-3-PATCH003:1.1.1.1
	netbsd-1-3-PATCH003-CANDIDATE2:1.1.1.1
	netbsd-1-3-PATCH003-CANDIDATE1:1.1.1.1
	netbsd-1-3-PATCH003-CANDIDATE0:1.1.1.1
	netbsd-1-3-PATCH002:1.1.1.1
	netbsd-1-3-PATCH001:1.1.1.1
	netbsd-1-3-RELEASE:1.1.1.1
	netbsd-1-3-BETA:1.1.1.1
	netbsd-1-3:1.1.1.1.0.2
	netbsd-1-3-base:1.1.1.1
	netbsd-1-2-PATCH001:1.1.1.1
	netbsd-1-2-RELEASE:1.1.1.1
	netbsd-1-2-BETA:1.1.1.1
	netbsd-1-2:1.1.1.1.0.4
	netbsd-1-2-base:1.1.1.1
	nvi_1_66:1.1.1.1
	BOSTIC:1.1.1;
locks; strict;
comment	@ * @;


1.9
date	2008.10.29.16.49.34;	author christos;	state dead;
branches;
next	1.8;

1.8
date	2005.02.12.12.53.22;	author aymeric;	state Exp;
branches;
next	1.7;

1.7
date	2002.04.09.01.47.30;	author thorpej;	state Exp;
branches
	1.7.4.1
	1.7.6.1;
next	1.6;

1.6
date	2001.05.01.16.46.11;	author aymeric;	state Exp;
branches;
next	1.5;

1.5
date	2001.03.31.11.37.45;	author aymeric;	state Exp;
branches;
next	1.4;

1.4
date	2000.05.31.05.08.55;	author matt;	state Exp;
branches;
next	1.3;

1.3
date	2000.05.30.11.50.47;	author blymn;	state Exp;
branches;
next	1.2;

1.2
date	98.01.09.08.06.19;	author perry;	state Exp;
branches
	1.2.8.1;
next	1.1;

1.1
date	96.05.20.01.58.18;	author mrg;	state Exp;
branches
	1.1.1.1;
next	;

1.7.4.1
date	2005.02.12.12.24.12;	author aymeric;	state Exp;
branches;
next	1.7.4.2;

1.7.4.2
date	2005.02.12.12.46.26;	author aymeric;	state Exp;
branches;
next	;

1.7.6.1
date	2005.05.06.14.42.14;	author riz;	state Exp;
branches;
next	;

1.2.8.1
date	2000.06.23.16.40.07;	author minoura;	state Exp;
branches;
next	;

1.1.1.1
date	96.05.20.01.58.18;	author mrg;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2001.03.31.11.29.51;	author aymeric;	state Exp;
branches;
next	;


desc
@@


1.9
log
@bye old vi!
@
text
@/*	$NetBSD: cl_bsd.c,v 1.8 2005/02/12 12:53:22 aymeric Exp $	*/

/*-
 * Copyright (c) 1995, 1996
 *	Keith Bostic.  All rights reserved.
 *
 * See the LICENSE file for redistribution information.
 */

#include "config.h"

#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char sccsid[] = "@@(#)cl_bsd.c	8.29 (Berkeley) 7/1/96";
#else
__RCSID("$NetBSD: cl_bsd.c,v 1.8 2005/02/12 12:53:22 aymeric Exp $");
#endif
#endif /* not lint */

#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>

#include <bitstring.h>
#include <ctype.h>
#include <curses.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>

#include "../common/common.h"
#include "../vi/vi.h"
#include "cl.h"

static char	*ke;				/* Keypad on. */
static char	*ks;				/* Keypad off. */
static char	*vb;				/* Visible bell string. */

static int lcmp __P((const void *, const void *));

/*
 * HP's support the entire System V curses package except for the tigetstr
 * and tigetnum functions.  Ultrix supports the BSD curses package except
 * for the idlok function.  Cthulu only knows why.  Break things up into a
 * minimal set of functions.
 */

#ifndef HAVE_CURSES_ADDNSTR
/*
 * addnstr --
 *
 * PUBLIC: #ifndef HAVE_CURSES_ADDNSTR
 * PUBLIC: int addnstr __P((char *, int));
 * PUBLIC: #endif
 */
int
addnstr(s, n)
	char *s;
	int n;
{
	int ch;

	while (n-- && (ch = *s++))
		addch(ch);
	return (OK);
}
#endif

#ifndef	HAVE_CURSES_BEEP
/*
 * beep --
 *
 * PUBLIC: #ifndef HAVE_CURSES_BEEP
 * PUBLIC: void beep __P((void));
 * PUBLIC: #endif
 */
void
beep()
{
	(void)write(1, "\007", 1);	/* '\a' */
}
#endif /* !HAVE_CURSES_BEEP */

#ifndef	HAVE_CURSES_FLASH
/*
 * flash --
 *	Flash the screen.
 *
 * PUBLIC: #ifndef HAVE_CURSES_FLASH
 * PUBLIC: void flash __P((void));
 * PUBLIC: #endif
 */
void
flash()
{
	if (vb != NULL) {
		(void)tputs(vb, 1, cl_putchar);
		(void)fflush(stdout);
	} else
		beep();
}
#endif /* !HAVE_CURSES_FLASH */

#ifndef	HAVE_CURSES_IDLOK
/*
 * idlok --
 *	Turn on/off hardware line insert/delete.
 *
 * PUBLIC: #ifndef HAVE_CURSES_IDLOK
 * PUBLIC: void idlok __P((WINDOW *, int));
 * PUBLIC: #endif
 */
void
idlok(win, bf)
	WINDOW *win;
	int bf;
{
	return;
}
#endif /* !HAVE_CURSES_IDLOK */

#ifndef	HAVE_CURSES_KEYPAD
/*
 * keypad --
 *	Put the keypad/cursor arrows into or out of application mode.
 *
 * PUBLIC: #ifndef HAVE_CURSES_KEYPAD
 * PUBLIC: int keypad __P((void *, int));
 * PUBLIC: #endif
 */
int
keypad(a, on)
	void *a;
	int on;
{
	char *p;

	if ((p = tigetstr(on ? "smkx" : "rmkx")) != (char *)-1) {
		(void)tputs(p, 0, cl_putchar);
		(void)fflush(stdout);
	}
	return (0);
}
#endif /* !HAVE_CURSES_KEYPAD */

#ifndef	HAVE_CURSES_NEWTERM
/*
 * newterm --
 *	Create a new curses screen.
 *
 * PUBLIC: #ifndef HAVE_CURSES_NEWTERM
 * PUBLIC: void *newterm __P((const char *, FILE *, FILE *));
 * PUBLIC: #endif
 */
void *
newterm(a, b, c)
	const char *a;
	FILE *b, *c;
{
	return (initscr());
}
#endif /* !HAVE_CURSES_NEWTERM */

#ifndef	HAVE_CURSES_SETUPTERM
/*
 * setupterm --
 *	Set up terminal.
 *
 * PUBLIC: #ifndef HAVE_CURSES_SETUPTERM
 * PUBLIC: void setupterm __P((char *, int, int *));
 * PUBLIC: #endif
 */
static struct tinfo *info;

void
setupterm(ttype, fno, errp)
	char *ttype;
	int fno, *errp;
{
	char *p;

	if ((*errp = t_getent(&info, ttype)) > 0) {
		if (ke != NULL)
			free(ke);
		ke = ((p = tigetstr("rmkx")) == (char *)-1) ?
		    NULL : strdup(p);
		if (ks != NULL)
			free(ks);
		ks = ((p = tigetstr("smkx")) == (char *)-1) ?
		    NULL : strdup(p);
		if (vb != NULL)
			free(vb);
		vb = ((p = tigetstr("flash")) == (char *)-1) ?
		    NULL : strdup(p);
	}
}
#endif /* !HAVE_CURSES_SETUPTERM */

#ifndef	HAVE_CURSES_TIGETSTR
/* Terminfo-to-termcap translation table. */
typedef struct _tl {
	char *terminfo;			/* Terminfo name. */
	char *termcap;			/* Termcap name. */
} TL;
static const TL list[] = {
	{ "cols",	"co" },		/* Terminal columns. */
	{ "cup",	"cm" },		/* Cursor up. */
	{ "cuu1",	"up" },		/* Cursor up. */
	{ "el",		"ce" },		/* Clear to end-of-line. */
	{ "flash",	"vb" },		/* Visible bell. */
	{ "kcub1",  	"kl" },		/* Cursor left. */
	{ "kcud1",	"kd" },		/* Cursor down. */
	{ "kcuf1",	"kr" },		/* Cursor right. */
	{ "kcuu1",  	"ku" },		/* Cursor up. */
	{ "kdch1",	"kD" },		/* Delete character. */
	{ "kdl1",	"kL" },		/* Delete line. */
	{ "ked",	"kS" },		/* Delete to end of screen. */
	{ "kel",	"kE" },		/* Delete to eol. */
	{ "khome",	"kh" },		/* Go to sol. */
	{ "kich1",	"kI" },		/* Insert at cursor. */
	{ "kil1",	"kA" },		/* Insert line. */
	{ "kind",	"kF" },		/* Scroll down. */
	{ "kll",	"kH" },		/* Go to eol. */
	{ "knp",	"kN" },		/* Page down. */
	{ "kpp",	"kP" },		/* Page up. */
	{ "kri",	"kR" },		/* Scroll up. */
	{ "lines",	"li" },		/* Terminal lines. */
	{ "rmcup",	"te" },		/* Terminal end string. */
	{ "rmkx",	"ke" },		/* Exit "keypad-transmit" mode. */
	{ "rmso",	"se" },		/* Standout end. */
	{ "smcup",	"ti" },		/* Terminal initialization string. */
	{ "smkx",	"ks" },		/* Enter "keypad-transmit" mode. */
	{ "smso",	"so" },		/* Standout begin. */
};

#ifdef _AIX
/*
 * AIX's implementation for function keys greater than 10 is different and
 * only goes as far as 36.
 */
static const char codes[] = {
/*  0-10 */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ';',
/* 11-20 */ '<', '>', '!', '@@', '#', '$', '%', '^', '&', '*',
/* 21-30 */ '(', ')', '-', '_', '+', ',', ':', '?', '[', ']',
/* 31-36 */ '{', '}', '|', '~', '/', '='
};

#else

/*
 * !!!
 * Historically, the 4BSD termcap code didn't support functions keys greater
 * than 9.  This was silently enforced -- asking for key k12 would return the
 * value for k1.  We try and get around this by using the tables specified in
 * the terminfo(TI_ENV) man page from the 3rd Edition SVID.  This assumes the
 * implementors of any System V compatibility code or an extended termcap used
 * those codes.
 */
static const char codes[] = {
/*  0-10 */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ';',
/* 11-19 */ '1', '2', '3', '4', '5', '6', '7', '8', '9',
/* 20-63 */ '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',
};
#endif /* _AIX */

/*
 * lcmp --
 *	list comparison routine for bsearch.
 */
static int
lcmp(a, b)
	const void *a, *b;
{
	return (strcmp(a, ((TL *)b)->terminfo));
}

/*
 * tigetstr --
 *
 * Vendors put the prototype for tigetstr into random include files, including
 * <term.h>, which we can't include because it makes other systems unhappy.
 * Try and work around the problem, since we only care about the return value.
 *
 * PUBLIC: #ifdef HAVE_CURSES_TIGETSTR
 * PUBLIC: char *tigetstr();
 * PUBLIC: #else
 * PUBLIC: char *tigetstr __P((char *));
 * PUBLIC: #endif
 */
char *
tigetstr(name)
	char *name;
{
	static char sbuf[256];
	TL *tlp;
	int n;
	size_t limit;
	char *p, keyname[3];

	if ((tlp = bsearch(name,
	    list, sizeof(list) / sizeof(TL), sizeof(TL), lcmp)) == NULL) {
#ifdef _AIX
		if (name[0] == 'k' &&
		    name[1] == 'f' && (n = atoi(name + 2)) <= 36) {
			keyname[0] = 'k';
			keyname[1] = codes[n];
			keyname[2] = '\0';
#else
		if (name[0] == 'k' &&
		    name[1] == 'f' && (n = atoi(name + 2)) <= 63) {
			keyname[0] = n <= 10 ? 'k' : 'F';
			keyname[1] = codes[n];
			keyname[2] = '\0';
#endif
			name = keyname;
		}
	} else
		name = tlp->termcap;

	p = sbuf;
#ifdef _AIX
	return ((p = tgetstr(name, &p)) == NULL ? (char *)-1 : strcpy(sbuf, p));
#else
	limit = 255;
	return (t_getstr(info, name, &p, &limit) == NULL ? (char *)-1 : sbuf);
#endif
}

/*
 * tigetnum --
 *
 * PUBLIC: #ifndef HAVE_CURSES_TIGETSTR
 * PUBLIC: int tigetnum __P((char *));
 * PUBLIC: #endif
 */
int
tigetnum(name)
	char *name;
{
	TL *tlp;
	int val;

	if ((tlp = bsearch(name,
	    list, sizeof(list) / sizeof(TL), sizeof(TL), lcmp)) != NULL) {
		name = tlp->termcap;
	}

	return ((val = t_getnum(info, name)) == -1 ? -2 : val);
}
#endif /* !HAVE_CURSES_TIGETSTR */
@


1.8
log
@Fix the RCSID's to be $NetBSD$ instead of $NetBSD
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.7 2002/04/09 01:47:30 thorpej Exp $	*/
d17 1
a17 1
__RCSID("$NetBSD$");
@


1.7
log
@Use __RCSID() and __COPYRIGHT().
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.6 2001/05/01 16:46:11 aymeric Exp $	*/
d17 1
a17 1
__RCSID("$NetBSD");
@


1.7.6.1
log
@Pull up revision 1.8 (requested by aymeric in ticket #1195):
Fix the RCSID's to be $NetBSD$ instead of $NetBSD
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.7 2002/04/09 01:47:30 thorpej Exp $	*/
d17 1
a17 1
__RCSID("$NetBSD$");
@


1.7.4.1
log
@Fix the RCSID's to be $NetBSD$ instead of $NetBSD
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.7 2002/04/09 01:47:30 thorpej Exp $	*/
d17 1
a17 1
__RCSID("$NetBSD$");
@


1.7.4.2
log
@Backout previous. Sorry.
@
text
@d17 1
a17 1
__RCSID("$NetBSD");
@


1.6
log
@shutup most (non-intrusive) gcc warnings
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.5 2001/03/31 11:37:45 aymeric Exp $	*/
d12 1
d14 1
d16 3
@


1.5
log
@merge changes after import of nvi 1.79
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.4 2000/05/31 05:08:55 matt Exp $	*/
d38 2
d205 28
a232 28
	"cols",		"co",		/* Terminal columns. */
	"cup",		"cm",		/* Cursor up. */
	"cuu1",		"up",		/* Cursor up. */
	"el",		"ce",		/* Clear to end-of-line. */
	"flash",	"vb",		/* Visible bell. */
	"kcub1",  	"kl",		/* Cursor left. */
	"kcud1",	"kd",		/* Cursor down. */
	"kcuf1",	"kr",		/* Cursor right. */
	"kcuu1",  	"ku",		/* Cursor up. */
	"kdch1",	"kD",		/* Delete character. */
	"kdl1",		"kL",		/* Delete line. */
	"ked",		"kS",		/* Delete to end of screen. */
	"kel",		"kE",		/* Delete to eol. */
	"khome",	"kh",		/* Go to sol. */
	"kich1",	"kI",		/* Insert at cursor. */
	"kil1",		"kA",		/* Insert line. */
	"kind",		"kF",		/* Scroll down. */
	"kll",		"kH",		/* Go to eol. */
	"knp",		"kN",		/* Page down. */
	"kpp",		"kP",		/* Page up. */
	"kri",		"kR",		/* Scroll up. */
	"lines",	"li",		/* Terminal lines. */
	"rmcup",	"te",		/* Terminal end string. */
	"rmkx",		"ke",		/* Exit "keypad-transmit" mode. */
	"rmso",		"se",		/* Standout end. */
	"smcup",	"ti",		/* Terminal initialization string. */
	"smkx",		"ks",		/* Enter "keypad-transmit" mode. */
	"smso",		"so",		/* Standout begin. */
@


1.4
log
@size_t != int on alpha.
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.3 2000/05/30 11:50:47 blymn Exp $	*/
d13 1
a13 1
static const char sccsid[] = "@@(#)cl_bsd.c	8.25 (Berkeley) 4/30/96";
d182 2
a183 1
		ke = ((p = tigetstr("rmkx")) == (char *)-1) ? NULL : strdup(p);
d186 2
a187 1
		ks = ((p = tigetstr("smkx")) == (char *)-1) ? NULL : strdup(p);
d190 2
a191 1
		vb = ((p = tigetstr("flash")) == (char *)-1) ? NULL : strdup(p);
d233 14
d264 1
d280 7
a286 1
 * PUBLIC: #ifndef HAVE_CURSES_TIGETSTR
d302 7
d314 1
d321 3
d326 1
@


1.3
log
@Change vi to use new termcap interface, prevents buffer overflow in
termcap handling.
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.2 1998/01/09 08:06:19 perry Exp $	*/
d272 2
a273 1
	int n, limit;
@


1.2
log
@RCS Id Police.
@
text
@d1 1
a1 1
/*	$NetBSD$	*/
d170 2
a176 1
	static char buf[2048];
d179 1
a179 1
	if ((*errp = tgetent(buf, ttype)) > 0) {
d272 1
a272 1
	int n;
d288 2
a289 1
	return (tgetstr(name, &p) == NULL ? (char *)-1 : sbuf);
d311 1
a311 1
	return ((val = tgetnum(name)) == -1 ? -2 : val);
@


1.2.8.1
log
@Sync w/ netbsd-1-5-base.
@
text
@d1 1
a1 1
/*	$NetBSD: cl_bsd.c,v 1.4 2000/05/31 05:08:55 matt Exp $	*/
a169 2
static struct tinfo *info;

d175 1
d178 1
a178 1
	if ((*errp = t_getent(&info, ttype)) > 0) {
a271 1
	size_t limit;
d287 1
a287 2
	limit = 255;
	return (t_getstr(info, name, &p, &limit) == NULL ? (char *)-1 : sbuf);
d309 1
a309 1
	return ((val = t_getnum(info, name)) == -1 ? -2 : val);
@


1.1
log
@Initial revision
@
text
@d1 2
@


1.1.1.1
log
@import of nvi 1.66
@
text
@@


1.1.1.2
log
@import of nvi 1.79
@
text
@d11 1
a11 1
static const char sccsid[] = "@@(#)cl_bsd.c	8.29 (Berkeley) 7/1/96";
d179 1
a179 2
		ke = ((p = tigetstr("rmkx")) == (char *)-1) ?
		    NULL : strdup(p);
d182 1
a182 2
		ks = ((p = tigetstr("smkx")) == (char *)-1) ?
		    NULL : strdup(p);
d185 1
a185 2
		vb = ((p = tigetstr("flash")) == (char *)-1) ?
		    NULL : strdup(p);
a226 14
#ifdef _AIX
/*
 * AIX's implementation for function keys greater than 10 is different and
 * only goes as far as 36.
 */
static const char codes[] = {
/*  0-10 */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ';',
/* 11-20 */ '<', '>', '!', '@@', '#', '$', '%', '^', '&', '*',
/* 21-30 */ '(', ')', '-', '_', '+', ',', ':', '?', '[', ']',
/* 31-36 */ '{', '}', '|', '~', '/', '='
};

#else

a243 1
#endif /* _AIX */
d259 1
a259 7
 * Vendors put the prototype for tigetstr into random include files, including
 * <term.h>, which we can't include because it makes other systems unhappy.
 * Try and work around the problem, since we only care about the return value.
 *
 * PUBLIC: #ifdef HAVE_CURSES_TIGETSTR
 * PUBLIC: char *tigetstr();
 * PUBLIC: #else
a273 7
#ifdef _AIX
		if (name[0] == 'k' &&
		    name[1] == 'f' && (n = atoi(name + 2)) <= 36) {
			keyname[0] = 'k';
			keyname[1] = codes[n];
			keyname[2] = '\0';
#else
a278 1
#endif
a284 3
#ifdef _AIX
	return ((p = tgetstr(name, &p)) == NULL ? (char *)-1 : strcpy(sbuf, p));
#else
a285 1
#endif
@

