Date: Sat, 11 Dec 1999 18:40:45 +0100 (CET) From: cejkar@dcse.fee.vutbr.cz To: FreeBSD-gnats-submit@freebsd.org Subject: bin/15418: tput(1) doesn't work with new libncurses.so.5 Message-ID: <199912111740.SAA74237@kazi.dcse.fee.vutbr.cz>
next in thread | raw e-mail | index | archive | help
>Number: 15418
>Category: bin
>Synopsis: tput(1) doesn't work with new libncurses.so.5
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Dec 11 09:50:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator: Rudolf Cejka
>Release: FreeBSD 4.0-CURRENT i386
>Organization:
Brno University of Technology, FEE&CS, Czech Republic
>Environment:
4.0-CURRENT, Dec 10 1999
>Description:
This is similar problem to bin/14202, but instead of Emacs the problem
is in tput(1): It parses a result of tgetstr() and expects a termcap
format. But new ncurses library returns the result in a terminfo format.
(Parsing is needed for discovering a number of parameters.)
>How-To-Repeat:
# tput cm 0 0
tput: unknown % escape `p' for capability `cm'
tput: unknown % escape `p' for capability `cm'
>Fix:
Follows patch constructed according to termcap(5):
(Hmm. In tput.c there is no $Id$ nor $FreeBSD$...)
--- tput.c.orig Sat Dec 11 16:34:23 1999
+++ tput.c Sat Dec 11 18:11:17 1999
@@ -47,6 +47,7 @@
#include <termcap.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#undef putchar
@@ -139,34 +140,40 @@
"too many arguments (%d) for capability `%s'";
static char erresc[] =
"unknown %% escape `%c' for capability `%s'";
+ static char errcap[] =
+ "unexpected end of capability `%s'";
char *cp;
int arg_need, arg_rows, arg_cols;
/* Count how many values we need for this capability. */
for (cp = str, arg_need = 0; *cp != '\0'; cp++)
if (*cp == '%')
- switch (*++cp) {
- case 'd':
- case '2':
- case '3':
- case '.':
- case '+':
- arg_need++;
- break;
- case '%':
- case '>':
- case 'i':
- case 'r':
- case 'n':
- case 'B':
- case 'D':
- break;
- default:
- /*
- * hpux has lot's of them, but we complain
- */
- warnx(erresc, *cp, cap);
- }
+ switch (*++cp) {
+ case 'p':
+ if (*++cp == '\0') {
+ warnx(errcap, cap);
+ cp--;
+ break;
+ }
+ if (*cp >= '1' && *cp <= '9' && *cp > arg_need)
+ arg_need = *cp - '0';
+ break;
+ case '\'':
+ if (*++cp == '\0') {
+ warnx(errcap, cap);
+ cp--;
+ }
+ break;
+ case '\0':
+ warnx(errcap, cap);
+ cp--;
+ break;
+ default:
+ if (strchr("%:# 0123456789.doxXs" /* + */
+ "cPg{l+-*/m&|^=><AO!~i?te;", *cp) == NULL)
+ warnx(erresc, *cp, cap);
+ break;
+ }
/* And print them. */
switch (arg_need) {
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912111740.SAA74237>
