clean up import, roll forward local fixes, clean up Ids

This commit is contained in:
cgd 1995-02-27 10:18:34 +00:00
parent 1d23521104
commit 41f1c39f00
9 changed files with 68 additions and 313 deletions

View File

@ -1,5 +1,5 @@
# from: @(#)Makefile 5.10 (Berkeley) 6/1/90
# $Id: Makefile,v 1.6 1994/12/22 09:57:51 cgd Exp $
# $NetBSD: Makefile,v 1.7 1995/02/27 10:18:34 cgd Exp $
# @(#)Makefile 8.1 (Berkeley) 6/4/93
LIB= termcap
CFLAGS+=-DCM_N -DCM_GT -DCM_B -DCM_D

View File

@ -1,6 +1,8 @@
/* $NetBSD: pathnames.h,v 1.3 1995/02/27 10:18:43 cgd Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)pathnames.h 5.2 (Berkeley) 6/1/90
* $Id: pathnames.h,v 1.2 1993/08/01 18:32:08 mycroft Exp $
* @(#)pathnames.h 8.1 (Berkeley) 6/4/93
*/
#define _PATH_DEF ".termcap /usr/share/misc/termcap"

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1980, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: termcap.3,v 1.4 1995/02/27 10:18:47 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)termcap.3 6.6 (Berkeley) 4/19/91
.\" $Id: termcap.3,v 1.3 1993/11/14 08:59:39 cgd Exp $
.\" @(#)termcap.3 8.2 (Berkeley) 12/11/93
.\"
.Dd April 19, 1991
.Dd December 11, 1993
.Dt TERMCAP 3
.Os BSD 4
.Sh NAME
@ -139,7 +140,7 @@ The
function
gets the numeric value of capability
.Fa id ,
returning \-1 if is not given for the terminal.
returning \-1 if it is not given for the terminal.
The
.Fn tgetflag
function

View File

@ -1,6 +1,8 @@
/* $NetBSD: termcap.c,v 1.6 1995/02/27 10:18:54 cgd Exp $ */
/*
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +34,11 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)termcap.c 5.5 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: termcap.c,v 1.5 1994/04/18 12:35:39 deraadt Exp $";
#if 0
static char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: termcap.c,v 1.6 1995/02/27 10:18:54 cgd Exp $";
#endif
#endif /* not lint */
#define PBUFSIZ 512 /* max length of filename path */
@ -59,7 +64,7 @@ static char rcsid[] = "$Id: termcap.c,v 1.5 1994/04/18 12:35:39 deraadt Exp $";
* doesn't, and because living w/o it is not hard.
*/
static char *tbuf;
static char *tbuf; /* termcap buffer */
/*
* Get an entry for terminal name in buffer bp from the termcap file.
@ -70,12 +75,17 @@ tgetent(bp, name)
{
register char *p;
register char *cp;
int i;
char *dummy = NULL, *home, *termpath;
char **fname, **pvec;
char pathbuf[PBUFSIZ], *pathvec[PVECSIZ];
char *dummy;
char **fname;
char *home;
int i;
char pathbuf[PBUFSIZ]; /* holds raw path of filenames */
char *pathvec[PVECSIZ]; /* to point to names in pathbuf */
char **pvec; /* holds usable tail of path vector */
char *termpath;
fname = pvec = pathvec;
fname = pathvec;
pvec = pathvec;
tbuf = bp;
p = pathbuf;
cp = getenv("TERMCAP");
@ -122,20 +132,20 @@ tgetent(bp, name)
*fname = (char *) 0; /* mark end of vector */
if (cp && *cp && *cp != '/')
if (cgetset(cp) < 0)
return -2;
i = cgetent(&dummy, pathvec, name);
return (-2);
dummy = NULL;
i = cgetent(&dummy, pathvec, name);
if (i == 0)
strcpy(bp, dummy);
if (dummy != NULL)
if (dummy)
free(dummy);
/* no way to return "loop" */
/* no tc reference loop return code in libterm XXX */
if (i == -3)
return -1;
return(i + 1);
return (-1);
return (i + 1);
}
/*
@ -153,9 +163,9 @@ tgetnum(id)
long num;
if (cgetnum(tbuf, id, &num) == 0)
return(num);
return (num);
else
return -1;
return (-1);
}
/*
@ -164,10 +174,11 @@ tgetnum(id)
* of the buffer. Return 1 if we find the option, or 0 if it is
* not given.
*/
int
tgetflag(id)
char *id;
{
return(cgetcap(tbuf, id, ':') != NULL);
return (cgetcap(tbuf, id, ':') != NULL);
}
/*
@ -185,7 +196,7 @@ tgetstr(id, area)
char ids[3];
char *s;
int i;
/*
* XXX
* This is for all the boneheaded programs that relied on tgetstr
@ -197,8 +208,8 @@ tgetstr(id, area)
if ((i = cgetstr(tbuf, ids, &s)) < 0)
return NULL;
strcpy(*area, s);
*area += i + 1;
return(s);
return (s);
}

View File

@ -1,64 +0,0 @@
/*-
* Copyright (c) 1983 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)tc1.c 5.3 (Berkeley) 4/12/91";*/
static char rcsid[] = "$Id: tc1.c,v 1.2 1993/08/01 18:32:18 mycroft Exp $";
#endif /* not lint */
/*
* tc1 [term]
* dummy program to test termlib.
* gets entry, counts it, and prints it.
*/
#include <stdio.h>
char buf[1024];
char *getenv();
main(argc, argv) char **argv; {
char *p;
int rc;
if (argc < 2)
p = getenv("TERM");
else
p = argv[1];
rc = tgetent(buf,p);
printf("tgetent returns %d, len=%d, text=\n'%s'\n",rc,strlen(buf),buf);
}

View File

@ -1,91 +0,0 @@
/*-
* Copyright (c) 1983 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)tc2.c 5.3 (Berkeley) 4/12/91";*/
static char rcsid[] = "$Id: tc2.c,v 1.2 1993/08/01 18:32:17 mycroft Exp $";
#endif /* not lint */
/*
* tc2 [term]
* Dummy program to test out termlib.
* Commands are "tcc\n" where t is type (s for string, f for flag,
* or n for number) and cc is the name of the capability.
*/
#include <stdio.h>
char buf[1024];
char *getenv(), *tgetstr();
main(argc, argv) char **argv; {
char *p, *q;
int rc;
char b[3], c;
char area[200];
if (argc < 2)
p = getenv("TERM");
else
p = argv[1];
rc = tgetent(buf,p);
for (;;) {
c = getchar();
if (c < 0)
exit(0);
b[0] = getchar();
if (b[0] < ' ')
exit(0);
b[1] = getchar();
b[2] = 0;
getchar();
switch(c) {
case 'f':
printf("%s: %d\n",b,tgetflag(b));
break;
case 'n':
printf("%s: %d\n",b,tgetnum(b));
break;
case 's':
q = area;
printf("%s: %s\n",b,tgetstr(b,&q));
break;
default:
exit(0);
}
}
}

View File

@ -1,113 +0,0 @@
/*-
* Copyright (c) 1983 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 The Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)tc3.c 5.4 (Berkeley) 4/12/91";*/
static char rcsid[] = "$Id: tc3.c,v 1.2 1993/08/01 18:32:15 mycroft Exp $";
#endif /* not lint */
/*
* tc3 [term]
* Dummy program to test out termlib. Input two numbers (row and col)
* and it prints out the tgoto string generated.
*/
#include <stdio.h>
char buf[1024];
char *getenv(), *tgetstr();
char *rdchar();
char *tgoto();
char *CM;
char cmbuff[30];
char *x;
char *UP;
char *tgout;
main(argc, argv) char **argv; {
char *p;
int rc;
int row, col;
if (argc < 2)
p = getenv("TERM");
else
p = argv[1];
rc = tgetent(buf,p);
x = cmbuff;
UP = tgetstr("up", &x);
printf("UP = %x = ", UP); pr(UP); printf("\n");
if (UP && *UP==0)
UP = 0;
CM = tgetstr("cm", &x);
printf("CM = "); pr(CM); printf("\n");
for (;;) {
if (scanf("%d %d", &row, &col) < 2)
exit(0);
tgout = tgoto(CM, col, row);
pr(tgout);
printf("\n");
}
}
pr(p)
register char *p;
{
for (; *p; p++)
printf("%s", rdchar(*p));
}
/*
* rdchar() returns a readable representation of an ASCII character
* using ^ for control, ' for meta.
*/
#include <ctype.h>
char *rdchar(c)
char c;
{
static char ret[4];
register char *p = ret;
if ((c&0377) > 0177)
*p++ = '\'';
c &= 0177;
if (!isprint(c))
*p++ = '^';
*p++ = (isprint(c) ? c : c^0100);
*p = 0;
return (ret);
}

View File

@ -1,6 +1,8 @@
/* $NetBSD: tgoto.c,v 1.4 1995/02/27 10:18:59 cgd Exp $ */
/*
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +34,11 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)tgoto.c 5.4 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: tgoto.c,v 1.3 1994/10/19 02:57:11 cgd Exp $";
#if 0
static char sccsid[] = "@(#)tgoto.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: tgoto.c,v 1.4 1995/02/27 10:18:59 cgd Exp $";
#endif
#endif /* not lint */
#include <string.h>

View File

@ -1,6 +1,8 @@
/* $NetBSD: tputs.c,v 1.3 1995/02/27 10:19:03 cgd Exp $ */
/*
* Copyright (c) 1980 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -32,8 +34,11 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)tputs.c 5.3 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: tputs.c,v 1.2 1993/08/01 18:32:04 mycroft Exp $";
#if 0
static char sccsid[] = "@(#)tputs.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: tputs.c,v 1.3 1995/02/27 10:19:03 cgd Exp $";
#endif
#endif /* not lint */
#include <sgtty.h>