index e25ba686ea8b26ebc8f21b2e95cdfa2bc44c97ad..97794b0e6e0d85793b678537aff32e65902c5fe7 100644 (file)
--- a/tig.c
+++ b/tig.c
{
size_t size, pos;
- for (pos = 0; line[pos]; pos++) {
+ for (size = pos = 0; line[pos]; pos++) {
if (line[pos] == '\t' && tabsize > 0)
size += tabsize - (size % tabsize);
else
ATTR_MAP(UNDERLINE),
};
-#define set_color(color, name) map_enum(color, color_map, name)
#define set_attribute(attr, name) map_enum(attr, attr_map, name)
+static int
+parse_int(int *opt, const char *arg, int min, int max)
+{
+ int value = atoi(arg);
+
+ if (min <= value && value <= max)
+ *opt = value;
+ return OK;
+}
+
+static bool
+set_color(int *color, const char *name)
+{
+ if (map_enum(color, color_map, name))
+ return TRUE;
+ if (!prefixcmp(name, "color"))
+ return parse_int(color, name + 5, 0, 255) == OK;
+ return FALSE;
+}
+
static int config_lineno;
static bool config_errors;
static const char *config_msg;
return OK;
}
-static int
-parse_int(int *opt, const char *arg, int min, int max)
-{
- int value = atoi(arg);
-
- if (min <= value && value <= max)
- *opt = value;
- return OK;
-}
-
static int
parse_string(char *opt, const char *arg, size_t optsize)
{