+/* read xrdb for configuration options */
+static void
+initresources(void)
+{
+ char *xrm;
+ long n;
+ char *type;
+ XrmDatabase xdb;
+ XrmValue xval;
+
+ XrmInitialize();
+ if ((xrm = XResourceManagerString(dpy)) == NULL)
+ return;
+
+ xdb = XrmGetStringDatabase(xrm);
+
+ if (XrmGetResource(xdb, "xmenu.borderWidth", "*", &type, &xval) == True)
+ if ((n = strtol(xval.addr, NULL, 10)) > 0)
+ config.border_pixels = n;
+ if (XrmGetResource(xdb, "xmenu.separatorWidth", "*", &type, &xval) == True)
+ if ((n = strtol(xval.addr, NULL, 10)) > 0)
+ config.separator_pixels = n;
+ if (XrmGetResource(xdb, "xmenu.height", "*", &type, &xval) == True)
+ if ((n = strtol(xval.addr, NULL, 10)) > 0)
+ config.height_pixels = n;
+ if (XrmGetResource(xdb, "xmenu.width", "*", &type, &xval) == True)
+ if ((n = strtol(xval.addr, NULL, 10)) > 0)
+ config.width_pixels = n;
+ if (XrmGetResource(xdb, "xmenu.gap", "*", &type, &xval) == True)
+ if ((n = strtol(xval.addr, NULL, 10)) > 0)
+ config.gap_pixels = n;
+ if (XrmGetResource(xdb, "xmenu.background", "*", &type, &xval) == True)
+ config.background_color = strdup(xval.addr);
+ if (XrmGetResource(xdb, "xmenu.foreground", "*", &type, &xval) == True)
+ config.foreground_color = strdup(xval.addr);
+ if (XrmGetResource(xdb, "xmenu.selbackground", "*", &type, &xval) == True)
+ config.selbackground_color = strdup(xval.addr);
+ if (XrmGetResource(xdb, "xmenu.selforeground", "*", &type, &xval) == True)
+ config.selforeground_color = strdup(xval.addr);
+ if (XrmGetResource(xdb, "xmenu.separator", "*", &type, &xval) == True)
+ config.separator_color = strdup(xval.addr);
+ if (XrmGetResource(xdb, "xmenu.border", "*", &type, &xval) == True)
+ config.border_color = strdup(xval.addr);
+ if (XrmGetResource(xdb, "xmenu.font", "*", &type, &xval) == True)
+ config.font = strdup(xval.addr);
+
+ XrmDestroyDatabase(xdb);
+}
+