CVS commit: src/lib/libterminfo
Module Name:src Committed By: martin Date: Mon May 20 09:48:42 UTC 2024 Modified Files: src/lib/libterminfo: Makefile Log Message: Use double quotes to include the local ./Makefile.hash To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libterminfo/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/Makefile diff -u src/lib/libterminfo/Makefile:1.23 src/lib/libterminfo/Makefile:1.24 --- src/lib/libterminfo/Makefile:1.23 Sun Apr 5 12:31:02 2020 +++ src/lib/libterminfo/Makefile Mon May 20 09:48:42 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.23 2020/04/05 12:31:02 roy Exp $ +# $NetBSD: Makefile,v 1.24 2024/05/20 09:48:42 martin Exp $ .include @@ -47,7 +47,7 @@ MLINKS+= termcap.3 tgetent.3 termcap.3 t CPPFLAGS+= -I${.OBJDIR} -.include +.include "Makefile.hash" # Generate our man pages terminfo.5: genman terminfo.5.in term.h termcap_map.c
CVS commit: src/lib/libterminfo
Module Name:src Committed By: martin Date: Mon May 20 09:48:42 UTC 2024 Modified Files: src/lib/libterminfo: Makefile Log Message: Use double quotes to include the local ./Makefile.hash To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libterminfo/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: christos Date: Fri Apr 5 22:30:18 UTC 2024 Modified Files: src/lib/libterminfo: genman Log Message: >From Jan-Benedict Glaw: Use `printf` instead of `echo` for precise output `man` pages generated under NetBSD and Linux differ as the escape codes may or may not be interpreted when going through those two chained `echo`es. Instead just use `printf`, which produces the desired output, always. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/genman Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: christos Date: Fri Apr 5 22:30:18 UTC 2024 Modified Files: src/lib/libterminfo: genman Log Message: >From Jan-Benedict Glaw: Use `printf` instead of `echo` for precise output `man` pages generated under NetBSD and Linux differ as the escape codes may or may not be interpreted when going through those two chained `echo`es. Instead just use `printf`, which produces the desired output, always. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/genman Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/genman diff -u src/lib/libterminfo/genman:1.5 src/lib/libterminfo/genman:1.6 --- src/lib/libterminfo/genman:1.5 Fri Jan 25 07:52:45 2013 +++ src/lib/libterminfo/genman Fri Apr 5 18:30:18 2024 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: genman,v 1.5 2013/01/25 12:52:45 roy Exp $ +# $NetBSD: genman,v 1.6 2024/04/05 22:30:18 christos Exp $ # Copyright (c) 2009, 2013 The NetBSD Foundation, Inc. # @@ -44,11 +44,11 @@ gentab() # Generate a list of long names and codes $TOOL_SED -n \ -e "s/#define t_\([^(]*\).*>$tab\[TICODE_\([^]]*\).*/\1 \2/p" \ - $ti | $TOOL_SORT | while read name code foo; do + $ti | $TOOL_SORT | while read name code _; do cap=$($TOOL_SED -ne "s/.*{ \"\(..\)\", TICODE_$code }.*/\1/p" \ $tc | head -n 1) desc=$($TOOL_SED -ne "s/ \* $name\: \(.*\)/\1/p" $ti) - echo ".It \"\\&$name\" Ta Sy \"\\&$code\" Ta Sy \"\\&$cap\" Ta \"\\&$desc\"" + printf '.It "\\&%s" Ta Sy "\\&%s" Ta Sy "\\&%s" Ta "\\&%s"\n' "${name}" "${code}" "${cap}" "${desc}" done } @@ -56,15 +56,15 @@ boolcaps=$(gentab $TERMH $TERMC flags) numcaps=$(gentab $TERMH $TERMC nums) strcaps=$(gentab $TERMH $TERMC strs) -echo ".\\\"DO NOT EDIT" -echo ".\\\"Automatically generated from termcap.5.in" -echo ".\\\"" +printf '.\\"DO NOT EDIT\n' +printf '.\\"Automatically generated from termcap.5.in\n' +printf '.\\"\n' while read -r line; do case "$line" in - "@BOOLCAPS@") echo "$boolcaps";; - "@NUMCAPS@") echo "$numcaps";; - "@STRCAPS@") echo "$strcaps";; - *) echo "$line";; + "@BOOLCAPS@") printf '%s\n' "${boolcaps}";; + "@NUMCAPS@") printf '%s\n' "${numcaps}";; + "@STRCAPS@") printf '%s\n' "${strcaps}";; + *) printf '%s\n' "${line}";; esac done <$TERMM
CVS commit: src/lib/libterminfo
Module Name:src Committed By: blymn Date: Wed Dec 15 21:07:12 UTC 2021 Modified Files: src/lib/libterminfo: tputs.c Log Message: Fix for PR lib/56298 Remove the DIAGASSERT for str being NULL in the puts/putp functions, add protection so that the functions just return OK if str is NULL. This prevents the assert firing when libcurses passes through a NULL due to an undefined terminfo entry. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/tputs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: blymn Date: Wed Dec 15 21:07:12 UTC 2021 Modified Files: src/lib/libterminfo: tputs.c Log Message: Fix for PR lib/56298 Remove the DIAGASSERT for str being NULL in the puts/putp functions, add protection so that the functions just return OK if str is NULL. This prevents the assert firing when libcurses passes through a NULL due to an undefined terminfo entry. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/tputs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/tputs.c diff -u src/lib/libterminfo/tputs.c:1.5 src/lib/libterminfo/tputs.c:1.6 --- src/lib/libterminfo/tputs.c:1.5 Thu Oct 3 18:02:05 2019 +++ src/lib/libterminfo/tputs.c Wed Dec 15 21:07:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tputs.c,v 1.5 2019/10/03 18:02:05 christos Exp $ */ +/* $NetBSD: tputs.c,v 1.6 2021/12/15 21:07:12 blymn Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include -__RCSID("$NetBSD: tputs.c,v 1.5 2019/10/03 18:02:05 christos Exp $"); +__RCSID("$NetBSD: tputs.c,v 1.6 2021/12/15 21:07:12 blymn Exp $"); #include #include @@ -135,9 +135,11 @@ ti_puts(const TERMINAL *term, const char char pc; _DIAGASSERT(term != NULL); - _DIAGASSERT(str != NULL); _DIAGASSERT(outc != NULL); + if (str == NULL) + return OK; + dodelay = (str == t_bell(term) || str == t_flash_screen(term) || (t_xon_xoff(term) == 0 && t_padding_baud_rate(term) != 0)); @@ -155,7 +157,6 @@ ti_putp(const TERMINAL *term, const char { _DIAGASSERT(term != NULL); - _DIAGASSERT(str != NULL); return ti_puts(term, str, 1, (int (*)(int, void *))(void *)putchar, NULL); } @@ -164,7 +165,6 @@ int tputs(const char *str, int affcnt, int (*outc)(int)) { - _DIAGASSERT(str != NULL); _DIAGASSERT(outc != NULL); return _ti_puts(1, ospeed, PC, str, affcnt, (int (*)(int, void *))(void *)outc, NULL); @@ -174,6 +174,5 @@ int putp(const char *str) { - _DIAGASSERT(str != NULL); return tputs(str, 1, putchar); }
CVS commit: src/lib/libterminfo
Module Name:src Committed By: rillig Date: Fri Aug 27 18:40:28 UTC 2021 Modified Files: src/lib/libterminfo: tparm.c Log Message: libterminfo: remove redundant lint annotations Since 2021-02-28, lint does not warn about constant conditions if they involve sizeof. The fallthrough annotations have never been necessary for case labels that directly follow each other. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/lib/libterminfo/tparm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: rillig Date: Fri Aug 27 18:40:28 UTC 2021 Modified Files: src/lib/libterminfo: tparm.c Log Message: libterminfo: remove redundant lint annotations Since 2021-02-28, lint does not warn about constant conditions if they involve sizeof. The fallthrough annotations have never been necessary for case labels that directly follow each other. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/lib/libterminfo/tparm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/tparm.c diff -u src/lib/libterminfo/tparm.c:1.18 src/lib/libterminfo/tparm.c:1.19 --- src/lib/libterminfo/tparm.c:1.18 Fri Mar 27 15:11:57 2020 +++ src/lib/libterminfo/tparm.c Fri Aug 27 18:40:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tparm.c,v 1.18 2020/03/27 15:11:57 christos Exp $ */ +/* $NetBSD: tparm.c,v 1.19 2021/08/27 18:40:28 rillig Exp $ */ /* * Copyright (c) 2009, 2011, 2013 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include -__RCSID("$NetBSD: tparm.c,v 1.18 2020/03/27 15:11:57 christos Exp $"); +__RCSID("$NetBSD: tparm.c,v 1.19 2021/08/27 18:40:28 rillig Exp $"); #include #include @@ -42,7 +42,7 @@ __RCSID("$NetBSD: tparm.c,v 1.18 2020/03 #include #define LONG_STR_MAX ((CHAR_BIT * sizeof(long)) / 3) -#define BUFINC 128 /* Size to increament the terminal buffer by */ +#define BUFINC 128 /* Size to increment the terminal buffer by */ #define VA_LONG_LONG 1 #define VA_CHAR_INT 2 @@ -157,7 +157,7 @@ _ti_parm_analyse(const char *str, int *p continue; c = *str++; switch (c) { - case 'l': /* FALLTHROUGH */ + case 'l': case 's': if (lpop > 0) { if (lpop <= piss_len) @@ -235,7 +235,7 @@ _ti_tiparm(TERMINAL *term, const char *s if (va_type == VA_LONG_LONG) { /* This only works if char * fits into a long * on this platform. */ -if (sizeof(char *) <= sizeof(long)/*CONSTCOND*/) +if (sizeof(char *) <= sizeof(long)) params[l].string = (char *)va_arg(parms, long); else { @@ -270,20 +270,20 @@ _ti_tiparm(TERMINAL *term, const char *s val = 0; while (done == 0 && (size_t)(fp - fmt) < sizeof(fmt)) { switch (c) { - case 'c': /* FALLTHROUGH */ + case 'c': case 's': *fp++ = c; done = 1; break; - case 'd': /* FALLTHROUGH */ - case 'o': /* FALLTHROUGH */ - case 'x': /* FALLTHROUGH */ - case 'X': /* FALLTHROUGH */ + case 'd': + case 'o': + case 'x': + case 'X': *fp++ = 'l'; *fp++ = c; done = 1; break; - case '#': /* FALLTHROUGH */ + case '#': case ' ': *fp++ = c; break; @@ -368,9 +368,9 @@ _ti_tiparm(TERMINAL *term, const char *s push((long)l, NULL, ); #endif break; - case 'd': /* FALLTHROUGH */ - case 'o': /* FALLTHROUGH */ - case 'x': /* FALLTHROUGH */ + case 'd': + case 'o': + case 'x': case 'X': pop(, NULL, ); if (onum(term, fmt, (int)val, olen) == 0) @@ -425,18 +425,18 @@ _ti_tiparm(TERMINAL *term, const char *s if (*str == '}') str++; break; - case '+': /* FALLTHROUGH */ - case '-': /* FALLTHROUGH */ - case '*': /* FALLTHROUGH */ - case '/': /* FALLTHROUGH */ - case 'm': /* FALLTHROUGH */ - case 'A': /* FALLTHROUGH */ - case 'O': /* FALLTHROUGH */ - case '&': /* FALLTHROUGH */ - case '|': /* FALLTHROUGH */ - case '^': /* FALLTHROUGH */ - case '=': /* FALLTHROUGH */ - case '<': /* FALLTHROUGH */ + case '+': + case '-': + case '*': + case '/': + case 'm': + case 'A': + case 'O': + case '&': + case '|': + case '^': + case '=': + case '<': case '>': pop(, NULL, ); pop(, NULL, );
CVS commit: src/lib/libterminfo
Module Name:src Committed By: christos Date: Thu Oct 3 18:02:05 UTC 2019 Modified Files: src/lib/libterminfo: tputs.c Log Message: Cast function pointers that take different arguments through void * To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/tputs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: christos Date: Thu Oct 3 18:02:05 UTC 2019 Modified Files: src/lib/libterminfo: tputs.c Log Message: Cast function pointers that take different arguments through void * To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/tputs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/tputs.c diff -u src/lib/libterminfo/tputs.c:1.4 src/lib/libterminfo/tputs.c:1.5 --- src/lib/libterminfo/tputs.c:1.4 Mon May 1 15:09:22 2017 +++ src/lib/libterminfo/tputs.c Thu Oct 3 14:02:05 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: tputs.c,v 1.4 2017/05/01 19:09:22 roy Exp $ */ +/* $NetBSD: tputs.c,v 1.5 2019/10/03 18:02:05 christos Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include -__RCSID("$NetBSD: tputs.c,v 1.4 2017/05/01 19:09:22 roy Exp $"); +__RCSID("$NetBSD: tputs.c,v 1.5 2019/10/03 18:02:05 christos Exp $"); #include #include @@ -156,7 +156,8 @@ ti_putp(const TERMINAL *term, const char _DIAGASSERT(term != NULL); _DIAGASSERT(str != NULL); - return ti_puts(term, str, 1, (int (*)(int, void *))putchar, NULL); + return ti_puts(term, str, 1, + (int (*)(int, void *))(void *)putchar, NULL); } int @@ -166,7 +167,7 @@ tputs(const char *str, int affcnt, int ( _DIAGASSERT(str != NULL); _DIAGASSERT(outc != NULL); return _ti_puts(1, ospeed, PC, str, affcnt, - (int (*)(int, void *))outc, NULL); + (int (*)(int, void *))(void *)outc, NULL); } int
Re: CVS commit: src/lib/libterminfo
On Fri, Jan 25, 2013 at 04:06:09PM -0700, Warner Losh wrote: On Jan 25, 2013, at 4:05 PM, David Laight wrote: Log Message: For platforms where we cannot fit a char * into a long, return NULL and set errno to ENOTSUPP. Could the 'char *' pointers be replaced with indexes into an array? How many platforms is this actually the case on? 64bit windows :-) David -- David Laight: da...@l8s.co.uk
Re: CVS commit: src/lib/libterminfo
On Fri, Jan 25, 2013 at 12:30:06PM +, Roy Marples wrote: Module Name: src Committed By: roy Date: Fri Jan 25 12:30:06 UTC 2013 Modified Files: src/lib/libterminfo: terminfo.3 tparm.c Log Message: For platforms where we cannot fit a char * into a long, return NULL and set errno to ENOTSUPP. Could the 'char *' pointers be replaced with indexes into an array? David -- David Laight: da...@l8s.co.uk
Re: CVS commit: src/lib/libterminfo
On Jan 25, 2013, at 4:05 PM, David Laight wrote: On Fri, Jan 25, 2013 at 12:30:06PM +, Roy Marples wrote: Module Name: src Committed By:roy Date:Fri Jan 25 12:30:06 UTC 2013 Modified Files: src/lib/libterminfo: terminfo.3 tparm.c Log Message: For platforms where we cannot fit a char * into a long, return NULL and set errno to ENOTSUPP. Could the 'char *' pointers be replaced with indexes into an array? How many platforms is this actually the case on? Warner
Re: CVS commit: src/lib/libterminfo
hi, Module Name: src Committed By: roy Date: Wed Nov 2 12:09:26 UTC 2011 Modified Files: src/lib/libterminfo: Makefile genhash genterms genthash Removed Files: src/lib/libterminfo: compiled_terms.c hash.c termcap_hash.c Log Message: Now that nbperf can generate the same file using the -p option, there is no longer a need to store these files in CVS. i guess you need to tweak tools/tic? YAMAMOTO Takashi To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/lib/libterminfo/Makefile cvs rdiff -u -r1.2 -r0 src/lib/libterminfo/compiled_terms.c cvs rdiff -u -r1.7 -r1.8 src/lib/libterminfo/genhash cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/genterms cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/genthash cvs rdiff -u -r1.4 -r0 src/lib/libterminfo/hash.c cvs rdiff -u -r1.3 -r0 src/lib/libterminfo/termcap_hash.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/lib/libterminfo
In article 20110310101719.721f217...@cvs.netbsd.org, Roy Marples source-changes-d@NetBSD.org wrote: -=-=-=-=-=- Module Name: src Committed By: roy Date: Thu Mar 10 10:17:19 UTC 2011 Modified Files: src/lib/libterminfo: termcap.c terminfo.5.in Log Message: Add support for translating the following termcap commands into terminfo: %B %D %r %2 %3 %d %+ % %. Fixes PR bin/44692. Instead of: if (l + 30 len) goto elen; *ip++ = '%'; *ip++ = 'p'; *ip++ = '0' + p; strcpy(ip, %{10}%/%{16}%*%p); ip += 16; *ip++ = '0' + p; strcpy(ip, %{10}%m%+); ip += 9; l += 29; nop = 1; I would put everything in a single format and adjust it: static const char fmt[] = %p0%{10}%/%{16}%*%p0%{10}%m%+; if (l + sizeof(fmt) len) goto elen; memcpy(ip, fmt, sizeof(fmt) - 1); ip[2] += p; ip[19] += p; ip += sizeof(fmt) - 1; l += sizeof(fmt) - 1; nop = 1; I could do all of it the same way assuming that I would encode all characters in a consistent \000 sequence... christos
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Mar 4 15:16:39 UTC 2010 Modified Files: src/lib/libterminfo: termcap.c Log Message: Convert padding and give terminfo some default assumptions about termcap. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/termcap.c diff -u src/lib/libterminfo/termcap.c:1.5 src/lib/libterminfo/termcap.c:1.6 --- src/lib/libterminfo/termcap.c:1.5 Tue Mar 2 14:11:11 2010 +++ src/lib/libterminfo/termcap.c Thu Mar 4 15:16:39 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: termcap.c,v 1.5 2010/03/02 14:11:11 roy Exp $ */ +/* $NetBSD: termcap.c,v 1.6 2010/03/04 15:16:39 roy Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: termcap.c,v 1.5 2010/03/02 14:11:11 roy Exp $); +__RCSID($NetBSD: termcap.c,v 1.6 2010/03/04 15:16:39 roy Exp $); #include assert.h #include ctype.h @@ -229,6 +229,7 @@ strval(const char *val) { char *info, *ip, c; + const char *ps, *pe; int p; size_t len, l, n; @@ -237,6 +238,22 @@ if (info == NULL) return 0; + /* Move the = */ + *ip++ = *val++; + + /* Set ps and pe to point to the start and end of the padding */ + if (isdigit((unsigned char)*val)) { + for (ps = pe = val; + isdigit((unsigned char)*val) || *val == '.'; + val++) + pe++; + if (*val == '*') { + val++; + pe++; + } + } else + ps = pe = NULL; + l = 0; p = 1; for (; *val != '\0'; val++) { @@ -287,6 +304,19 @@ *ip++ = '\\'; } + /* Add our padding at the end. */ + if (ps != NULL) { + n = pe - ps; + if (l + n + 4 len) + goto elen; + *ip++ = '$'; + *ip++ = ''; + strncpy(ip, ps, n); + ip += n; + *ip++ = '/'; + *ip++ = ''; + } + *ip = '\0'; return info; @@ -296,20 +326,38 @@ return NULL; } +static struct def_info { + const char *name; + const char *cap; +} def_infos[] = { + { bel, ^G }, + { cr, ^M }, + { cud1, ^J }, + { ht, ^I }, + { ind, ^J }, + { kbs, ^H }, + { kcub1, ^H }, + { kcud1, ^J }, + { nel, ^M^J } +}; + char * captoinfo(char *cap) { char *info, *ip, *token, *val, *p, tok[3]; const char *name; size_t len, lp, nl, vl, rl; + int defs[__arraycount(def_infos)]; _DIAGASSERT(cap != NULL); len = strlen(cap) * 2; + len += __arraycount(def_infos) * (5 + 4 + 3); /* reserve for defs */ info = ip = malloc(len); if (info == NULL) return NULL; + memset(defs, 0, sizeof(defs)); lp = 0; tok[2] = '\0'; for (token = _ti_get_token(cap, ':'); @@ -334,6 +382,16 @@ val = strval(token + 2); } } + + /* See if this sets a default. */ + for (nl = 0; nl __arraycount(def_infos); nl++) { + if (strcmp(name, def_infos[nl].name) == 0) { +printf (matched %s\n, name); +defs[nl] = 1; +break; + } + } + nl = strlen(name); if (val == NULL) vl = 0; @@ -367,6 +425,19 @@ } } + /* Add any defaults not set above. */ + for (nl = 0; nl __arraycount(def_infos); nl++) { + if (defs[nl] == 0) { + *ip++ = ','; + *ip++ = ' '; + strcpy(ip, def_infos[nl].name); + ip += strlen(def_infos[nl].name); + *ip++ = '='; + strcpy(ip, def_infos[nl].cap); + ip += strlen(def_infos[nl].cap); + } + } + *ip = '\0'; return info; }
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Mar 4 15:16:39 UTC 2010 Modified Files: src/lib/libterminfo: termcap.c Log Message: Convert padding and give terminfo some default assumptions about termcap. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Mar 4 15:35:26 UTC 2010 Modified Files: src/lib/libterminfo: termcap.c Log Message: Convert padding for unknown capabilities as well. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/termcap.c diff -u src/lib/libterminfo/termcap.c:1.6 src/lib/libterminfo/termcap.c:1.7 --- src/lib/libterminfo/termcap.c:1.6 Thu Mar 4 15:16:39 2010 +++ src/lib/libterminfo/termcap.c Thu Mar 4 15:35:26 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: termcap.c,v 1.6 2010/03/04 15:16:39 roy Exp $ */ +/* $NetBSD: termcap.c,v 1.7 2010/03/04 15:35:26 roy Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: termcap.c,v 1.6 2010/03/04 15:16:39 roy Exp $); +__RCSID($NetBSD: termcap.c,v 1.7 2010/03/04 15:35:26 roy Exp $); #include assert.h #include ctype.h @@ -347,7 +347,7 @@ char *info, *ip, *token, *val, *p, tok[3]; const char *name; size_t len, lp, nl, vl, rl; - int defs[__arraycount(def_infos)]; + int defs[__arraycount(def_infos)], fv; _DIAGASSERT(cap != NULL); @@ -367,10 +367,12 @@ if (token[0] == '\0') continue; name = token; - val = NULL; + val = p = NULL; + fv = nl = 0; if (token[1] != '\0') { tok[0] = token[0]; tok[1] = token[1]; + nl = 1; if (token[2] == '\0') { name = flagname(tok); val = NULL; @@ -380,13 +382,23 @@ } else if (token[2] == '=') { name = strname(tok); val = strval(token + 2); +fv = 1; + } else +nl = 0; + } + /* If not matched we may need to convert padding still. */ + if (nl == 0) { + p = strchr(name, '='); + if (p != NULL) { +val = strval(p); +*p = '\0'; +fv = 1; } } /* See if this sets a default. */ for (nl = 0; nl __arraycount(def_infos); nl++) { if (strcmp(name, def_infos[nl].name) == 0) { -printf (matched %s\n, name); defs[nl] = 1; break; } @@ -420,7 +432,7 @@ if (val != NULL) { strcpy(ip, val); ip += vl; - if (token[2] == '=') + if (fv == 1) free(val); } }
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Mar 4 15:35:26 UTC 2010 Modified Files: src/lib/libterminfo: termcap.c Log Message: Convert padding for unknown capabilities as well. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Wed Mar 3 12:09:49 UTC 2010 Modified Files: src/lib/libterminfo: genhash genman genterms genthash Log Message: Abort an error. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/genhash cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/genman cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/genterms cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/genthash Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/genhash diff -u src/lib/libterminfo/genhash:1.5 src/lib/libterminfo/genhash:1.6 --- src/lib/libterminfo/genhash:1.5 Thu Feb 4 12:25:08 2010 +++ src/lib/libterminfo/genhash Wed Mar 3 12:09:49 2010 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: genhash,v 1.5 2010/02/04 12:25:08 roy Exp $ +# $NetBSD: genhash,v 1.6 2010/03/03 12:09:49 roy Exp $ # Copyright (c) 2009 The NetBSD Foundation, Inc. # @@ -32,6 +32,7 @@ # This allows us to freely change how we hash or store our string tables # in the future. +set -e : ${TOOL_AWK:=awk} : ${TOOL_NBPERF:=nbperf} : ${TOOL_SED:=sed} @@ -92,7 +93,7 @@ #endif #include sys/cdefs.h -__RCSID(\$NetBSD: genhash,v 1.5 2010/02/04 12:25:08 roy Exp $); +__RCSID(\$NetBSD: genhash,v 1.6 2010/03/03 12:09:49 roy Exp $); #include stdint.h #include stdlib.h Index: src/lib/libterminfo/genman diff -u src/lib/libterminfo/genman:1.2 src/lib/libterminfo/genman:1.3 --- src/lib/libterminfo/genman:1.2 Wed Feb 3 20:56:54 2010 +++ src/lib/libterminfo/genman Wed Mar 3 12:09:49 2010 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: genman,v 1.2 2010/02/03 20:56:54 roy Exp $ +# $NetBSD: genman,v 1.3 2010/03/03 12:09:49 roy Exp $ # Copyright (c) 2009 The NetBSD Foundation, Inc. # @@ -29,6 +29,7 @@ # Generate variable tables for terminfo.5 from our source files. +set -e : ${TOOL_SED:=sed} : ${TOOL_SORT:=sort} Index: src/lib/libterminfo/genterms diff -u src/lib/libterminfo/genterms:1.1 src/lib/libterminfo/genterms:1.2 --- src/lib/libterminfo/genterms:1.1 Fri Feb 12 12:18:33 2010 +++ src/lib/libterminfo/genterms Wed Mar 3 12:09:49 2010 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: genterms,v 1.1 2010/02/12 12:18:33 roy Exp $ +# $NetBSD: genterms,v 1.2 2010/03/03 12:09:49 roy Exp $ # Copyright (c) 2010 The NetBSD Foundation, Inc. # @@ -29,6 +29,7 @@ # Generate compiled terminfo descriptions to embed into libterminfo +set -e : ${TOOL_TIC:=tic} : ${NETBSDSRCDIR:=/usr/src} : ${TERMINFO:=${NETBSDSRCDIR}/share/terminfo/terminfo} Index: src/lib/libterminfo/genthash diff -u src/lib/libterminfo/genthash:1.3 src/lib/libterminfo/genthash:1.4 --- src/lib/libterminfo/genthash:1.3 Thu Feb 4 09:46:26 2010 +++ src/lib/libterminfo/genthash Wed Mar 3 12:09:49 2010 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: genthash,v 1.3 2010/02/04 09:46:26 roy Exp $ +# $NetBSD: genthash,v 1.4 2010/03/03 12:09:49 roy Exp $ # Copyright (c) 2009 The NetBSD Foundation, Inc. # @@ -29,6 +29,7 @@ # Generate string and hash tables for our termcap strings in termcap.c +set -e : ${TOOL_NBPERF:=nbperf} : ${TOOL_SED:=sed} @@ -40,7 +41,7 @@ * Automatically generated from termcap.c */ #include sys/cdefs.h -__RCSID(\$NetBSD: genthash,v 1.3 2010/02/04 09:46:26 roy Exp $); +__RCSID(\$NetBSD: genthash,v 1.4 2010/03/03 12:09:49 roy Exp $); #include stdint.h #include stdlib.h
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Tue Mar 2 14:11:11 UTC 2010 Modified Files: src/lib/libterminfo: compile.c term_private.h termcap.c Log Message: Use _ti_get_token instead of strsep when parsing termcap entries. This allows us to handle \E\ as a valid sequence. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/compile.c cvs rdiff -u -r1.6 -r1.7 src/lib/libterminfo/term_private.h cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/compile.c diff -u src/lib/libterminfo/compile.c:1.3 src/lib/libterminfo/compile.c:1.4 --- src/lib/libterminfo/compile.c:1.3 Mon Mar 1 01:59:48 2010 +++ src/lib/libterminfo/compile.c Tue Mar 2 14:11:11 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: compile.c,v 1.3 2010/03/01 01:59:48 dholland Exp $ */ +/* $NetBSD: compile.c,v 1.4 2010/03/02 14:11:11 roy Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #endif #include sys/cdefs.h -__RCSID($NetBSD: compile.c,v 1.3 2010/03/01 01:59:48 dholland Exp $); +__RCSID($NetBSD: compile.c,v 1.4 2010/03/02 14:11:11 roy Exp $); #if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H #include sys/endian.h @@ -413,11 +413,10 @@ return 0; } -static char * -get_token(char **cap) +char * +_ti_get_token(char **cap, char sep) { - char *token; - int esc; + char esc, *token; while (isspace((unsigned char)**cap)) (*cap)++; @@ -425,16 +424,21 @@ return NULL; /* We can't use stresep(3) as ^ we need two escape chars */ - esc = 0; + esc = '\0'; for (token = *cap; - **cap != '\0' (esc == 1 || **cap != ','); + **cap != '\0' (esc != '\0' || **cap != sep); (*cap)++) { - if (esc == 0) { + if (esc == '\0') { if (**cap == '\\' || **cap == '^') -esc = 1; - } else - esc = 0; +esc = **cap; + } else { + /* termcap /E/ is valid */ + if (sep == ':' esc == '\\' **cap == 'E') +esc = 'x'; + else +esc = '\0'; + } } if (**cap != '\0') @@ -456,7 +460,7 @@ _DIAGASSERT(cap != NULL); - name = get_token(cap); + name = _ti_get_token(cap, ','); if (name == NULL) { dowarn(flags, no seperator found: %s, cap); return NULL; @@ -489,9 +493,9 @@ goto error; } - for (token = get_token(cap); + for (token = _ti_get_token(cap, ','); token != NULL *token != '\0'; - token = get_token(cap)) + token = _ti_get_token(cap, ',')) { /* Skip commented caps */ if (!(flags TIC_COMMENT) token[0] == '.') Index: src/lib/libterminfo/term_private.h diff -u src/lib/libterminfo/term_private.h:1.6 src/lib/libterminfo/term_private.h:1.7 --- src/lib/libterminfo/term_private.h:1.6 Mon Feb 22 23:05:39 2010 +++ src/lib/libterminfo/term_private.h Tue Mar 2 14:11:11 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: term_private.h,v 1.6 2010/02/22 23:05:39 roy Exp $ */ +/* $NetBSD: term_private.h,v 1.7 2010/03/02 14:11:11 roy Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -143,6 +143,7 @@ } TIC; char *_ti_grow_tbuf(TBUF *, size_t); +char *_ti_get_token(char **, char); char *_ti_find_cap(TBUF *, char, short); char *_ti_find_extra(TBUF *, const char *); size_t _ti_store_extra(TIC *, int, char *, char, char, short, Index: src/lib/libterminfo/termcap.c diff -u src/lib/libterminfo/termcap.c:1.4 src/lib/libterminfo/termcap.c:1.5 --- src/lib/libterminfo/termcap.c:1.4 Mon Mar 1 11:02:31 2010 +++ src/lib/libterminfo/termcap.c Tue Mar 2 14:11:11 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: termcap.c,v 1.4 2010/03/01 11:02:31 roy Exp $ */ +/* $NetBSD: termcap.c,v 1.5 2010/03/02 14:11:11 roy Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: termcap.c,v 1.4 2010/03/01 11:02:31 roy Exp $); +__RCSID($NetBSD: termcap.c,v 1.5 2010/03/02 14:11:11 roy Exp $); #include assert.h #include ctype.h @@ -277,6 +277,16 @@ } } + /* \E\ is valid termcap. + * We need to escape the final \ for terminfo. */ + if (l 2 info[l - 1] == '\\' + (info[l - 2] != '\\' info[l - 2] != '^')) + { + if (l + 1 len) + goto elen; + *ip++ = '\\'; + } + *ip = '\0'; return info; @@ -302,10 +312,10 @@ lp = 0; tok[2] = '\0'; - while ((token = strsep(cap, :)) != NULL) { - /* Trim whitespace */ - while (isspace((unsigned char)*token)) - token++; + for (token = _ti_get_token(cap, ':'); + token != NULL; + token = _ti_get_token(cap, ':')) + { if (token[0] == '\0') continue; name = token;
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Tue Mar 2 14:11:11 UTC 2010 Modified Files: src/lib/libterminfo: compile.c term_private.h termcap.c Log Message: Use _ti_get_token instead of strsep when parsing termcap entries. This allows us to handle \E\ as a valid sequence. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/compile.c cvs rdiff -u -r1.6 -r1.7 src/lib/libterminfo/term_private.h cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Mon Mar 1 11:02:32 UTC 2010 Modified Files: src/lib/libterminfo: termcap.c Log Message: Escape , when converting to terminfo. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/termcap.c diff -u src/lib/libterminfo/termcap.c:1.3 src/lib/libterminfo/termcap.c:1.4 --- src/lib/libterminfo/termcap.c:1.3 Fri Feb 26 00:09:00 2010 +++ src/lib/libterminfo/termcap.c Mon Mar 1 11:02:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: termcap.c,v 1.3 2010/02/26 00:09:00 roy Exp $ */ +/* $NetBSD: termcap.c,v 1.4 2010/03/01 11:02:31 roy Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: termcap.c,v 1.3 2010/02/26 00:09:00 roy Exp $); +__RCSID($NetBSD: termcap.c,v 1.4 2010/03/01 11:02:31 roy Exp $); #include assert.h #include ctype.h @@ -243,6 +243,12 @@ if (l + 2 len) goto elen; if (*val != '%') { + if (*val == ',') { +if (l + 3 len) + goto elen; +*ip++ = '\\'; +l++; + } *ip++ = *val; l++; continue;
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Mon Mar 1 11:02:32 UTC 2010 Modified Files: src/lib/libterminfo: termcap.c Log Message: Escape , when converting to terminfo. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/termcap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: dholland Date: Mon Mar 1 01:59:48 UTC 2010 Modified Files: src/lib/libterminfo: compile.c Log Message: compile.c needs sys/endian.h; PR 42875 from Henning Petersen. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/compile.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/compile.c diff -u src/lib/libterminfo/compile.c:1.2 src/lib/libterminfo/compile.c:1.3 --- src/lib/libterminfo/compile.c:1.2 Thu Feb 25 23:44:02 2010 +++ src/lib/libterminfo/compile.c Mon Mar 1 01:59:48 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: compile.c,v 1.2 2010/02/25 23:44:02 roy Exp $ */ +/* $NetBSD: compile.c,v 1.3 2010/03/01 01:59:48 dholland Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -32,7 +32,11 @@ #endif #include sys/cdefs.h -__RCSID($NetBSD: compile.c,v 1.2 2010/02/25 23:44:02 roy Exp $); +__RCSID($NetBSD: compile.c,v 1.3 2010/03/01 01:59:48 dholland Exp $); + +#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H +#include sys/endian.h +#endif #include assert.h #include ctype.h
CVS commit: src/lib/libterminfo
Module Name:src Committed By: dholland Date: Mon Mar 1 01:59:48 UTC 2010 Modified Files: src/lib/libterminfo: compile.c Log Message: compile.c needs sys/endian.h; PR 42875 from Henning Petersen. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/compile.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 25 23:44:02 UTC 2010 Modified Files: src/lib/libterminfo: compile.c Log Message: If we only have a name then we flatten to an alias. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/compile.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 25 23:44:02 UTC 2010 Modified Files: src/lib/libterminfo: compile.c Log Message: If we only have a name then we flatten to an alias. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/compile.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/compile.c diff -u src/lib/libterminfo/compile.c:1.1 src/lib/libterminfo/compile.c:1.2 --- src/lib/libterminfo/compile.c:1.1 Mon Feb 22 23:05:39 2010 +++ src/lib/libterminfo/compile.c Thu Feb 25 23:44:02 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: compile.c,v 1.1 2010/02/22 23:05:39 roy Exp $ */ +/* $NetBSD: compile.c,v 1.2 2010/02/25 23:44:02 roy Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #endif #include sys/cdefs.h -__RCSID($NetBSD: compile.c,v 1.1 2010/02/22 23:05:39 roy Exp $); +__RCSID($NetBSD: compile.c,v 1.2 2010/02/25 23:44:02 roy Exp $); #include assert.h #include ctype.h @@ -235,7 +235,12 @@ return -1; cap = *buf; - *cap++ = 2; /* version */ + if (alen == 0 dlen == 0 tic-flags.bufpos == 0 + tic-nums.bufpos == 0 tic-strs.bufpos == 0 + tic-extras.bufpos == 0) + *cap++ = 0; /* alias */ + else + *cap++ = 2; /* version */ le16enc(cap, len); cap += sizeof(uint16_t); memcpy(cap, tic-name, len);
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Fri Feb 26 00:09:00 UTC 2010 Modified Files: src/lib/libterminfo: term.c term.h termcap.c terminfo.5.in Log Message: Implement captoinfo so that we can convert $TERMCAP into $TERMINFO. We don't currently map % %B %D. That means no conversion for regent100, hz1500, act4, act5, mime terms. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libterminfo/term.c cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/term.h cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/termcap.c cvs rdiff -u -r1.12 -r1.13 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/term.c diff -u src/lib/libterminfo/term.c:1.10 src/lib/libterminfo/term.c:1.11 --- src/lib/libterminfo/term.c:1.10 Mon Feb 22 23:05:39 2010 +++ src/lib/libterminfo/term.c Fri Feb 26 00:09:00 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: term.c,v 1.10 2010/02/22 23:05:39 roy Exp $ */ +/* $NetBSD: term.c,v 1.11 2010/02/26 00:09:00 roy Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: term.c,v 1.10 2010/02/22 23:05:39 roy Exp $); +__RCSID($NetBSD: term.c,v 1.11 2010/02/26 00:09:00 roy Exp $); #include sys/stat.h @@ -283,6 +283,34 @@ } static int +ticcmp(const TIC *tic, const char *name) +{ + char *alias, *s; + size_t len, l; + + if (strcmp(tic-name, name) == 0) + return 0; + if (tic-alias == NULL) + return -1; + + len = strlen(name); + alias = tic-alias; + while (*alias != '\0') { + s = strchr(alias, '|'); + if (s == NULL) + l = strlen(alias); + else + l = s - alias; + if (len == l strncmp(alias, name, l) == 0) + return 0; + if (s == NULL) + break; + alias = s + 1; + } + return 1; +} + +static int _ti_findterm(TERMINAL *term, const char *name, int flags) { int r; @@ -298,13 +326,32 @@ _ti_database = NULL; r = 0; - if ((e = getenv(TERMINFO)) != NULL *e != '\0') { + if ((e = getenv(TERMINFO)) != NULL *e != '\0') if (e[0] == '/') return _ti_dbgetterm(term, e, name, flags); - c = strdup(e); /* So we don't destroy env */ - tic = _ti_compile(c, TIC_WARNING | TIC_EXTRA); - free(c); - if (tic != NULL strcmp(tic-name, name) == 0) { + + c = NULL; + if (e == NULL (c = getenv(TERMCAP)) != NULL) { + if (*c != '\0' *c != '/') { + c = strdup(c); + if (c != NULL) { +e = captoinfo(c); +free(c); + } + } + } + + if (e != NULL) { + if (c == NULL) + e = strdup(e); /* So we don't destroy env */ + if (e == NULL) + tic = NULL; + else + tic = _ti_compile(e, TIC_WARNING | + TIC_ALIAS | TIC_DESCRIPTION | TIC_EXTRA); + if (c == NULL e != NULL) + free(e); + if (tic != NULL ticcmp(tic, name) == 0) { len = _ti_flatten(f, tic); if (len != -1) { r = _ti_readterm(term, (char *)f, len, flags); @@ -313,7 +360,10 @@ } _ti_freetic(tic); if (r == 1) { - _ti_database = $TERMINFO; + if (c == NULL) +_ti_database = $TERMINFO; + else +_ti_database = $TERMCAP; return r; } } Index: src/lib/libterminfo/term.h diff -u src/lib/libterminfo/term.h:1.4 src/lib/libterminfo/term.h:1.5 --- src/lib/libterminfo/term.h:1.4 Thu Feb 11 00:27:09 2010 +++ src/lib/libterminfo/term.h Fri Feb 26 00:09:00 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: term.h,v 1.4 2010/02/11 00:27:09 roy Exp $ */ +/* $NetBSD: term.h,v 1.5 2010/02/26 00:09:00 roy Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -1512,5 +1512,9 @@ # define t_parm t_vtparm #endif +/* Convert a termcap string into a terminfo string. + * The passed string is destroyed and the return string needs to be freed. */ +char * captoinfo(char *); + __END_DECLS #endif Index: src/lib/libterminfo/termcap.c diff -u src/lib/libterminfo/termcap.c:1.2 src/lib/libterminfo/termcap.c:1.3 --- src/lib/libterminfo/termcap.c:1.2 Thu Feb 4 09:46:26 2010 +++ src/lib/libterminfo/termcap.c Fri Feb 26 00:09:00 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: termcap.c,v 1.2 2010/02/04 09:46:26 roy Exp $ */ +/* $NetBSD: termcap.c,v 1.3 2010/02/26 00:09:00 roy Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -28,9 +28,11 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: termcap.c,v 1.2 2010/02/04 09:46:26 roy Exp $); +__RCSID($NetBSD: termcap.c,v 1.3 2010/02/26 00:09:00 roy Exp $); #include assert.h +#include ctype.h +#include errno.h #include stdint.h #include string.h #include term_private.h @@ -180,3 +182,176 @@ _DIAGASSERT(cm != NULL); return vtparm(cm, destline, destcol); } + +static const char * +flagname(const char *key) +{ + uint32_t idx; + + idx = _t_flaghash((const unsigned char *)key, strlen(key)); + if (idx = __arraycount(_ti_cap_flagids) + strcmp(key, _ti_cap_flagids[idx].id) == 0) + return _ti_flagid(_ti_cap_flagids[idx].ti); + return key; +} + +static const char * +numname(const char *key) +{ + uint32_t idx; + + idx =
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Fri Feb 26 00:09:00 UTC 2010 Modified Files: src/lib/libterminfo: term.c term.h termcap.c terminfo.5.in Log Message: Implement captoinfo so that we can convert $TERMCAP into $TERMINFO. We don't currently map % %B %D. That means no conversion for regent100, hz1500, act4, act5, mime terms. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libterminfo/term.c cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/term.h cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/termcap.c cvs rdiff -u -r1.12 -r1.13 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: wiz Date: Fri Feb 26 07:03:49 UTC 2010 Modified Files: src/lib/libterminfo: terminfo.5.in Log Message: '' replacement for HTML output, be explicit about slash. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libterminfo/terminfo.5.in diff -u src/lib/libterminfo/terminfo.5.in:1.13 src/lib/libterminfo/terminfo.5.in:1.14 --- src/lib/libterminfo/terminfo.5.in:1.13 Fri Feb 26 00:09:00 2010 +++ src/lib/libterminfo/terminfo.5.in Fri Feb 26 07:03:49 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: terminfo.5.in,v 1.13 2010/02/26 00:09:00 roy Exp $ +.\ $NetBSD: terminfo.5.in,v 1.14 2010/02/26 07:03:49 wiz Exp $ .\ .\ Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -203,14 +203,17 @@ .Pp If the environment variable .Ev TERMINFO -is available, does not begin with /, can be compiled with the above rules and -whose name matches +is available, does not begin with +.Pq Sq / , +can be compiled with the above rules and whose name matches .Ev TERM then it is used. .Pp If the environment variable .Ev TERMCAP -is available and does not begin with / then it will be translated into +is available and does not begin with a slash +.Pq Sq / +then it will be translated into terminfo and compiled as above. If its name matches .Ev TERM @@ -218,7 +221,9 @@ .Pp If the environment variable .Ev TERMINFO -is available and begins with / then only this file is searched. +is available and begins with a slash +.Pq Sq / +then only this file is searched. Otherwise .Nm will first look for @@ -259,4 +264,4 @@ .Sh BUGS The .Ev TERMCAP -capabilities %, %B and %D are not converted into terminfo capabilities. +capabilities %\*[Gt], %B and %D are not converted into terminfo capabilities.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: wiz Date: Fri Feb 26 07:03:49 UTC 2010 Modified Files: src/lib/libterminfo: terminfo.5.in Log Message: '' replacement for HTML output, be explicit about slash. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 11 09:34:12 UTC 2010 Modified Files: src/lib/libterminfo: curterm.c Log Message: Remove silly debug. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/curterm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 11 09:42:03 UTC 2010 Modified Files: src/lib/libterminfo: term.c Log Message: Allow a NULL description. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/term.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 11 14:36:09 UTC 2010 Modified Files: src/lib/libterminfo: term.c terminfo.5.in Log Message: Respect TERMINFO_DIRS and document using an embedded database. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libterminfo/term.c cvs rdiff -u -r1.8 -r1.9 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 11 14:44:44 UTC 2010 Modified Files: src/lib/libterminfo: Makefile Log Message: Use $TOOL_TIC To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libterminfo/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 11 14:49:56 UTC 2010 Modified Files: src/lib/libterminfo: Makefile Log Message: Include xterm. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libterminfo/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 11 00:22:41 UTC 2010 Modified Files: src/lib/libterminfo: terminfo.5.in Log Message: Correct date To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 11 00:27:09 UTC 2010 Modified Files: src/lib/libterminfo: Makefile curterm.c setupterm.c term.c term.h term_private.h Log Message: Embed ansi, dumb, vt100, vt220 and wsvt25 compiled terminal descriptions into libterminfo. Constify some foo. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/Makefile \ src/lib/libterminfo/term.c src/lib/libterminfo/term_private.h cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/curterm.c \ src/lib/libterminfo/setupterm.c cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/term.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Tue Feb 9 22:16:12 UTC 2010 Modified Files: src/lib/libterminfo: Makefile Removed Files: src/lib/libterminfo: terminfo.5 Log Message: We should always generate terminfo.5 to save human error syncing. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/Makefile cvs rdiff -u -r1.5 -r0 src/lib/libterminfo/terminfo.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: he Date: Fri Feb 5 14:39:07 UTC 2010 Modified Files: src/lib/libterminfo: term.h term_private.h Log Message: More adaptation for ports with unsigned char as char. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/term.h cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/term_private.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Fri Feb 5 19:21:02 UTC 2010 Modified Files: src/lib/libterminfo: term.c terminfo.5 Log Message: Don't look in /etc for a terminfo database. Don't report the rescue database if we did not find the terminal in there AND we were able to access prior databases. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/term.c cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/terminfo.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/lib/libterminfo
In article 20100205143907.e255d17...@cvs.netbsd.org, Havard Eidnes source-changes-d@NetBSD.org wrote: -=-=-=-=-=- Module Name: src Committed By: he Date: Fri Feb 5 14:39:07 UTC 2010 Modified Files: src/lib/libterminfo: term.h term_private.h Log Message: More adaptation for ports with unsigned char as char. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/term.h cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/term_private.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. -=-=-=-=-=- Modified files: Index: src/lib/libterminfo/term.h diff -u src/lib/libterminfo/term.h:1.2 src/lib/libterminfo/term.h:1.3 --- src/lib/libterminfo/term.h:1.2 Thu Feb 4 09:46:26 2010 +++ src/lib/libterminfo/term.h Fri Feb 5 14:39:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: term.h,v 1.2 2010/02/04 09:46:26 roy Exp $ */ +/* $NetBSD: term.h,v 1.3 2010/02/05 14:39:07 he Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -1454,7 +1454,7 @@ /* We need to expose these so that the macros work */ char *name; char *desc; - char *flags; + signed char *flags; short *nums; const char **strs; } TERMINAL; Index: src/lib/libterminfo/term_private.h diff -u src/lib/libterminfo/term_private.h:1.3 src/lib/libterminfo/term_private.h:1.4 --- src/lib/libterminfo/term_private.h:1.3 Fri Feb 5 12:31:56 2010 +++ src/lib/libterminfo/term_private.h Fri Feb 5 14:39:07 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: term_private.h,v 1.3 2010/02/05 12:31:56 roy Exp $ */ +/* $NetBSD: term_private.h,v 1.4 2010/02/05 14:39:07 he Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -84,7 +84,7 @@ /* We need to expose these so that the macros work */ char *name; char *desc; - char *flags; + signed char *flags; short *nums; const char **strs; /* Storage area for terminfo data */ Isn't int8_t more appropriate? christos
CVS commit: src/lib/libterminfo
Module Name:src Committed By: wiz Date: Sat Feb 6 07:12:25 UTC 2010 Modified Files: src/lib/libterminfo: terminfo.5.in Log Message: Sync with terminfo(5): Remove /etc/terminfo.db. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: wiz Date: Thu Feb 4 09:12:56 UTC 2010 Modified Files: src/lib/libterminfo: termcap.3 terminfo.3 terminfo.5.in Log Message: More markup. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/termcap.3 \ src/lib/libterminfo/terminfo.3 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 4 09:45:30 UTC 2010 Modified Files: src/lib/libterminfo: terminfo.5 terminfo.5.in Log Message: Sync terminfo.5 changes into terminfo.5.in To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/terminfo.5 cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 4 09:46:26 UTC 2010 Modified Files: src/lib/libterminfo: genhash genthash hash.c term.h termcap.c termcap_hash.c ti.c Log Message: Fix build issues on other hosts. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/genhash cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/genthash cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/hash.c \ src/lib/libterminfo/term.h src/lib/libterminfo/termcap.c \ src/lib/libterminfo/termcap_hash.c src/lib/libterminfo/ti.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Thu Feb 4 12:25:08 UTC 2010 Modified Files: src/lib/libterminfo: genhash hash.c Log Message: Allow hash to be build on other hosts. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/genhash cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/hash.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: wiz Date: Wed Feb 3 15:47:13 UTC 2010 Modified Files: src/lib/libterminfo: terminfo.3 Log Message: Punctuation and whitespace fixes. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/terminfo.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: wiz Date: Wed Feb 3 15:47:17 UTC 2010 Modified Files: src/lib/libterminfo: terminfo.5.in Log Message: Sort SEE ALSO. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: wiz Date: Wed Feb 3 15:49:42 UTC 2010 Modified Files: src/lib/libterminfo: termcap.3 Log Message: Use Nx. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/termcap.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: roy Date: Wed Feb 3 16:13:14 UTC 2010 Modified Files: src/lib/libterminfo: Makefile Log Message: Use $HOST_SH instead of calling directly. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: snj Date: Wed Feb 3 18:49:23 UTC 2010 Modified Files: src/lib/libterminfo: genhash term_private.h termcap.3 terminfo.3 terminfo.5.in Log Message: Fix some typos and spelling errors. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/genhash \ src/lib/libterminfo/term_private.h cvs rdiff -u -r1.2 -r1.3 src/lib/libterminfo/termcap.3 \ src/lib/libterminfo/terminfo.3 src/lib/libterminfo/terminfo.5.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libterminfo
Module Name:src Committed By: snj Date: Wed Feb 3 21:02:39 UTC 2010 Modified Files: src/lib/libterminfo: terminfo.5 Log Message: Regenerate to pick up the changes from terminfo.5.in revision 1.3. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libterminfo/terminfo.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.