]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/tic.c
ncurses 6.1 - patch 20190525
[ncurses.git] / progs / tic.c
index 33d1311eb9caf578ce07711e41c6fbf71d01bf01..1d4034622c335b51b59b41e79313558636bf27f2 100644 (file)
@@ -48,7 +48,7 @@
 #include <parametrized.h>
 #include <transform.h>
 
-MODULE_ID("$Id: tic.c,v 1.274 2019/04/20 20:28:19 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.276 2019/05/10 21:00:25 tom Exp $")
 
 #define STDIN_NAME "<stdin>"
 
@@ -1200,6 +1200,8 @@ same_color(NCURSES_CONST char *oldcap, NCURSES_CONST char *newcap, int limit)
 static void
 check_colors(TERMTYPE2 *tp)
 {
+    char *value;
+
     if ((max_colors > 0) != (max_pairs > 0)
        || ((max_colors > max_pairs) && (initialize_pair == 0)))
        _nc_warning("inconsistent values for max_colors (%d) and max_pairs (%d)",
@@ -1248,6 +1250,15 @@ check_colors(TERMTYPE2 *tp)
            _nc_warning("expected ccc because initc is given");
        }
     }
+    value = tigetstr("RGB");
+    if (VALID_STRING(value)) {
+       int r, g, b;
+       char bad;
+       int code = sscanf(value, "%d/%d/%d%c", &r, &g, &b, &bad);
+       if (code != 3 || r <= 0 || g <= 0 || b <= 0) {
+           _nc_warning("unexpected value for RGB capability: %s", value);
+       }
+    }
 }
 
 static int
@@ -1928,7 +1939,7 @@ check_params(TERMTYPE2 *tp, const char *name, char *value, int extended)
 #if NCURSES_XNAMES
     if (extended) {
        int check = is_user_capability(name);
-       if (check != actual) {
+       if (check != actual && (check >= 0 && actual >= 0)) {
            _nc_warning("extended %s capability has %d parameters, expected %d",
                        name, actual, check);
        } else if (debug_level > 1) {