diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-28 11:43:51 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-28 11:43:51 +0000 |
commit | da77d928ea902d2565198058a514e7c0b836bc54 (patch) | |
tree | d2052ab4be29a1844f7d540b1875b38254c34adc /lib/libcurses | |
parent | ec4dc37af730fadb05361383e63e3c2beaca1676 (diff) |
Change cap_mkdb and curses to be a better about reformatting terminfo entries
into the cap database format and back: rather than replacing all colons with
commas, only touch real separators (skip those with a leading \ or ^) and
replace an unadorned colon with a literal "\072".
Fixes problems with quite a few caps including acsc in "screen" (:s instead of
,s) and setab/initc in "xterm-256color" (wrongly concatenated together).
ok millert
Diffstat (limited to 'lib/libcurses')
-rw-r--r-- | lib/libcurses/tinfo/read_bsd_terminfo.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/libcurses/tinfo/read_bsd_terminfo.c b/lib/libcurses/tinfo/read_bsd_terminfo.c index d7ad8cff3c6..d916460217a 100644 --- a/lib/libcurses/tinfo/read_bsd_terminfo.c +++ b/lib/libcurses/tinfo/read_bsd_terminfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read_bsd_terminfo.c,v 1.14 2003/06/17 21:56:24 millert Exp $ */ +/* $OpenBSD: read_bsd_terminfo.c,v 1.15 2009/08/28 11:43:50 nicm Exp $ */ /* * Copyright (c) 1998, 1999, 2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -17,7 +17,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: read_bsd_terminfo.c,v 1.14 2003/06/17 21:56:24 millert Exp $"; +static const char rcsid[] = "$OpenBSD: read_bsd_terminfo.c,v 1.15 2009/08/28 11:43:50 nicm Exp $"; #endif #include <curses.priv.h> @@ -119,7 +119,7 @@ _nc_lookup_bsd_terminfo_entry(tn, filename, tp) TERMTYPE *const tp; { char *pathvec[2]; - char *capbuf, *cptr, *infobuf, *iptr, lastc; + char *capbuf, *cptr, *infobuf, *iptr, ch; int error; size_t len; @@ -163,13 +163,22 @@ _nc_lookup_bsd_terminfo_entry(tn, filename, tp) *iptr++ = '\n'; /* Copy the rest of capbuf, converting ':' -> ',' */ - for (++cptr, lastc = '\0'; *cptr; cptr++) { - /* XXX - somewhat simplistic */ - if (*cptr == ':' && lastc != '\\') + cptr++; + while (*cptr != '\0') { + switch (ch = *cptr++) { + case '^': + case '\\': + *iptr++ = ch; + if (*cptr != '\0') + *iptr++ = *cptr++; + break; + case ':': *iptr++ = ','; - else - *iptr++ = *cptr; - lastc = *cptr; + break; + default: + *iptr++ = ch; + break; + } } *iptr++ = '\n'; *iptr = '\0'; |