read_rgb_txt ()
{
FILE *fp;
- int r, g, b;
+ int r, g, b, i;
/* At first, support HTML 4.0 color names. */
msymbol_put (msymbol ("black"), M_rgb, (void *) 0x000000);
msymbol_put (msymbol ("teal"), M_rgb, (void *) 0x008080);
msymbol_put (msymbol ("aqua"), M_rgb, (void *) 0x00FFFF);
- fp = fopen ("/usr/lib/X11/rgb.txt", "r");
- if (! fp)
- fp = fopen ("/usr/X11R6/lib/X11/rgb.txt", "r");
- if (! fp)
- return;
+ {
+ char *rgb_path[]
+ = {"/usr/lib/X11/rgb.txt", "/usr/X11R6/lib/X11/rgb.txt",
+ "/etc/X11/rgb.txt" };
+
+ fp = NULL;
+ for (i = 0; i < (sizeof rgb_path) / (sizeof rgb_path[0]); i++)
+ if ((fp = fopen ("/usr/lib/X11/rgb.txt", "r")))
+ break;
+ if (! fp)
+ return;
+ }
while (1)
{
char buf[256];
buf[0] = c;
fgets (buf + 1, 255, fp);
len = strlen (buf);
+ for (i = 0; i < len; i++)
+ buf[i] = tolower (buf[i]);
if (buf[len - 1] == '\n')
buf[len - 1] = '\0';
b |= (r << 16) | (g << 8);