Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/tput tput now uses longname(3) to derive the termina...



details:   https://anonhg.NetBSD.org/src/rev/7ca21807d6a4
branches:  trunk
changeset: 770121:7ca21807d6a4
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Oct 04 11:02:32 2011 +0000

description:
tput now uses longname(3) to derive the terminal description instead
of trying to parse it from termpcap.
Fixes PR/43386.

diffstat:

 usr.bin/tput/tput.c |  24 ++++--------------------
 1 files changed, 4 insertions(+), 20 deletions(-)

diffs (66 lines):

diff -r d5f4130b345a -r 7ca21807d6a4 usr.bin/tput/tput.c
--- a/usr.bin/tput/tput.c       Tue Oct 04 11:01:13 2011 +0000
+++ b/usr.bin/tput/tput.c       Tue Oct 04 11:02:32 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tput.c,v 1.20 2010/02/03 15:34:46 roy Exp $    */
+/*     $NetBSD: tput.c,v 1.21 2011/10/04 11:02:32 roy Exp $    */
 
 /*-
  * Copyright (c) 1980, 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)tput.c     8.3 (Berkeley) 4/28/95";
 #endif
-__RCSID("$NetBSD: tput.c,v 1.20 2010/02/03 15:34:46 roy Exp $");
+__RCSID("$NetBSD: tput.c,v 1.21 2011/10/04 11:02:32 roy Exp $");
 #endif /* not lint */
 
 #include <termios.h>
@@ -53,7 +53,6 @@
 #include <unistd.h>
 
 static int    outc(int);
-static void   prlongname(char *);
 static void   usage(void) __dead;
 static char **process(const char *, const char *, char **);
 
@@ -61,7 +60,7 @@
 main(int argc, char **argv)
 {
        int ch, exitval, n;
-       char *term, tbuf[1024];
+       char *term;
        const char *p, *s;
 
        term = NULL;
@@ -97,7 +96,7 @@
                        break;
                case 'l':
                        if (!strcmp(p, "longname")) {
-                               prlongname(tbuf);
+                               (void)printf("%s\n", longname());
                                continue;
                        }
                        break;
@@ -130,21 +129,6 @@
        return argv ? exitval : 2;
 }
 
-static void
-prlongname(char *buf)
-{
-       int savech;
-       char *p, *savep;
-
-       for (p = buf; *p && *p != ':'; ++p)
-               continue;
-       savech = *(savep = p);
-       for (*p = '\0'; p >= buf && *p != '|'; --p)
-               continue;
-       (void)printf("%s\n", p + 1);
-       *savep = savech;
-}
-
 static char **
 process(const char *cap, const char *str, char **argv)
 {



Home | Main Index | Thread Index | Old Index