Module Name:    src
Committed By:   roy
Date:           Tue Oct  4 11:02:32 UTC 2011

Modified Files:
        src/usr.bin/tput: tput.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tput/tput.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/tput/tput.c
diff -u src/usr.bin/tput/tput.c:1.20 src/usr.bin/tput/tput.c:1.21
--- src/usr.bin/tput/tput.c:1.20	Wed Feb  3 15:34:46 2010
+++ src/usr.bin/tput/tput.c	Tue Oct  4 11:02:32 2011
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #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 @@ __RCSID("$NetBSD: tput.c,v 1.20 2010/02/
 #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 @@ int
 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 @@ main(int argc, char **argv)
 			break;
 		case 'l':
 			if (!strcmp(p, "longname")) {
-				prlongname(tbuf);
+				(void)printf("%s\n", longname());
 				continue;
 			}
 			break;
@@ -130,21 +129,6 @@ main(int argc, char **argv)
 	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)
 {

Reply via email to