Retrieving config filename.

Roland Mainz roland.mainz at nrubsig.org
Sun Oct 17 11:57:42 PDT 2004


Ben Skeggs wrote:
> Is there an X request or even an Xlib call which can be used to discover
> the location of the config file being used by the X server.  I am trying to
> write a control panel interface to various things related to the X server,
> and with XFree/Xorg and whatever other X servers there are around,
> guessing the current config file might be a little difficult.

1. At least for the Xorg server there is already the "xorgcfg" tool.

2. A general API for this does not exist as the configuration method
differs a lot between X distributions and Xservers - for example Solaris
Xsun has a different configuration method than the Xorg server or the
HP-UX Xserver. And even on the same platform there are differentces -
for example Xsun (video server) uses different config files than Xprt
(print server) etc. etc.

3. For the Xorg server there is an API in the Xfree86Misc extension.
Example:
-- snip --
int dummy;
int major = 0;
XF86MiscFilePaths xfpaths;

if (XF86MiscQueryExtension(dpy, &dummy, &dummy) &&
    XF86MiscQueryVersion(dpy, &major, &dummy) &&
    (major > 0) && 
    XF86MiscGetFilePaths(dpy, &xfpaths)) {
    printf("File paths:\n");
    printf("  Config file:  %s\n", xfpaths.configfile);
    printf("  Modules path: %s\n", xfpaths.modulepath);
    printf("  Log file:     %s\n", xfpaths.logfile);
}
-- snip --
... but again... this is a specific API for the "Xorg" server and won't
work for everything else except "Xorg" ...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)



More information about the xorg mailing list