[PATCH v4 2/3] xfree86: Use xorg.conf.d directory for multiple config files
Julien Cristau
jcristau at debian.org
Mon Dec 21 15:05:46 PST 2009
On Mon, Dec 21, 2009 at 12:35:08 -0800, Dan Nicholson wrote:
> +/*
> + * Given some searching parameters, locate and open the xorg config
> + * directory. The directory does not need to contain config files.
> + */
> +static char *
> +OpenConfigDir(const char *path, const char *projroot, const char *confname)
> +{
> + char *dirpath, *pathcopy;
> + const char *template;
> + Bool found = FALSE;
> +
> + pathcopy = strdup(path);
> + for (template = strtok(pathcopy, ","); template && !found;
would removing this "&& !found" be enough to make multiple xorg.conf.d
directories work? It'd be nice to have both /usr/share/X11/xorg.conf.d
and /etc/X11/xorg.conf.d, with the latter overriding the former…
> + template = strtok(NULL, ",")) {
> + struct dirent **list = NULL;
> + int num;
> +
> + if (!(dirpath = DoSubstitution(template, NULL, projroot,
> + NULL, NULL, confname)))
> + continue;
> + /* match files named *.conf */
> + num = scandir(dirpath, &list, ConfigFilter, alphasort);
> + found = AddConfigDirFiles(dirpath, list, num);
> + if (!found) {
> + free(dirpath);
> + dirpath = NULL;
> + if (list)
> + free(list);
> + }
> + }
> +
> + return dirpath;
> +}
> +
Cheers,
Julien
More information about the xorg-devel
mailing list