diff options
Diffstat (limited to 'ncurses/tinfo/captoinfo.c')
-rw-r--r-- | ncurses/tinfo/captoinfo.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c index 8b3b83d..7e14731 100644 --- a/ncurses/tinfo/captoinfo.c +++ b/ncurses/tinfo/captoinfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 2018-2020,2021 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -98,7 +98,7 @@ #include <ctype.h> #include <tic.h> -MODULE_ID("$Id: captoinfo.c,v 1.98 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.102 2021/09/04 10:29:15 tom Exp $") #if 0 #define DEBUG_THIS(p) DEBUG(9, p) @@ -216,12 +216,15 @@ cvtchar(register const char *sp) } break; case '^': + len = 2; c = UChar(*++sp); - if (c == '?') + if (c == '?') { c = 127; - else + } else if (c == '\0') { + len = 1; + } else { c &= 0x1f; - len = 2; + } break; default: c = UChar(*sp); @@ -631,12 +634,15 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz int offset; } fixups[MAX_TC_FIXUPS]; - DEBUG_THIS(("_nc_infotocap params %d, %s", parameterized, str)); + DEBUG_THIS(("_nc_infotocap %s params %d, %s", + _nc_strict_bsd ? "strict" : "loose", + parameterized, + _nc_visbuf(str))); /* we may have to move some trailing mandatory padding up front */ padding = str + strlen(str) - 1; if (padding > str && *padding == '>') { - if (*--padding == '/') + if (padding > (str + 1) && *--padding == '/') --padding; while (isdigit(UChar(*padding)) || *padding == '.' || *padding == '*') padding--; @@ -670,6 +676,11 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz bufptr = save_char(bufptr, *str++); bufptr = save_char(bufptr, *str); } + } else if (str[0] == ':') { + bufptr = save_char(bufptr, '\\'); + bufptr = save_char(bufptr, '0'); + bufptr = save_char(bufptr, '7'); + bufptr = save_char(bufptr, '2'); } else if (str[0] == '\\') { if (str[1] == '\0' || (str + 1) == trimmed) { bufptr = save_string(bufptr, "\\134"); @@ -929,7 +940,7 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz break; /* - * %s isn't in termcap, but it's convenient to pass it through + * %s isn't in termcap, but it is convenient to pass it through * so we can represent things like terminfo pfkey strings in * termcap notation. */ |