phil@BRL.MIL (Phil Dykstra) (01/11/90)
X Window System Bug Report
xbugs@expo.lcs.mit.edu
VERSION:
R4
CLIENT MACHINE and OPERATING SYSTEM:
Sun 3/50, SunOS 3.4, cc or gcc compiled.
DISPLAY TYPE:
N/A (Sun bwtwo)
WINDOW MANAGER:
N/A (twm or gwm)
AREA:
xrdb
SYNOPSIS:
xrdb no longer strips trailing whitespace on resources
DESCRIPTION:
Under R3, trailing whitespace after a resource value was stripped off.
Now, under R4 it is maintained, which makes things like font string
matches much more difficult.
I am fully prepared to hear "This is a bug, not a feature, how else
could you pass the string 'gronk<tab><space><tab>' ?!" If so, might
I suggest quotes? If not, see fix below.
REPEAT BY:
xrdb -load < .Xres
Where .Xres contains say:
xterm*VT100.font:myfont /* I like to put comments here */
And the font name ends up as "myfont ".
SAMPLE FIX:
I put back the trailing space stripper from R3:
*** xrdb.c.mit Wed Dec 13 13:54:21 1989
--- xrdb.c Wed Jan 10 23:59:29 1990
***************
*** 233,238 ****
--- 233,240 ----
while (temp[0] == ' ' || temp[0] == '\t') {
temp++; length--;
}
+ while (temp[length-1] == ' ' || temp[length-1] == '\t')
+ temp[--length] = '\0';
entry.value = temp;
entry.lineno = lineno;
rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (01/11/90)
Under R3, trailing whitespace after a resource value was stripped off. This "feature" of the R3 xrdb was considered a bug, and has been fixed in R4. Stripping trailing whitespace is not part of the normal resource mechanisms in Xlib/Xt, and shouldn't be a part of xrdb either. Now, under R4 it is maintained, which makes things like font string matches much more difficult. Much more? I don't think so. If so, might I suggest quotes? Might I suggest you fix your resources instead?
phil@BRL.MIL (Phil Dykstra) (01/12/90)
Stripping trailing whitespace is not part of the normal resource mechanisms in Xlib/Xt, and shouldn't be a part of xrdb either. But invoking cpp is not part of Xlib/Xt either, so xrdb is already different. The penalty of your fix is that you can never have comments on the same line as a string resource, something I was quite fond of. This may be a likely pitfall for new users as well. I wish you would reconsider, but heck, I guess I can live with it. Thanks. - Phil