+ const unsigned int color1 = color_sets[i][0];
+ const unsigned int color2 = color_sets[i][1];
+ if (CHECK_COLORS_RANDOM (color1, color2))
+ vfprintf_fail (formats[FMT_RANDOM], tables[color1].desc, color_names[color1]->orig, "cannot be combined with", color_names[color2]->orig);
+ }
+ }
+
+ find_color_entries (color_names, colors);
+ assert (colors[FOREGROUND] != NULL);
+ free_color_names (color_names);
+
+ if (!colors[FOREGROUND]->code && colors[BACKGROUND] && colors[BACKGROUND]->code)
+ {
+ struct color_name color_name;
+ color_name.name = color_name.orig = "default";
+
+ find_color_entry (&color_name, FOREGROUND, colors);
+ assert (colors[FOREGROUND]->code != NULL);
+ }
+
+ process_file_arg (file_string, file, stream);
+}
+
+static void
+process_file_arg (const char *file_string, const char **file, FILE **stream)
+{
+ if (file_string)
+ {
+ if (streq (file_string, "-"))
+ *stream = stdin;
+ else
+ {
+ const char *file = file_string;
+ struct stat sb;
+ int ret;
+
+ errno = 0;
+ ret = stat (file, &sb);
+
+ if (ret == -1)
+ vfprintf_fail (formats[FMT_FILE], file, strerror (errno));
+
+ if (!VALID_FILE_TYPE (sb.st_mode))
+ vfprintf_fail (formats[FMT_TYPE], file, "unrecognized type", get_file_type (sb.st_mode));
+
+ *stream = open_file (file, "r");
+ }
+ *file = file_string;
+ }
+ else
+ {
+ *stream = stdin;
+ *file = "stdin";
+ }
+
+ assert (*stream != NULL);
+ assert (*file != NULL);
+}
+
+static void
+skip_path_colors (const char *color_string, const char *file_string, const struct stat *sb)
+{
+ bool have_file;
+ unsigned int c;
+ const char *color = color_string;
+ const mode_t mode = sb->st_mode;
+
+ for (c = 1; c <= 2 && *color; c++)
+ {
+ bool matched = false;
+ unsigned int i;
+ for (i = 0; i < tables[GENERIC].count; i++)
+ {
+ const struct color *entry = &tables[GENERIC].entries[i];
+ if (has_color_name (color, entry->name))