Move longname(3) from curses to terminfo, pre-cursor to fix PR/43386.
This commit is contained in:
parent
087ced08e5
commit
64afaacce6
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.65 2011/04/04 10:32:04 blymn Exp $
|
||||
# $NetBSD: Makefile,v 1.66 2011/10/04 11:01:13 roy Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 1/2/94
|
||||
|
||||
.include <bsd.own.mk>
|
||||
@ -102,7 +102,7 @@ MLINKS+= curses_addch.3 addch.3 curses_addchstr.3 addchnstr.3 \
|
||||
curses_touch.3 is_wintouched.3 curses_screen.3 isendwin.3 \
|
||||
curses_keyname.3 keyname.3 \
|
||||
curses_input.3 keypad.3 curses_tty.3 killchar.3 \
|
||||
curses_refresh.3 leaveok.3 curses_termcap.3 longname.3 \
|
||||
curses_refresh.3 leaveok.3 \
|
||||
curses_tty.3 meta.3 curses_cursor.3 move.3 \
|
||||
curses_addch.3 mvaddch.3 curses_addchstr.3 mvaddchnstr.3 \
|
||||
curses_addchstr.3 mvaddchstr.3 curses_addstr.3 mvaddnstr.3 \
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: curses.3,v 1.61 2010/12/09 13:26:27 njoly Exp $
|
||||
.\" $NetBSD: curses.3,v 1.62 2011/10/04 11:01:13 roy Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1985, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -29,7 +29,7 @@
|
||||
.\"
|
||||
.\" @(#)curses.3 8.1 (Berkeley) 6/4/93
|
||||
.\"
|
||||
.Dd July 6, 2009
|
||||
.Dd October 4, 2011
|
||||
.Dt CURSES 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -158,7 +158,6 @@ must be called before any of the other routines that deal with color are used.
|
||||
.It keypad Ta Xr curses_input 3
|
||||
.It killchar Ta Xr curses_tty 3
|
||||
.It leaveok Ta Xr curses_tty 3
|
||||
.It longname Ta Xr curses_termcap 3
|
||||
.It meta Ta Xr curses_tty 3
|
||||
.It move Ta Xr curses_cursor 3
|
||||
.It mvaddch Ta Xr curses_addch 3
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: curses.h,v 1.102 2011/07/17 20:54:34 joerg Exp $ */
|
||||
/* $NetBSD: curses.h,v 1.103 2011/10/04 11:01:13 roy Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
@ -672,7 +672,6 @@ int keypad(WINDOW *, bool);
|
||||
char *keyname(int);
|
||||
char killchar(void);
|
||||
int leaveok(WINDOW *, bool);
|
||||
char *longname(void);
|
||||
int meta(WINDOW *, bool);
|
||||
int mvcur(int, int, int, int);
|
||||
int mvderwin(WINDOW *, int, int);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: curses_private.h,v 1.46 2010/12/16 17:42:28 wiz Exp $ */
|
||||
/* $NetBSD: curses_private.h,v 1.47 2011/10/04 11:01:13 roy Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998-2000 Brett Lymn
|
||||
@ -239,7 +239,6 @@ struct __screen {
|
||||
unsigned int len;
|
||||
int meta_state;
|
||||
char padchar;
|
||||
char ttytype[128];
|
||||
int endwin;
|
||||
int notty;
|
||||
int half_delay;
|
||||
@ -314,7 +313,6 @@ void __cursesi_putnsp(nschar_t *, const int, const int);
|
||||
void __cursesi_chtype_to_cchar(chtype, cchar_t *);
|
||||
#endif /* HAVE_WCHAR */
|
||||
int __unget(wint_t);
|
||||
char *__longname(char *, char *); /* Original BSD version */
|
||||
int __mvcur(int, int, int, int, int);
|
||||
WINDOW *__newwin(SCREEN *, int, int, int, int, int);
|
||||
int __nodelay(void);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: curses_termcap.3,v 1.4 2003/04/16 13:35:01 wiz Exp $
|
||||
.\" $NetBSD: curses_termcap.3,v 1.5 2011/10/04 11:01:14 roy Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2002
|
||||
.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au)
|
||||
@ -30,14 +30,13 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\"
|
||||
.Dd August 12, 2002
|
||||
.Dd October 4, 2011
|
||||
.Dt CURSES_TERMCAP 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm curses_termcap ,
|
||||
.Nm fullname ,
|
||||
.Nm getcap ,
|
||||
.Nm longname
|
||||
.Nm getcap
|
||||
.Nd curses termcap querying routines
|
||||
.Sh LIBRARY
|
||||
.Lb libcurses
|
||||
@ -47,8 +46,6 @@
|
||||
.Fn fullname "char *termbuf" "char *name"
|
||||
.Ft char *
|
||||
.Fn getcap "char *name"
|
||||
.Ft char *
|
||||
.Fn longname "void"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn fullname
|
||||
@ -68,16 +65,6 @@ A termcap entry can be retrieved by calling the
|
||||
function with the name of the capability in
|
||||
.Fa name .
|
||||
The matching capability string for the terminal is returned.
|
||||
.Pp
|
||||
The
|
||||
.Fn longname
|
||||
function returns a verbose description of the terminal which is taken
|
||||
from the last name alias in the termcap description for the terminal.
|
||||
This string will be at most 128 characters long and will only be
|
||||
defined after a call to
|
||||
.Fn initscr
|
||||
or
|
||||
.Fn newterm .
|
||||
.Sh RETURN VALUES
|
||||
Functions returning pointers will return
|
||||
.Dv NULL
|
||||
|
@ -1,88 +0,0 @@
|
||||
/* $NetBSD: longname.c,v 1.16 2004/01/20 08:29:29 wiz Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 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
|
||||
* 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. 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)longname.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: longname.c,v 1.16 2004/01/20 08:29:29 wiz Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "curses.h"
|
||||
#include "curses_private.h"
|
||||
|
||||
/*
|
||||
* __longname --
|
||||
* Fill in "def" with the long name of the terminal.
|
||||
* This is the original BSD version of longname(), modified to return
|
||||
* at most 128 characters.
|
||||
*/
|
||||
char *
|
||||
__longname(char *bp, char *def)
|
||||
{
|
||||
char *cp, *last_bp;
|
||||
int i = 0;
|
||||
|
||||
last_bp = NULL;
|
||||
do {
|
||||
while (*bp && *bp != ':' && *bp != '|')
|
||||
bp++;
|
||||
if (*bp == '|') {
|
||||
last_bp = bp;
|
||||
bp++;
|
||||
}
|
||||
} while (*bp && *bp != ':');
|
||||
|
||||
if (last_bp != NULL)
|
||||
bp = last_bp;
|
||||
|
||||
if (*bp == '|') {
|
||||
for (cp = def, ++bp; *bp && *bp != ':' && *bp != '|' &&
|
||||
i < 127;)
|
||||
*cp++ = *bp++;
|
||||
i++;
|
||||
*cp = '\0';
|
||||
}
|
||||
return (def);
|
||||
}
|
||||
|
||||
/*
|
||||
* longname --
|
||||
* Return pointer to the long name of the terminal.
|
||||
* This is the SUS version of longname()
|
||||
*/
|
||||
char *
|
||||
longname(void)
|
||||
{
|
||||
return (_cursesi_screen->ttytype);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setterm.c,v 1.47 2010/02/11 11:45:47 roy Exp $ */
|
||||
/* $NetBSD: setterm.c,v 1.48 2011/10/04 11:01:14 roy Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1981, 1993, 1994
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setterm.c 8.8 (Berkeley) 10/25/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: setterm.c,v 1.47 2010/02/11 11:45:47 roy Exp $");
|
||||
__RCSID("$NetBSD: setterm.c,v 1.48 2011/10/04 11:01:14 roy Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -127,17 +127,6 @@ _cursesi_setterm(char *type, SCREEN *screen)
|
||||
screen->padchar = t_pad_char(screen->term) ?
|
||||
t_pad_char(screen->term)[0] : 0;
|
||||
|
||||
/* Get full name of terminal */
|
||||
if (unknown) {
|
||||
strcpy(screen->ttytype, "dumb");
|
||||
return ERR;
|
||||
}
|
||||
if (screen->term->desc == NULL)
|
||||
screen->ttytype[0] = '\0';
|
||||
else
|
||||
strlcpy(screen->ttytype, screen->term->desc,
|
||||
sizeof(screen->ttytype));
|
||||
|
||||
/* If no scrolling commands, no quick change. */
|
||||
screen->noqch =
|
||||
(t_change_scroll_region(screen->term) == NULL ||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.16 2011/10/03 13:10:58 roy Exp $
|
||||
# $NetBSD: Makefile,v 1.17 2011/10/04 11:01:14 roy Exp $
|
||||
|
||||
USE_SHLIBDIR= yes
|
||||
|
||||
@ -15,7 +15,7 @@ INCSDIR= /usr/include
|
||||
MAN= terminfo.3 terminfo.5
|
||||
MLINKS= terminfo.3 setupterm.3 \
|
||||
terminfo.3 set_curterm.3 terminfo.3 del_curterm.3 \
|
||||
terminfo.3 termname.3 \
|
||||
terminfo.3 termname.3 terminfo.3 longname.3 \
|
||||
terminfo.3 tigetnum.3 terminfo.3 tigetflag.3 \
|
||||
terminfo.3 tigetstr.3 terminfo.3 tparm.3 terminfo.3 tputs.3 \
|
||||
terminfo.3 putp.3 \
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: curterm.c,v 1.6 2011/10/03 19:18:55 roy Exp $ */
|
||||
/* $NetBSD: curterm.c,v 1.7 2011/10/04 11:01:14 roy Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: curterm.c,v 1.6 2011/10/03 19:18:55 roy Exp $");
|
||||
__RCSID("$NetBSD: curterm.c,v 1.7 2011/10/04 11:01:14 roy Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
@ -108,3 +108,15 @@ termname(void)
|
||||
_DIAGASSERT(cur_term != NULL);
|
||||
return __UNCONST(cur_term->name);
|
||||
}
|
||||
|
||||
static const char * nullname = '\0';
|
||||
|
||||
char *
|
||||
longname(void)
|
||||
{
|
||||
|
||||
_DIAGASSERT(cur_term != NULL);
|
||||
if (cur_term->desc == NULL)
|
||||
return __UNCONST(nullname);
|
||||
return __UNCONST(cur_term->desc);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: term.h,v 1.9 2011/10/03 12:31:51 roy Exp $ */
|
||||
/* $NetBSD: term.h,v 1.10 2011/10/04 11:01:14 roy Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
|
||||
@ -1469,6 +1469,7 @@ int setupterm(const char *, int, int *);
|
||||
TERMINAL * set_curterm(TERMINAL *);
|
||||
int del_curterm(TERMINAL *);
|
||||
char * termname(void);
|
||||
char * longname(void);
|
||||
|
||||
/* information functions */
|
||||
int tigetflag(const char *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: terminfo.3,v 1.7 2011/10/03 19:15:03 roy Exp $
|
||||
.\" $NetBSD: terminfo.3,v 1.8 2011/10/04 11:01:14 roy Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd October 3, 2011
|
||||
.Dd October 4, 2011
|
||||
.Dt TERMINFO 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -35,6 +35,7 @@
|
||||
.Nm set_curterm ,
|
||||
.Nm del_curterm ,
|
||||
.Nm termname ,
|
||||
.Nm longname ,
|
||||
.Nm tigetflag ,
|
||||
.Nm tigetnum ,
|
||||
.Nm tigetstr ,
|
||||
@ -57,6 +58,8 @@
|
||||
.Fn del_curterm "TERMINAL *oterm"
|
||||
.Ft char *
|
||||
.Fn termname "void"
|
||||
.Ft char *
|
||||
.Fn longname "void"
|
||||
.Ft int
|
||||
.Fn tigetnum "const char *id"
|
||||
.Ft int
|
||||
@ -148,6 +151,10 @@ The
|
||||
.Fn termname
|
||||
function returns the name of
|
||||
.Va cur_term .
|
||||
The
|
||||
.Fn longname
|
||||
function returns the description of
|
||||
.Va cur_term .
|
||||
.Pp
|
||||
The
|
||||
.Fn tigetflag
|
||||
|
Loading…
Reference in New Issue
Block a user