[comp.windows.x] Patch for xrdb.c

ehrlich@shire.cs.psu.edu (Daniel Ehrlich) (05/11/89)

A while back I had asked if there was a way to determine which version
of the X Window System the server a client was speaking to was
running.  After poking around and looking at things that get returned
in the Display structure from XOpenWindow I have come up with the
following patch for xrdb.c that will define a preprocessor symbol XnRm
that correctly reflects this information:

RCS file: RCS/xrdb.c,v
retrieving revision 1.1
diff -c -r1.1 xrdb.c
*** /tmp/,RCSt1020258	Thu May 11 09:48:44 1989
--- xrdb.c	Thu May 11 09:26:10 1989
***************
*** 41,46 ****
--- 41,50 ----
  #include <X11/Xos.h>
  #include <ctype.h>
  
+ #ifndef	XlibProtoVersion
+ #define	XlibProtoVersion(dpy) ((dpy)->vnumber)
+ #endif	/* XlibProtoVersion */
+ 
  #ifndef CPP
  #define CPP "/usr/lib/cpp"
  #endif /* CPP */
***************
*** 307,312 ****
--- 311,319 ----
      if (temp[0] == '\0')	/* must be connected to :0 */
  	gethostname(temp, MAXHOSTNAME);
      AddDef(defs, "HOST", temp);
+     (void) sprintf(temp, "X%dR%d", XlibProtoVersion(display),
+ 				   VendorRelease(display));
+     AddNum(defs, temp, 1);
      screen = DefaultScreenOfDisplay(display);
      visual = DefaultVisualOfScreen(screen);
      AddNum(defs, "WIDTH", screen->width);

Dan Ehrlich <ehrlich@shire.cs.psu.edu> | Disclaimer: The opinions expressed are
The Pennsylvania State University      | my own, and should not be attributed
Department of Computer Science         | to anyone else, living or dead.
University Park, PA   16802            |
Dan Ehrlich <ehrlich@shire.cs.psu.edu> | Disclaimer: The opinions expressed are
The Pennsylvania State University      | my own, and should not be attributed
Department of Computer Science         | to anyone else, living or dead.
University Park, PA   16802            |