[5584] in Athena Bugs

home help back first fref pref prev next nref lref last post

vax 7.0F: X11r4 libX11.a, XGetDefault() function.

daemon@ATHENA.MIT.EDU (vanharen@ATHENA.MIT.EDU)
Fri Jul 20 10:32:36 1990

From: vanharen@ATHENA.MIT.EDU
To: bugs@ATHENA.MIT.EDU
Date: Fri, 20 Jul 90 10:32:21 EDT

System name:		fries
Type and version:	CVAXSTAR 7.0F (2 update(s) to same version)
Display type:		SM

What were you trying to do?
	Get an X default from my app-defaults file using XGetDefault().

What's wrong:
	Under R4, it is not possible to specify defaults with periods in
	them.  Under R3, this was possible.

What should have happened:
	XGetDefault() should allow you to get defaults with periods in
	them, or the manual should mention that this is not possible.

Please describe any relevant documentation references:
	XGetDefault() manpage, X11 manual, etc.

Probable cause:

Under R3, XGetDefault contained this code  (XGetDflt.c, lines 145-148):

        sprintf(temp, "%s.%s", progname, name);
        XrmGetResource(dpy->db, temp, "Program.Name", &type, &result);

        return (result.addr);

R4 has this instead  (XGetDflt.c, lines 152-159):

        names[0] = XrmStringToName(progname);
        names[1] = XrmStringToName(name);
        names[2] = NULLQUARK;
        classes[0] = XrmStringToClass("Program");
        classes[1] = XrmStringToClass("Name");
        classes[2] = NULLQUARK;
        (void)XrmQGetResource(dpy->db, names, classes, &fromType, &result);
        return (result.addr);

XrmQGetResource and XrmGetResource are essentially unchanged from R3 to
R4, so the differences in the code above is probably the culprit.

Possible fix:
	Put the R3 code back, or substitute something like this:

        sprintf(temp, "%s.%s", progname, name);
	XrmStringToNameList(temp, names);
        classes[0] = XrmStringToClass("Program");
        classes[1] = XrmStringToClass("Name");
        classes[2] = NULLQUARK;
        (void)XrmQGetResource(dpy->db, names, classes, &fromType, &result);
        return (result.addr);

You'd also have to make "names" larger, since it is only an array of 3
right now.  Note that I have not tested this patch, I'm just suggesting
what I think might be right off the top of my head.

I'm not sure why the R3 code was changed to the way it is for R4.  I
suppose there is one less function call performed in the R4 version, but
it causes the problem I mentioned above.  If the R4 code is left as-is,
please make sure that this incompatibility is documented somewhere.

home help back first fref pref prev next nref lref last post