changeset 50040:57e262ca5d0d

(w32_get_rdb_resource): New function. (x_get_string_resource): Use it, so resources passed with -xrm supercede the ones in the registry.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 06 Mar 2003 13:04:47 +0000
parents 479f0fd3607c
children 8a0260337471
files src/w32reg.c
diffstat 1 files changed, 31 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32reg.c	Thu Mar 06 13:01:32 2003 +0000
+++ b/src/w32reg.c	Thu Mar 06 13:04:47 2003 +0000
@@ -30,6 +30,26 @@
 
 #define REG_ROOT "SOFTWARE\\GNU\\Emacs"
 
+static char *
+w32_get_rdb_resource (rdb, resource)
+     char *rdb;
+     char *resource;
+{
+  char *value = rdb;
+  int len = strlen (resource);
+
+  while (*value)
+    {
+      /* Comparison is case-insensitive because registry searches are too.  */
+      if ((strnicmp (value, resource, len) == 0) && (value[len] == ':'))
+        return xstrdup (&value[len + 1]);
+
+      value = strchr (value, '\0') + 1;
+    }
+
+  return NULL;
+}
+
 LPBYTE
 w32_get_string_resource (name, class, dwexptype)
      char *name, *class;
@@ -99,8 +119,18 @@
 
 char *
 x_get_string_resource (rdb, name, class)
-     int rdb;
+     char *rdb;
      char *name, *class;
 {
+  if (rdb)
+    {
+      char *resource;
+
+      if (resource = w32_get_rdb_resource (rdb, name))
+        return resource;
+      if (resource = w32_get_rdb_resource (rdb, class))
+        return resource;
+    }
+
   return (w32_get_string_resource (name, class, REG_SZ));
 }