--- xf86Config.c.old 2005-09-30 22:32:27.000000000 -0400 +++ xf86Config.c 2005-09-30 22:33:22.000000000 -0400 @@ -88,31 +88,6 @@ extern DeviceAssocRec mouse_assoc; #define SUPPORT_PC98 #endif -/* - * These paths define the way the config file search is done. The escape - * sequences are documented in parser/scan.c. - */ -#ifndef ROOT_CONFIGPATH -#define ROOT_CONFIGPATH "%A," "%R," \ - "/etc/X11/%R," "%P/etc/X11/%R," \ - "%E," "%F," \ - "/etc/X11/%F," "%P/etc/X11/%F," \ - "%D/%X," \ - "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," \ - "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ - "%P/lib/X11/%X" -#endif -#ifndef USER_CONFIGPATH -#define USER_CONFIGPATH "/etc/X11/%S," "%P/etc/X11/%S," \ - "/etc/X11/%G," "%P/etc/X11/%G," \ - "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," \ - "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ - "%P/lib/X11/%X" -#endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif @@ -2463,25 +2438,30 @@ addDefaultModes(MonPtr monitorp) ConfigStatus xf86HandleConfigFile(Bool autoconfig) { - const char *filename; - char *searchpath; + char *filename; MessageType from = X_DEFAULT; char *scanptr; + FILE *fptr = NULL; Bool singlecard = 0; if (!autoconfig) { - if (getuid() == 0) - searchpath = ROOT_CONFIGPATH; - else - searchpath = USER_CONFIGPATH; - if (xf86ConfigFile) + if (xf86ConfigFile) { from = X_CMDLINE; + filename = malloc(strlen(xf86ConfigFile) + 1); + strcpy(filename, xf86ConfigFile); + } else { + filename = malloc(strlen(DEFAULT_CONFIGPATH) + strlen(XORG_CONFIGFILE) + 1); + sprintf(filename, "%s/%s", DEFAULT_CONFIGPATH, XORG_CONFIGFILE); + } + + xf86openConfigFile(filename); + xf86ConfigFile = xnfstrdup(filename); + fptr = fopen(filename,"r"); - filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT); - if (filename) { + if (fptr) { xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename); - xf86ConfigFile = xnfstrdup(filename); + fclose(fptr); } else { xf86Msg(X_ERROR, "Unable to locate/open config file"); if (xf86ConfigFile) @@ -2490,11 +2470,13 @@ xf86HandleConfigFile(Bool autoconfig) return CONFIG_NOFILE; } } - + + if ((xf86configptr = xf86readConfigFile ()) == NULL) { xf86Msg(X_ERROR, "Problem parsing the config file\n"); return CONFIG_PARSE_ERROR; } + xf86closeConfigFile (); /* Initialise a few things. */ --- xf86Configure.c.old 2005-09-30 12:28:49.000000000 -0400 +++ xf86Configure.c 2005-09-30 22:34:51.000000000 -0400 @@ -888,7 +888,7 @@ DoConfigure() #if defined(SCO) || defined(SCO325) #define PATH_MAX 1024 #endif - const char* configfile = XF86CONFIGFILE".new"; + const char* configfile = XORG_CONFIGFILE".new"; char homebuf[PATH_MAX]; /* getenv might return R/O memory, as with OS/2 */ strncpy(homebuf,home,PATH_MAX-1); @@ -905,7 +905,6 @@ DoConfigure() #else sprintf(filename, "//%d%s/%s", getnid(),home,configfile); #endif - } xf86writeConfigFile(filename, xf86config); @@ -1035,7 +1034,7 @@ DoConfigure() " has configured a multihead system, please check your config.\n"); } - ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename); + ErrorF("\nYour %s file is %s\n\n", XORG_CONFIGFILE, filename); ErrorF("To test the server, run 'X -config %s'\n\n", filename); bail: --- xf86Init.c.old 2005-09-30 11:59:53.000000000 -0400 +++ xf86Init.c 2005-09-30 22:36:42.000000000 -0400 @@ -1397,7 +1397,7 @@ ddxProcessArgument(int argc, char **argv return 2; } } - if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) + if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config") || !strcmp(argv[i], "-xorgconfig")) { if (!argv[i + 1]) return 0; @@ -1405,7 +1405,7 @@ ddxProcessArgument(int argc, char **argv FatalError("\nInvalid argument for -config\n" "\tFor non-root users, the file specified with -config must be\n" "\ta relative path and must not contain any \"..\" elements.\n" - "\tUsing default "__XCONFIGFILE__" search path.\n\n"); + "\tUsing default "DEFAULT_CONFIGPATH" search path.\n\n"); } xf86ConfigFile = argv[i + 1]; return 2; @@ -1726,12 +1726,12 @@ ddxUseMsg() { ErrorF("-modulepath paths specify the module search path\n"); ErrorF("-logfile file specify a log file name\n"); - ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n"); + ErrorF("-configure probe for devices and write an "XORG_CONFIGFILE"\n"); } else { ErrorF("-config file specify a configuration file, relative to the\n"); - ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n"); + ErrorF(" "XORG_CONFIGFILE" search path, only root can use absolute\n"); } ErrorF("-probeonly probe for devices, then exit\n"); ErrorF("-scanpci execute the scanpci module and exit\n");