summaryrefslogtreecommitdiff
path: root/src/w32reg.c
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2003-03-06 13:07:24 +0000
committerJuanma Barranquero <lekktu@gmail.com>2003-03-06 13:07:24 +0000
commitc9029fe54be0f7b0a6ecfee0528b171d7392b5fe (patch)
tree87c12a82e820321fe1ad95a08e14787f5811807a /src/w32reg.c
parente5af3c25c972a28df90fa48aa9a121a8c2cb7e61 (diff)
downloademacs-c9029fe54be0f7b0a6ecfee0528b171d7392b5fe.tar.gz
(w32_get_rdb_resource): New function.
(x_get_string_resource): Use it, so resources passed with -xrm supercede the ones in the registry.
Diffstat (limited to 'src/w32reg.c')
-rw-r--r--src/w32reg.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/w32reg.c b/src/w32reg.c
index 3a2bd1b68d9..73214d787d5 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -30,6 +30,26 @@ Boston, MA 02111-1307, USA. */
#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 @@ w32_get_string_resource (name, class, dwexptype)
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));
}