Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib Move longname(3) from curses to terminfo, pre-cursor to ...



details:   https://anonhg.NetBSD.org/src/rev/d5f4130b345a
branches:  trunk
changeset: 770120:d5f4130b345a
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Oct 04 11:01:13 2011 +0000

description:
Move longname(3) from curses to terminfo, pre-cursor to fix PR/43386.

diffstat:

 lib/libcurses/Makefile         |   4 +-
 lib/libcurses/curses.3         |   5 +-
 lib/libcurses/curses.h         |   3 +-
 lib/libcurses/curses_private.h |   4 +-
 lib/libcurses/curses_termcap.3 |  19 +-------
 lib/libcurses/longname.c       |  88 ------------------------------------------
 lib/libcurses/setterm.c        |  15 +------
 lib/libterminfo/Makefile       |   4 +-
 lib/libterminfo/curterm.c      |  16 ++++++-
 lib/libterminfo/term.h         |   3 +-
 lib/libterminfo/terminfo.3     |  11 ++++-
 11 files changed, 38 insertions(+), 134 deletions(-)

diffs (truncated from 381 to 300 lines):

diff -r d431e6d858bf -r d5f4130b345a lib/libcurses/Makefile
--- a/lib/libcurses/Makefile    Tue Oct 04 10:55:53 2011 +0000
+++ b/lib/libcurses/Makefile    Tue Oct 04 11:01:13 2011 +0000
@@ -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 @@
         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 \
diff -r d431e6d858bf -r d5f4130b345a lib/libcurses/curses.3
--- a/lib/libcurses/curses.3    Tue Oct 04 10:55:53 2011 +0000
+++ b/lib/libcurses/curses.3    Tue Oct 04 11:01:13 2011 +0000
@@ -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 @@
 .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
diff -r d431e6d858bf -r d5f4130b345a lib/libcurses/curses.h
--- a/lib/libcurses/curses.h    Tue Oct 04 10:55:53 2011 +0000
+++ b/lib/libcurses/curses.h    Tue Oct 04 11:01:13 2011 +0000
@@ -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 @@
 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);
diff -r d431e6d858bf -r d5f4130b345a lib/libcurses/curses_private.h
--- a/lib/libcurses/curses_private.h    Tue Oct 04 10:55:53 2011 +0000
+++ b/lib/libcurses/curses_private.h    Tue Oct 04 11:01:13 2011 +0000
@@ -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 @@
        unsigned int len;
        int meta_state;
        char padchar;
-       char ttytype[128];
        int endwin;
        int notty;
        int half_delay;
@@ -314,7 +313,6 @@
 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);
diff -r d431e6d858bf -r d5f4130b345a lib/libcurses/curses_termcap.3
--- a/lib/libcurses/curses_termcap.3    Tue Oct 04 10:55:53 2011 +0000
+++ b/lib/libcurses/curses_termcap.3    Tue Oct 04 11:01:13 2011 +0000
@@ -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@localhost, brett_lymn%yahoo.com.au@localhost)
@@ -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 @@
 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
diff -r d431e6d858bf -r d5f4130b345a lib/libcurses/longname.c
--- a/lib/libcurses/longname.c  Tue Oct 04 10:55:53 2011 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -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);
-}
diff -r d431e6d858bf -r d5f4130b345a lib/libcurses/setterm.c
--- a/lib/libcurses/setterm.c   Tue Oct 04 10:55:53 2011 +0000
+++ b/lib/libcurses/setterm.c   Tue Oct 04 11:01:13 2011 +0000
@@ -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 @@
        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 ||
diff -r d431e6d858bf -r d5f4130b345a lib/libterminfo/Makefile
--- a/lib/libterminfo/Makefile  Tue Oct 04 10:55:53 2011 +0000
+++ b/lib/libterminfo/Makefile  Tue Oct 04 11:01:13 2011 +0000
@@ -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 @@
 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 \
diff -r d431e6d858bf -r d5f4130b345a lib/libterminfo/curterm.c
--- a/lib/libterminfo/curterm.c Tue Oct 04 10:55:53 2011 +0000
+++ b/lib/libterminfo/curterm.c Tue Oct 04 11:01:13 2011 +0000
@@ -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 $");
 



Home | Main Index | Thread Index | Old Index