X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Ftic.c;h=9f446f5c76233c1cd3b4ab49781e8828eeec30dc;hp=4b3a4c843203ee69f395659a7d10c7de6f51ad65;hb=603f0cb25b7acc8f04f4b18d2a2fe6f90039829a;hpb=4b1d778499db088254fdf97fa7dc271c82c36622 diff --git a/progs/tic.c b/progs/tic.c index 4b3a4c84..9f446f5c 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. * + * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.220 2015/12/27 01:46:01 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.222 2016/06/11 23:20:55 tom Exp $") #define STDIN_NAME "" @@ -2274,7 +2274,7 @@ check_conflict(TERMTYPE *tp) static void check_exit_attribute(const char *name, char *test, char *trimmed, char *untrimmed) { - if (VALID_STRING(test)) { + if (VALID_STRING(test) && (trimmed != 0)) { if (similar_sgr(-1, trimmed, test) || similar_sgr(-1, untrimmed, test)) { _nc_warning("%s matches exit_attribute_mode", name); @@ -2327,13 +2327,23 @@ check_sgr_param(TERMTYPE *tp, int code, const char *name, char *value) if (is_sgr_string(test)) { int param = 0; int count = 0; + int skips = 0; + int color = (value == set_a_foreground || + value == set_a_background || + value == set_foreground || + value == set_background); while (*test != 0) { if (isdigit(UChar(*test))) { param = 10 * param + (*test - '0'); ++count; } else { if (count) { - if (param == code) + /* + * Avoid unnecessary warning for xterm 256color codes. + */ + if (color && (param == 38 || param == 48)) + skips = 3; + if ((skips-- <= 0) && (param == code)) break; } count = 0;