]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/tic.c
ncurses 6.2 - patch 20210220
[ncurses.git] / progs / tic.c
index 9560788e8a17750e00986f9d7b5361490ae9e14f..9b02a23216fa843faca37c29f76738dbd64d36d5 100644 (file)
@@ -49,7 +49,7 @@
 #include <parametrized.h>
 #include <transform.h>
 
-MODULE_ID("$Id: tic.c,v 1.288 2020/10/24 17:04:11 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.291 2021/02/20 23:57:24 tom Exp $")
 
 #define STDIN_NAME "<stdin>"
 
@@ -1711,6 +1711,7 @@ check_screen(TERMTYPE2 *tp)
        int have_bce = back_color_erase;
        bool have_kmouse = FALSE;
        bool use_sgr_39_49 = FALSE;
+       const char *name_39_49 = "orig_pair or orig_colors";
        char *name = _nc_first_name(tp->term_names);
        bool is_screen = !strncmp(name, "screen", 6);
        bool screen_base = (is_screen
@@ -1728,10 +1729,15 @@ check_screen(TERMTYPE2 *tp)
        if (VALID_STRING(key_mouse)) {
            have_kmouse = !strcmp("\033[M", key_mouse);
        }
-       if (VALID_STRING(orig_colors)) {
-           use_sgr_39_49 = uses_SGR_39_49(orig_colors);
-       } else if (VALID_STRING(orig_pair)) {
-           use_sgr_39_49 = uses_SGR_39_49(orig_pair);
+       if (have_bce) {
+           if (VALID_STRING(orig_pair)) {
+               name_39_49 = "orig_pair";
+               use_sgr_39_49 = uses_SGR_39_49(orig_pair);
+           }
+           if (!use_sgr_39_49 && VALID_STRING(orig_colors)) {
+               name_39_49 = "orig_colors";
+               use_sgr_39_49 = uses_SGR_39_49(orig_colors);
+           }
        }
 
        if (have_XM && have_XT) {
@@ -1746,10 +1752,14 @@ check_screen(TERMTYPE2 *tp)
                    _nc_warning("expected kmous capability with XT");
                }
            }
-           if (!have_bce && max_colors > 0)
-               _nc_warning("expected bce capability with XT");
-           if (!use_sgr_39_49 && have_bce && max_colors > 0)
-               _nc_warning("expected orig_colors capability with XT to have 39/49 parameters");
+           if (max_colors > 0) {
+               if (!have_bce) {
+                   _nc_warning("expected bce capability with XT");
+               } else if (!use_sgr_39_49) {
+                   _nc_warning("expected %s capability with XT "
+                               "to have 39/49 parameters", name_39_49);
+               }
+           }
            if (VALID_STRING(to_status_line))
                _nc_warning("\"tsl\" capability is redundant, given XT");
        } else {
@@ -2372,14 +2382,13 @@ check_infotocap(TERMTYPE2 *tp, int i, const char *value)
                  ? parametrized[i]
                  : ((*value == 'k')
                     ? 0
-                    : has_params(value)));
-    int to_char = 0;
+                    : has_params(value, FALSE)));
     char *ti_value;
     char *tc_value;
     bool embedded;
 
     assert(SIZEOF(parametrized) == STRCOUNT);
-    if ((ti_value = _nc_tic_expand(value, TRUE, to_char)) == ABSENT_STRING) {
+    if (!VALID_STRING(value) || (ti_value = strdup(value)) == NULL) {
        _nc_warning("tic-expansion of %s failed", name);
     } else if ((tc_value = _nc_infotocap(name, ti_value, params)) == ABSENT_STRING) {
        _nc_warning("tic-conversion of %s failed", name);
@@ -2402,12 +2411,14 @@ check_infotocap(TERMTYPE2 *tp, int i, const char *value)
            if (strcmp(ti_check, tc_check)) {
                if (first) {
                    fprintf(stderr, "check_infotocap(%s)\n", name);
-                   fprintf(stderr, "...ti '%s'\n", ti_value);
-                   fprintf(stderr, "...tc '%s'\n", tc_value);
+                   fprintf(stderr, "...ti '%s'\n", _nc_visbuf2(0, ti_value));
+                   fprintf(stderr, "...tc '%s'\n", _nc_visbuf2(0, tc_value));
                    first = FALSE;
                }
                _nc_warning("tparm-conversion of %s(%d) differs between\n\tterminfo %s\n\ttermcap  %s",
-                           name, count, ti_check, tc_check);
+                           name, count,
+                           _nc_visbuf2(0, ti_check),
+                           _nc_visbuf2(1, tc_check));
            }
            free(ti_check);
            free(tc_check);