Ticket #152: fix-terminfo.patch
| File fix-terminfo.patch, 1.1 KB (added by josephpiche, 4 years ago) |
|---|
-
utils/gg_utils.c
old new 75 75 76 76 /* terminfo attributes */ 77 77 static char *setaf; /* terminfo string to set color */ 78 static int max_color; /* terminfo max colour*/78 static char *op; /* terminfo string to reset colors */ 79 79 80 80 static int init = 0; 81 81 … … 103 103 */ 104 104 105 105 static char setaf_literal[] = "setaf"; 106 static char colors_literal[] = "colors";106 static char op_literal[] = "op"; 107 107 static char empty_literal[] = ""; 108 108 109 109 if (init) … … 115 115 setaf = tigetstr(setaf_literal); 116 116 if (!setaf) 117 117 setaf = empty_literal; 118 max_color = tigetnum(colors_literal) - 1; 119 if (max_color < 1) 120 max_color = 1; 121 else if (max_color > 30) 122 max_color = 30; 123 118 op = tigetstr(op_literal); 119 if (!op) 120 op = empty_literal; 121 124 122 #endif /* TERMINFO */ 125 123 } 126 124 … … 157 155 #ifdef TERMINFO 158 156 159 157 fprintf(stderr, "%s%c", tparm(setaf, c, 0, 0, 0, 0, 0, 0, 0, 0), x); 160 fputs(tparm( setaf, max_color, 0, 0, 0, 0, 0, 0, 0, 0), stderr);158 fputs(tparm(op, 0, 0, 0, 0, 0, 0, 0, 0, 0), stderr); 161 159 162 160 #elif defined(ANSI_COLOR) 163 161
