term.c (multitail-6.4.2.tgz) | : | term.c (multitail-6.5.0.tgz) | ||
---|---|---|---|---|
skipping to change at line 704 | skipping to change at line 704 | |||
cp.n_def++; | cp.n_def++; | |||
return cp.n_def - 1; | return cp.n_def - 1; | |||
} | } | |||
return 0; | return 0; | |||
} | } | |||
int colorstr_to_nr(char *str) | int colorstr_to_nr(char *str) | |||
{ | { | |||
int loop; | int loop; | |||
int err; | ||||
regex_t regex_is_color; | ||||
if (str[0] == 0x00) return -1; | if (str[0] == 0x00) return -1; | |||
for(loop=0; loop<n_colors_defined; loop++) | for(loop=0; loop<n_colors_defined; loop++) | |||
{ | { | |||
if (color_names[loop] && strcmp(color_names[loop], str) == 0) | if (color_names[loop] && strcmp(color_names[loop], str) == 0) | |||
return loop; | return loop; | |||
} | } | |||
err = regcomp(®ex_is_color, "^[[:digit:]]{1,3}$", REG_EXTENDED); | ||||
if (err == 0) { | ||||
int match_color; | ||||
match_color = regexec(®ex_is_color, str, 0, NULL, 0); | ||||
regfree(®ex_is_color); | ||||
if (match_color == 0) { | ||||
int color; | ||||
char *end; | ||||
color = strtol(str,&end,10); | ||||
/* prevent the use of more thant 255 colors */ | ||||
if (color < 255) { | ||||
return color; | ||||
} | ||||
} | ||||
} | ||||
if (use_colors) | if (use_colors) | |||
error_exit(FALSE, FALSE, "'%s' is not recognized as a color\n", s tr); | error_exit(FALSE, FALSE, "'%s' is not recognized as a color\n", s tr); | |||
return -1; | return -1; | |||
} | } | |||
int attrstr_to_nr(char *str) | int attrstr_to_nr(char *str) | |||
{ | { | |||
int attr = 0; | int attr = 0; | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 19 lines changed or added |