Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 651546
Collapse All | Expand All

(-)libq/colors.c.orig (-2 / +19 lines)
Lines 21-30 Link Here
21
static const char *COLOR_MAP = CONFIG_EPREFIX "etc/portage/color.map";
21
static const char *COLOR_MAP = CONFIG_EPREFIX "etc/portage/color.map";
22
22
23
#define COLOR _MAKE_COLOR
23
#define COLOR _MAKE_COLOR
24
#define CPAIR_VALUE_LEN 16
24
25
25
typedef struct {
26
typedef struct {
26
	const char *name;
27
	const char *name;
27
	char value[16];
28
	char value[CPAIR_VALUE_LEN];
28
} cpairtype;
29
} cpairtype;
29
30
30
static cpairtype color_pairs[] = {
31
static cpairtype color_pairs[] = {
Lines 42-47 Link Here
42
	{"turquoise", COLOR("36", "01") },
43
	{"turquoise", COLOR("36", "01") },
43
	{"yellow",    COLOR("01", "33") },
44
	{"yellow",    COLOR("01", "33") },
44
	{"white",     COLOR("01", "38") },
45
	{"white",     COLOR("01", "38") },
46
	{"lightgray", COLOR("00", "37") },
45
	{"eol",       COLOR("00", "00") },
47
	{"eol",       COLOR("00", "00") },
46
};
48
};
47
49
Lines 77-83 Link Here
77
				if (strncmp(p, "0x", 2) == 0)
79
				if (strncmp(p, "0x", 2) == 0)
78
					warn("[%s=%s] RGB values in color map are not supported on line %d of %s", buf, p, lineno, COLOR_MAP);
80
					warn("[%s=%s] RGB values in color map are not supported on line %d of %s", buf, p, lineno, COLOR_MAP);
79
				else
81
				else
80
					snprintf(color_pairs[i].value, sizeof(color_pairs[i].value), "\e[%s", p);
82
				{
83
					/* color=color format support */
84
					int n, found = 0;
85
					for (n = 0; n < ARRAY_SIZE(color_pairs); n++)
86
					{
87
						if (strcmp(color_pairs[n].name, p) == 0)
88
						{
89
							strncpy(color_pairs[i].value, color_pairs[n].value, CPAIR_VALUE_LEN); 
90
							found = 1;
91
							break;
92
						}
93
					}
94
95
					if (!found)
96
						snprintf(color_pairs[i].value, sizeof(color_pairs[i].value), "\e[%s", p);
97
				}
81
			}
98
			}
82
	}
99
	}
83
100

Return to bug 651546