Mercurial > emacs
annotate src/xrdb.c @ 111538:a36ab2f7cad2
Let the cursorColor X resource set the the cursor face (Bug#7392).
* lisp/startup.el (command-line): If the cursorColor resource is set,
change the cursor face-spec (Bug#7392).
* src/xfns.c (Fx_create_frame): Don't check for the cursorColor
resource here; it's now done at startup.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 13 Nov 2010 21:09:11 -0500 |
parents | 0c681b288c59 |
children | ac49e05bfcf2 |
rev | line source |
---|---|
159 | 1 /* Deal with the X Resource Manager. |
64770
a0d1312ede66
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64084
diff
changeset
|
2 Copyright (C) 1990, 1993, 1994, 2000, 2001, 2002, 2003, 2004, |
106815 | 3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
159 | 4 |
101091
9e4d0326f86c
Comment (add Author:, based on authors.el).
Glenn Morris <rgm@gnu.org>
parents:
100951
diff
changeset
|
5 Author: Joseph Arceneaux |
9e4d0326f86c
Comment (add Author:, based on authors.el).
Glenn Morris <rgm@gnu.org>
parents:
100951
diff
changeset
|
6 Created: 4/90 |
9e4d0326f86c
Comment (add Author:, based on authors.el).
Glenn Morris <rgm@gnu.org>
parents:
100951
diff
changeset
|
7 |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
10463
diff
changeset
|
8 This file is part of GNU Emacs. |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
10463
diff
changeset
|
9 |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94942
diff
changeset
|
10 GNU Emacs is free software: you can redistribute it and/or modify |
159 | 11 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94942
diff
changeset
|
12 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94942
diff
changeset
|
13 (at your option) any later version. |
159 | 14 |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
10463
diff
changeset
|
15 GNU Emacs is distributed in the hope that it will be useful, |
159 | 16 but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 GNU General Public License for more details. | |
19 | |
20 You should have received a copy of the GNU General Public License | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94942
diff
changeset
|
21 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
159 | 22 |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4538
diff
changeset
|
23 #include <config.h> |
1019
aaa628aaf808
* xrdb.c [USG5]: Define SYSV, and then include <unistd.h>. I
Jim Blandy <jimb@redhat.com>
parents:
620
diff
changeset
|
24 |
21514 | 25 #ifdef HAVE_UNISTD_H |
26 #include <unistd.h> | |
27 #endif | |
28 | |
107737
912a8c0c9a8a
Remove extern errno declarations.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
29 #include <errno.h> |
24412
d11ac02f9d6a
Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
30 #include <epaths.h> |
19393 | 31 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
32 #include <stdio.h> |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105069
diff
changeset
|
33 #include <setjmp.h> |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
34 |
159 | 35 #include <X11/Xlib.h> |
36 #include <X11/Xatom.h> | |
37 #include <X11/X.h> | |
38 #include <X11/Xutil.h> | |
39 #include <X11/Xresource.h> | |
61700
8a54ce1fae6a
Remove reference to defunct vms-pwd.h.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
60830
diff
changeset
|
40 #ifdef HAVE_PWD_H |
159 | 41 #include <pwd.h> |
556 | 42 #endif |
159 | 43 #include <sys/stat.h> |
44 | |
5650
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
45 #if !defined(S_ISDIR) && defined(S_IFDIR) |
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
46 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
47 #endif |
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
48 |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
49 #include "lisp.h" |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
50 |
111094
0c681b288c59
Fix compilation with Motif (Bug#7263).
Jan D <jan.h.d@swipnet.se>
parents:
110572
diff
changeset
|
51 #ifdef USE_MOTIF |
0c681b288c59
Fix compilation with Motif (Bug#7263).
Jan D <jan.h.d@swipnet.se>
parents:
110572
diff
changeset
|
52 /* For Vdouble_click_time. */ |
0c681b288c59
Fix compilation with Motif (Bug#7263).
Jan D <jan.h.d@swipnet.se>
parents:
110572
diff
changeset
|
53 #include "keyboard.h" |
0c681b288c59
Fix compilation with Motif (Bug#7263).
Jan D <jan.h.d@swipnet.se>
parents:
110572
diff
changeset
|
54 #endif |
0c681b288c59
Fix compilation with Motif (Bug#7263).
Jan D <jan.h.d@swipnet.se>
parents:
110572
diff
changeset
|
55 |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108073
diff
changeset
|
56 extern char *getenv (const char *); |
1934
458a1fceb462
* xrdb.c (getuid): Remove declaration.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
57 |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108073
diff
changeset
|
58 extern struct passwd *getpwuid (uid_t); |
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108073
diff
changeset
|
59 extern struct passwd *getpwnam (const char *); |
159 | 60 |
109726
64732fa6188a
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109687
diff
changeset
|
61 extern const char *get_system_name (void); |
5735
87611653922f
(x_get_customization_string): Use get_system_name instead of gethostname.
Karl Heuer <kwzh@gnu.org>
parents:
5650
diff
changeset
|
62 |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
63 char *x_get_string_resource (XrmDatabase rdb, const char *name, |
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
64 const char *class); |
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
65 static int file_p (const char *filename); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
66 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
67 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
68 /* X file search path processing. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
69 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
70 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
71 /* The string which gets substituted for the %C escape in XFILESEARCHPATH |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
72 and friends, or zero if none was specified. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
73 char *x_customization_string; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
74 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
75 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
76 /* Return the value of the emacs.customization (Emacs.Customization) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
77 resource, for later use in search path decoding. If we find no |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
78 such resource, return zero. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
79 char * |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
80 x_get_customization_string (XrmDatabase db, const char *name, const char *class) |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
81 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
82 char *full_name |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
83 = (char *) alloca (strlen (name) + sizeof ("customization") + 3); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
84 char *full_class |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
85 = (char *) alloca (strlen (class) + sizeof ("Customization") + 3); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
86 char *result; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
87 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
88 sprintf (full_name, "%s.%s", name, "customization"); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
89 sprintf (full_class, "%s.%s", class, "Customization"); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
90 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
91 result = x_get_string_resource (db, full_name, full_class); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
92 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
93 if (result) |
4538
0fd9dd894f9f
(x_get_customization_string): Don't use value of strcpy.
Richard M. Stallman <rms@gnu.org>
parents:
4366
diff
changeset
|
94 { |
109687 | 95 char *copy = (char *) xmalloc (strlen (result) + 1); |
4538
0fd9dd894f9f
(x_get_customization_string): Don't use value of strcpy.
Richard M. Stallman <rms@gnu.org>
parents:
4366
diff
changeset
|
96 strcpy (copy, result); |
0fd9dd894f9f
(x_get_customization_string): Don't use value of strcpy.
Richard M. Stallman <rms@gnu.org>
parents:
4366
diff
changeset
|
97 return copy; |
0fd9dd894f9f
(x_get_customization_string): Don't use value of strcpy.
Richard M. Stallman <rms@gnu.org>
parents:
4366
diff
changeset
|
98 } |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
99 else |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
100 return 0; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
101 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
102 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
103 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
104 /* Expand all the Xt-style %-escapes in STRING, whose length is given |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
105 by STRING_LEN. Here are the escapes we're supposed to recognize: |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
106 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
107 %N The value of the application's class name |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
108 %T The value of the type parameter ("app-defaults" in this |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
109 context) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
110 %S The value of the suffix parameter ("" in this context) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
111 %L The language string associated with the specified display |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
112 (We use the "LANG" environment variable here, if it's set.) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
113 %l The language part of the display's language string |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
114 (We treat this just like %L. If someone can tell us what |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
115 we're really supposed to do, dandy.) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
116 %t The territory part of the display's language string |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
117 (This never gets used.) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
118 %c The codeset part of the display's language string |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
119 (This never gets used either.) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
120 %C The customization string retrieved from the resource |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
121 database associated with display. |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
122 (This is x_customization_string.) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
123 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
124 Return the expanded file name if it exists and is readable, and |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
125 refers to %L only when the LANG environment variable is set, or |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
126 otherwise provided by X. |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
127 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
128 ESCAPED_SUFFIX and SUFFIX are postpended to STRING if they are |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
129 non-zero. %-escapes in ESCAPED_SUFFIX are expanded; STRING is left |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
130 alone. |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
131 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
132 Return NULL otherwise. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
133 |
159 | 134 static char * |
110572
a1facefdd4a2
xrdb.c EMACS_INT/int audit.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
109748
diff
changeset
|
135 magic_file_p (const char *string, EMACS_INT string_len, const char *class, const char *escaped_suffix, const char *suffix) |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
136 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
137 char *lang = getenv ("LANG"); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
138 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
139 int path_size = 100; |
109687 | 140 char *path = (char *) xmalloc (path_size); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
141 int path_len = 0; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
142 |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
143 const char *p = string; |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
144 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
145 while (p < string + string_len) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
146 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
147 /* The chunk we're about to stick on the end of result. */ |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
148 const char *next = NULL; |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
149 int next_len; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
150 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
151 if (*p == '%') |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
152 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
153 p++; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
154 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
155 if (p >= string + string_len) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
156 next_len = 0; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
157 else |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
158 switch (*p) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
159 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
160 case '%': |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
161 next = "%"; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
162 next_len = 1; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
163 break; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
164 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
165 case 'C': |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
166 next = (x_customization_string |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
167 ? x_customization_string |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
168 : ""); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
169 next_len = strlen (next); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
170 break; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
171 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
172 case 'N': |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
173 next = class; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
174 next_len = strlen (class); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
175 break; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
176 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
177 case 'T': |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
178 next = "app-defaults"; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
179 next_len = strlen (next); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
180 break; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
181 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
182 default: |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
183 case 'S': |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
184 next_len = 0; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
185 break; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
186 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
187 case 'L': |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
188 case 'l': |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
189 if (! lang) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
190 { |
109687 | 191 xfree (path); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
192 return NULL; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
193 } |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
194 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
195 next = lang; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
196 next_len = strlen (next); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
197 break; |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
198 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
199 case 't': |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
200 case 'c': |
109687 | 201 xfree (path); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
202 return NULL; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
203 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
204 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
205 else |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
206 next = p, next_len = 1; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
207 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
208 /* Do we have room for this component followed by a '\0' ? */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
209 if (path_len + next_len + 1 > path_size) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
210 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
211 path_size = (path_len + next_len + 1) * 2; |
109687 | 212 path = (char *) xrealloc (path, path_size); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
213 } |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
214 |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
215 memcpy (path + path_len, next, next_len); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
216 path_len += next_len; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
217 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
218 p++; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
219 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
220 /* If we've reached the end of the string, append ESCAPED_SUFFIX. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
221 if (p >= string + string_len && escaped_suffix) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
222 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
223 string = escaped_suffix; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
224 string_len = strlen (string); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
225 p = string; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
226 escaped_suffix = NULL; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
227 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
228 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
229 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
230 /* Perhaps we should add the SUFFIX now. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
231 if (suffix) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
232 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
233 int suffix_len = strlen (suffix); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
234 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
235 if (path_len + suffix_len + 1 > path_size) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
236 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
237 path_size = (path_len + suffix_len + 1); |
109687 | 238 path = (char *) xrealloc (path, path_size); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
239 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
240 |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
241 memcpy (path + path_len, suffix, suffix_len); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
242 path_len += suffix_len; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
243 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
244 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
245 path[path_len] = '\0'; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
246 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
247 if (! file_p (path)) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
248 { |
109687 | 249 xfree (path); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
250 return NULL; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
251 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
252 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
253 return path; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
254 } |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
255 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
256 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
257 static char * |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108073
diff
changeset
|
258 gethomedir (void) |
159 | 259 { |
260 struct passwd *pw; | |
261 char *ptr; | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
262 char *copy; |
159 | 263 |
264 if ((ptr = getenv ("HOME")) == NULL) | |
265 { | |
5917
91caeed50c64
(gethomedir): Look at LOGNAME before USER.
Karl Heuer <kwzh@gnu.org>
parents:
5735
diff
changeset
|
266 if ((ptr = getenv ("LOGNAME")) != NULL |
91caeed50c64
(gethomedir): Look at LOGNAME before USER.
Karl Heuer <kwzh@gnu.org>
parents:
5735
diff
changeset
|
267 || (ptr = getenv ("USER")) != NULL) |
159 | 268 pw = getpwnam (ptr); |
269 else | |
5917
91caeed50c64
(gethomedir): Look at LOGNAME before USER.
Karl Heuer <kwzh@gnu.org>
parents:
5735
diff
changeset
|
270 pw = getpwuid (getuid ()); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
271 |
159 | 272 if (pw) |
273 ptr = pw->pw_dir; | |
274 } | |
275 | |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
276 if (ptr == NULL) |
69913
eddb3cab7138
(gethomedir): Use xstrdup.
Romain Francoise <romain@orebokech.com>
parents:
69911
diff
changeset
|
277 return xstrdup ("/"); |
159 | 278 |
109687 | 279 copy = (char *) xmalloc (strlen (ptr) + 2); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
280 strcpy (copy, ptr); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
281 strcat (copy, "/"); |
159 | 282 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
283 return copy; |
159 | 284 } |
285 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
286 |
159 | 287 static int |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
288 file_p (const char *filename) |
159 | 289 { |
290 struct stat status; | |
291 | |
43672
e26d9755d4e8
(file_p): Rename arg `path' to `filename'.
Richard M. Stallman <rms@gnu.org>
parents:
38840
diff
changeset
|
292 return (access (filename, 4) == 0 /* exists and is readable */ |
e26d9755d4e8
(file_p): Rename arg `path' to `filename'.
Richard M. Stallman <rms@gnu.org>
parents:
38840
diff
changeset
|
293 && stat (filename, &status) == 0 /* get the status */ |
5650
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
294 && (S_ISDIR (status.st_mode)) == 0); /* not a directory */ |
159 | 295 } |
296 | |
297 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
298 /* Find the first element of SEARCH_PATH which exists and is readable, |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
299 after expanding the %-escapes. Return 0 if we didn't find any, and |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
300 the path name of the one we found otherwise. */ |
159 | 301 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
302 static char * |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
303 search_magic_path (const char *search_path, const char *class, const char *escaped_suffix, const char *suffix) |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
304 { |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
305 const char *s, *p; |
159 | 306 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
307 for (s = search_path; *s; s = p) |
159 | 308 { |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
309 for (p = s; *p && *p != ':'; p++) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
310 ; |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
311 |
5650
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
312 if (p > s) |
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
313 { |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
314 char *path = magic_file_p (s, p - s, class, escaped_suffix, |
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
315 suffix); |
5650
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
316 if (path) |
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
317 return path; |
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
318 } |
1476768ef7fc
(S_ISDIR): Define if not defined.
Richard M. Stallman <rms@gnu.org>
parents:
5116
diff
changeset
|
319 else if (*p == ':') |
159 | 320 { |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
321 char *path; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
322 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
323 s = "%N%S"; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
324 path = magic_file_p (s, strlen (s), class, escaped_suffix, suffix); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
325 if (path) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
326 return path; |
159 | 327 } |
328 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
329 if (*p == ':') |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
330 p++; |
159 | 331 } |
332 | |
333 return 0; | |
334 } | |
335 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
336 /* Producing databases for individual sources. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
337 |
159 | 338 static XrmDatabase |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
339 get_system_app (const char *class) |
159 | 340 { |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
341 XrmDatabase db = NULL; |
109748
e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
Jan D <jan.h.d@swipnet.se>
parents:
109726
diff
changeset
|
342 const char *path; |
e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
Jan D <jan.h.d@swipnet.se>
parents:
109726
diff
changeset
|
343 char *p; |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
344 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
345 path = getenv ("XFILESEARCHPATH"); |
19388
0f27d1477c21
(get_system_app): Use PATH_X_DEFAULTS.
Richard M. Stallman <rms@gnu.org>
parents:
19318
diff
changeset
|
346 if (! path) path = PATH_X_DEFAULTS; |
159 | 347 |
109748
e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
Jan D <jan.h.d@swipnet.se>
parents:
109726
diff
changeset
|
348 p = search_magic_path (path, class, 0, 0); |
e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
Jan D <jan.h.d@swipnet.se>
parents:
109726
diff
changeset
|
349 if (p) |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
350 { |
109748
e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
Jan D <jan.h.d@swipnet.se>
parents:
109726
diff
changeset
|
351 db = XrmGetFileDatabase (p); |
e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
Jan D <jan.h.d@swipnet.se>
parents:
109726
diff
changeset
|
352 xfree (p); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
353 } |
159 | 354 |
355 return db; | |
356 } | |
357 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
358 |
159 | 359 static XrmDatabase |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108073
diff
changeset
|
360 get_fallback (Display *display) |
159 | 361 { |
362 return NULL; | |
363 } | |
364 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
365 |
159 | 366 static XrmDatabase |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
367 get_user_app (const char *class) |
159 | 368 { |
109748
e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
Jan D <jan.h.d@swipnet.se>
parents:
109726
diff
changeset
|
369 const char *path; |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
370 char *file = 0; |
17572
73d867b4a654
(get_user_app): Free the gethomedir value.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
371 char *free_it = 0; |
159 | 372 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
373 /* Check for XUSERFILESEARCHPATH. It is a path of complete file |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
374 names, not directories. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
375 if (((path = getenv ("XUSERFILESEARCHPATH")) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
376 && (file = search_magic_path (path, class, 0, 0))) |
159 | 377 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
378 /* Check for APPLRESDIR; it is a path of directories. In each, |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
379 we have to search for LANG/CLASS and then CLASS. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
380 || ((path = getenv ("XAPPLRESDIR")) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
381 && ((file = search_magic_path (path, class, "/%L/%N", 0)) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
382 || (file = search_magic_path (path, class, "/%N", 0)))) |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
383 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
384 /* Check in the home directory. This is a bit of a hack; let's |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
385 hope one's home directory doesn't contain any %-escapes. */ |
17572
73d867b4a654
(get_user_app): Free the gethomedir value.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
386 || (free_it = gethomedir (), |
73d867b4a654
(get_user_app): Free the gethomedir value.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
387 ((file = search_magic_path (free_it, class, "%L/%N", 0)) |
73d867b4a654
(get_user_app): Free the gethomedir value.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
388 || (file = search_magic_path (free_it, class, "%N", 0))))) |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
389 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
390 XrmDatabase db = XrmGetFileDatabase (file); |
109687 | 391 xfree (file); |
392 xfree (free_it); | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
393 return db; |
159 | 394 } |
17572
73d867b4a654
(get_user_app): Free the gethomedir value.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
395 |
109687 | 396 xfree (free_it); |
17572
73d867b4a654
(get_user_app): Free the gethomedir value.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
397 return NULL; |
159 | 398 } |
399 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
400 |
159 | 401 static XrmDatabase |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108073
diff
changeset
|
402 get_user_db (Display *display) |
159 | 403 { |
404 XrmDatabase db; | |
405 char *xdefs; | |
406 | |
2126
616aeb5c1432
* xrdb.c (get_user_db): Since xrdb.c doesn't #include xterm.h,
Jim Blandy <jimb@redhat.com>
parents:
1934
diff
changeset
|
407 #ifdef PBaseSize /* Cheap way to test for X11R4 or later. */ |
1051
777ed2b92359
* xrdb.c (get_user_db): Use XResourceManagerString when available
Jim Blandy <jimb@redhat.com>
parents:
1019
diff
changeset
|
408 xdefs = XResourceManagerString (display); |
777ed2b92359
* xrdb.c (get_user_db): Use XResourceManagerString when available
Jim Blandy <jimb@redhat.com>
parents:
1019
diff
changeset
|
409 #else |
1019
aaa628aaf808
* xrdb.c [USG5]: Define SYSV, and then include <unistd.h>. I
Jim Blandy <jimb@redhat.com>
parents:
620
diff
changeset
|
410 xdefs = display->xdefaults; |
1051
777ed2b92359
* xrdb.c (get_user_db): Use XResourceManagerString when available
Jim Blandy <jimb@redhat.com>
parents:
1019
diff
changeset
|
411 #endif |
777ed2b92359
* xrdb.c (get_user_db): Use XResourceManagerString when available
Jim Blandy <jimb@redhat.com>
parents:
1019
diff
changeset
|
412 |
159 | 413 if (xdefs != NULL) |
414 db = XrmGetStringDatabase (xdefs); | |
415 else | |
416 { | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
417 char *home; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
418 char *xdefault; |
159 | 419 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
420 home = gethomedir (); |
109687 | 421 xdefault = (char *) xmalloc (strlen (home) + sizeof (".Xdefaults")); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
422 strcpy (xdefault, home); |
159 | 423 strcat (xdefault, ".Xdefaults"); |
424 db = XrmGetFileDatabase (xdefault); | |
109687 | 425 xfree (home); |
426 xfree (xdefault); | |
159 | 427 } |
428 | |
4366
04bd0c1a6245
* config.h.in (HAVE_XSCREENRESOURCESTRING): New #undef for
Jim Blandy <jimb@redhat.com>
parents:
4233
diff
changeset
|
429 #ifdef HAVE_XSCREENRESOURCESTRING |
3654
d9313b9a63ad
* xrdb.c (get_user_db): Get the screen-specific database too.
Jim Blandy <jimb@redhat.com>
parents:
3371
diff
changeset
|
430 /* Get the screen-specific resources too. */ |
d9313b9a63ad
* xrdb.c (get_user_db): Get the screen-specific database too.
Jim Blandy <jimb@redhat.com>
parents:
3371
diff
changeset
|
431 xdefs = XScreenResourceString (DefaultScreenOfDisplay (display)); |
d9313b9a63ad
* xrdb.c (get_user_db): Get the screen-specific database too.
Jim Blandy <jimb@redhat.com>
parents:
3371
diff
changeset
|
432 if (xdefs != NULL) |
3873
e67c6c10dd7c
* xrdb.c (get_user_db): Remember to free the screen-local resource
Jim Blandy <jimb@redhat.com>
parents:
3654
diff
changeset
|
433 { |
e67c6c10dd7c
* xrdb.c (get_user_db): Remember to free the screen-local resource
Jim Blandy <jimb@redhat.com>
parents:
3654
diff
changeset
|
434 XrmMergeDatabases (XrmGetStringDatabase (xdefs), &db); |
e67c6c10dd7c
* xrdb.c (get_user_db): Remember to free the screen-local resource
Jim Blandy <jimb@redhat.com>
parents:
3654
diff
changeset
|
435 XFree (xdefs); |
e67c6c10dd7c
* xrdb.c (get_user_db): Remember to free the screen-local resource
Jim Blandy <jimb@redhat.com>
parents:
3654
diff
changeset
|
436 } |
3654
d9313b9a63ad
* xrdb.c (get_user_db): Get the screen-specific database too.
Jim Blandy <jimb@redhat.com>
parents:
3371
diff
changeset
|
437 #endif |
d9313b9a63ad
* xrdb.c (get_user_db): Get the screen-specific database too.
Jim Blandy <jimb@redhat.com>
parents:
3371
diff
changeset
|
438 |
159 | 439 return db; |
440 } | |
441 | |
442 static XrmDatabase | |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108073
diff
changeset
|
443 get_environ_db (void) |
159 | 444 { |
445 XrmDatabase db; | |
446 char *p; | |
109726
64732fa6188a
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109687
diff
changeset
|
447 char *path = 0, *home = 0; |
64732fa6188a
Use const char* instead of char*.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109687
diff
changeset
|
448 const char *host; |
159 | 449 |
450 if ((p = getenv ("XENVIRONMENT")) == NULL) | |
451 { | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
452 home = gethomedir (); |
5735
87611653922f
(x_get_customization_string): Use get_system_name instead of gethostname.
Karl Heuer <kwzh@gnu.org>
parents:
5650
diff
changeset
|
453 host = get_system_name (); |
109687 | 454 path = (char *) xmalloc (strlen (home) |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
455 + sizeof (".Xdefaults-") |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
456 + strlen (host)); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
457 sprintf (path, "%s%s%s", home, ".Xdefaults-", host); |
159 | 458 p = path; |
459 } | |
460 | |
461 db = XrmGetFileDatabase (p); | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
462 |
109687 | 463 xfree (path); |
464 xfree (home); | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
465 |
159 | 466 return db; |
467 } | |
468 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
469 /* External interface. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
470 |
159 | 471 /* Types of values that we can find in a database */ |
472 | |
473 #define XrmStringType "String" /* String representation */ | |
474 XrmRepresentation x_rm_string; /* Quark representation */ | |
475 | |
476 /* Load X resources based on the display and a possible -xrm option. */ | |
477 | |
478 XrmDatabase | |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
479 x_load_resources (Display *display, const char *xrm_string, |
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
480 const char *myname, const char *myclass) |
159 | 481 { |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
482 XrmDatabase user_database; |
159 | 483 XrmDatabase rdb; |
484 XrmDatabase db; | |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
485 char line[256]; |
60830
35cf88000489
* xrdb.c (x_load_resources): Undo previous change (2005-03-18).
Jan Djärv <jan.h.d@swipnet.se>
parents:
60717
diff
changeset
|
486 |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
487 const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1"; |
60830
35cf88000489
* xrdb.c (x_load_resources): Undo previous change (2005-03-18).
Jan Djärv <jan.h.d@swipnet.se>
parents:
60717
diff
changeset
|
488 |
25749
275227ca3c0c
(get_fallback): Remove unused variable.
Gerd Moellmann <gerd@gnu.org>
parents:
24992
diff
changeset
|
489 #ifdef USE_MOTIF |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
490 const char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"; |
25749
275227ca3c0c
(get_fallback): Remove unused variable.
Gerd Moellmann <gerd@gnu.org>
parents:
24992
diff
changeset
|
491 #endif |
159 | 492 |
493 x_rm_string = XrmStringToQuark (XrmStringType); | |
7342
4cf4669565af
(x_load_resources) [USE_X_TOOLKIT]: Don't call XrmInitialize.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
494 #ifndef USE_X_TOOLKIT |
4cf4669565af
(x_load_resources) [USE_X_TOOLKIT]: Don't call XrmInitialize.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
495 /* pmr@osf.org says this shouldn't be done if USE_X_TOOLKIT. |
4cf4669565af
(x_load_resources) [USE_X_TOOLKIT]: Don't call XrmInitialize.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
496 I suspect it's because the toolkit version does this elsewhere. */ |
159 | 497 XrmInitialize (); |
7342
4cf4669565af
(x_load_resources) [USE_X_TOOLKIT]: Don't call XrmInitialize.
Richard M. Stallman <rms@gnu.org>
parents:
7307
diff
changeset
|
498 #endif |
159 | 499 rdb = XrmGetStringDatabase (""); |
500 | |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
501 /* Add some font defaults. If the font `helv' doesn't exist, widgets |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
502 will use some other default font. */ |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
503 #ifdef USE_MOTIF |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
504 |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
505 sprintf (line, "%s.pane.background: grey75", myclass); |
29865
6b6699c7fce3
(x_load_resources): Add default resource for scroll bar's
Gerd Moellmann <gerd@gnu.org>
parents:
29803
diff
changeset
|
506 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
507 sprintf (line, "%s*fontList: %s", myclass, helv); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
508 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
509 sprintf (line, "%s*menu*background: grey75", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
510 XrmPutLineResource (&rdb, line); |
36739
483ab551a108
(x_load_resources) [USE_MOTIF]: Remove extraneous arg
Gerd Moellmann <gerd@gnu.org>
parents:
33084
diff
changeset
|
511 sprintf (line, "%s*menubar*background: grey75", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
512 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
513 sprintf (line, "%s*verticalScrollBar.background: grey75", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
514 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
515 sprintf (line, "%s*verticalScrollBar.troughColor: grey75", myclass); |
29865
6b6699c7fce3
(x_load_resources): Add default resource for scroll bar's
Gerd Moellmann <gerd@gnu.org>
parents:
29803
diff
changeset
|
516 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
517 sprintf (line, "%s.dialog*.background: grey75", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
518 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
519 sprintf (line, "%s*fsb.Text.background: white", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
520 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
521 sprintf (line, "%s*fsb.FilterText.background: white", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
522 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
523 sprintf (line, "%s*fsb*DirList.background: white", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
524 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
525 sprintf (line, "%s*fsb*ItemsList.background: white", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
526 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
527 sprintf (line, "%s*fsb*background: grey75", myclass); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
528 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
529 sprintf (line, "%s*fsb.Text.fontList: %s", myclass, courier); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
530 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
531 sprintf (line, "%s*fsb.FilterText.fontList: %s", myclass, courier); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
532 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
533 sprintf (line, "%s*fsb*ItemsList.fontList: %s", myclass, courier); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
534 XrmPutLineResource (&rdb, line); |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
535 sprintf (line, "%s*fsb*DirList.fontList: %s", myclass, courier); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
536 XrmPutLineResource (&rdb, line); |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
537 |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
538 /* Set double click time of list boxes in the file selection |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
539 dialog from `double-click-time'. */ |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
540 if (INTEGERP (Vdouble_click_time) && XINT (Vdouble_click_time) > 0) |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
541 { |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
542 sprintf (line, "%s*fsb*DirList.doubleClickInterval: %d", |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
543 myclass, XFASTINT (Vdouble_click_time)); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
544 XrmPutLineResource (&rdb, line); |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
545 sprintf (line, "%s*fsb*ItemsList.doubleClickInterval: %d", |
33084
31fae82503f7
(x_load_resources): Use the class name in the defaults.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31829
diff
changeset
|
546 myclass, XFASTINT (Vdouble_click_time)); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
547 XrmPutLineResource (&rdb, line); |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
548 } |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
549 |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
550 #else /* not USE_MOTIF */ |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
551 |
29755
ab23e43de97d
(x_load_resources): Set default resources for resource
Dave Love <fx@gnu.org>
parents:
25749
diff
changeset
|
552 sprintf (line, "Emacs.dialog*.font: %s", helv); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
553 XrmPutLineResource (&rdb, line); |
29755
ab23e43de97d
(x_load_resources): Set default resources for resource
Dave Love <fx@gnu.org>
parents:
25749
diff
changeset
|
554 sprintf (line, "Emacs.dialog*.background: grey75"); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
555 XrmPutLineResource (&rdb, line); |
29755
ab23e43de97d
(x_load_resources): Set default resources for resource
Dave Love <fx@gnu.org>
parents:
25749
diff
changeset
|
556 sprintf (line, "*XlwMenu*font: %s", helv); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
557 XrmPutLineResource (&rdb, line); |
29755
ab23e43de97d
(x_load_resources): Set default resources for resource
Dave Love <fx@gnu.org>
parents:
25749
diff
changeset
|
558 sprintf (line, "*XlwMenu*background: grey75"); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
559 XrmPutLineResource (&rdb, line); |
29755
ab23e43de97d
(x_load_resources): Set default resources for resource
Dave Love <fx@gnu.org>
parents:
25749
diff
changeset
|
560 sprintf (line, "Emacs*verticalScrollBar.background: grey75"); |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
561 XrmPutLineResource (&rdb, line); |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
562 |
24992
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
563 #endif /* not USE_MOTIF */ |
f1632be03391
(x_load_resources): Set double-click time defaults
Gerd Moellmann <gerd@gnu.org>
parents:
24412
diff
changeset
|
564 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
565 user_database = get_user_db (display); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
566 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
567 /* Figure out what the "customization string" is, so we can use it |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
568 to decode paths. */ |
109687 | 569 xfree (x_customization_string); |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
570 x_customization_string |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
571 = x_get_customization_string (user_database, myname, myclass); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
572 |
159 | 573 /* Get application system defaults */ |
574 db = get_system_app (myclass); | |
575 if (db != NULL) | |
576 XrmMergeDatabases (db, &rdb); | |
577 | |
578 /* Get Fallback resources */ | |
579 db = get_fallback (display); | |
580 if (db != NULL) | |
581 XrmMergeDatabases (db, &rdb); | |
582 | |
583 /* Get application user defaults */ | |
584 db = get_user_app (myclass); | |
585 if (db != NULL) | |
586 XrmMergeDatabases (db, &rdb); | |
587 | |
588 /* get User defaults */ | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
589 if (user_database != NULL) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
590 XrmMergeDatabases (user_database, &rdb); |
159 | 591 |
592 /* Get Environment defaults. */ | |
593 db = get_environ_db (); | |
594 if (db != NULL) | |
595 XrmMergeDatabases (db, &rdb); | |
29803
3dec4cd5e361
Don't declare xmalloc, xrealloc.
Sam Steingold <sds@gnu.org>
parents:
29756
diff
changeset
|
596 |
159 | 597 /* Last, merge in any specification from the command line. */ |
598 if (xrm_string != NULL) | |
599 { | |
600 db = XrmGetStringDatabase (xrm_string); | |
601 if (db != NULL) | |
602 XrmMergeDatabases (db, &rdb); | |
603 } | |
604 | |
605 return rdb; | |
606 } | |
607 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
608 |
159 | 609 /* Retrieve the value of the resource specified by NAME with class CLASS |
610 and of type TYPE from database RDB. The value is returned in RET_VALUE. */ | |
611 | |
612 int | |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
613 x_get_resource (XrmDatabase rdb, const char *name, const char *class, XrmRepresentation expected_type, XrmValue *ret_value) |
159 | 614 { |
615 XrmValue value; | |
616 XrmName namelist[100]; | |
617 XrmClass classlist[100]; | |
618 XrmRepresentation type; | |
619 | |
620 XrmStringToNameList(name, namelist); | |
621 XrmStringToClassList(class, classlist); | |
622 | |
623 if (XrmQGetResource (rdb, namelist, classlist, &type, &value) == True | |
624 && (type == expected_type)) | |
625 { | |
626 if (type == x_rm_string) | |
1200
d2360c870787
* xrdb.c (x_get_resource): Cast the value being assigned to
Jim Blandy <jimb@redhat.com>
parents:
1126
diff
changeset
|
627 ret_value->addr = (char *) value.addr; |
159 | 628 else |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109139
diff
changeset
|
629 memcpy (ret_value->addr, value.addr, ret_value->size); |
159 | 630 |
631 return value.size; | |
632 } | |
633 | |
634 return 0; | |
635 } | |
636 | |
637 /* Retrieve the string resource specified by NAME with CLASS from | |
638 database RDB. */ | |
639 | |
640 char * | |
109555
05e7e7c46ff0
Use const, move declarations to header files.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
641 x_get_string_resource (XrmDatabase rdb, const char *name, const char *class) |
159 | 642 { |
643 XrmValue value; | |
644 | |
105069
4cbb223d0b1c
The --quick command line option now ignores X resources and Registry settings.
Juanma Barranquero <lekktu@gmail.com>
parents:
101091
diff
changeset
|
645 if (inhibit_x_resources) |
4cbb223d0b1c
The --quick command line option now ignores X resources and Registry settings.
Juanma Barranquero <lekktu@gmail.com>
parents:
101091
diff
changeset
|
646 /* --quick was passed, so this is a no-op. */ |
4cbb223d0b1c
The --quick command line option now ignores X resources and Registry settings.
Juanma Barranquero <lekktu@gmail.com>
parents:
101091
diff
changeset
|
647 return NULL; |
4cbb223d0b1c
The --quick command line option now ignores X resources and Registry settings.
Juanma Barranquero <lekktu@gmail.com>
parents:
101091
diff
changeset
|
648 |
159 | 649 if (x_get_resource (rdb, name, class, x_rm_string, &value)) |
650 return (char *) value.addr; | |
651 | |
652 return (char *) 0; | |
653 } | |
654 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
655 /* Stand-alone test facilities. */ |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
656 |
159 | 657 #ifdef TESTRM |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
658 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
659 typedef char **List; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
660 #define arg_listify(len, list) (list) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
661 #define car(list) (*(list)) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
662 #define cdr(list) (list + 1) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
663 #define NIL(list) (! *(list)) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
664 #define free_arglist(list) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
665 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
666 static List |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
667 member (elt, list) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
668 char *elt; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
669 List list; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
670 { |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
671 List p; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
672 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
673 for (p = list; ! NIL (p); p = cdr (p)) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
674 if (! strcmp (elt, car (p))) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
675 return p; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
676 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
677 return p; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
678 } |
159 | 679 |
680 static void | |
681 fatal (msg, prog, x1, x2, x3, x4, x5) | |
682 char *msg, *prog; | |
683 int x1, x2, x3, x4, x5; | |
684 { | |
685 if (errno) | |
686 perror (prog); | |
687 | |
688 (void) fprintf (stderr, msg, prog, x1, x2, x3, x4, x5); | |
689 exit (1); | |
690 } | |
691 | |
692 main (argc, argv) | |
693 int argc; | |
694 char **argv; | |
695 { | |
696 Display *display; | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
697 char *displayname, *resource_string, *class, *name; |
159 | 698 XrmDatabase xdb; |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
699 List arg_list, lp; |
159 | 700 |
701 arg_list = arg_listify (argc, argv); | |
702 | |
703 lp = member ("-d", arg_list); | |
704 if (!NIL (lp)) | |
705 displayname = car (cdr (lp)); | |
706 else | |
707 displayname = "localhost:0.0"; | |
708 | |
709 lp = member ("-xrm", arg_list); | |
710 if (! NIL (lp)) | |
711 resource_string = car (cdr (lp)); | |
712 else | |
713 resource_string = (char *) 0; | |
714 | |
715 lp = member ("-c", arg_list); | |
716 if (! NIL (lp)) | |
717 class = car (cdr (lp)); | |
718 else | |
719 class = "Emacs"; | |
720 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
721 lp = member ("-n", arg_list); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
722 if (! NIL (lp)) |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
723 name = car (cdr (lp)); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
724 else |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
725 name = "emacs"; |
159 | 726 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
727 free_arglist (arg_list); |
159 | 728 |
729 if (!(display = XOpenDisplay (displayname))) | |
730 fatal ("Can't open display '%s'\n", XDisplayName (displayname)); | |
731 | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
732 xdb = x_load_resources (display, resource_string, name, class); |
159 | 733 |
734 /* In a real program, you'd want to also do this: */ | |
735 display->db = xdb; | |
736 | |
737 while (1) | |
738 { | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
739 char query_name[90]; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
740 char query_class[90]; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
741 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
742 printf ("Name: "); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
743 gets (query_name); |
159 | 744 |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
745 if (strlen (query_name)) |
159 | 746 { |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
747 char *value; |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
748 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
749 printf ("Class: "); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
750 gets (query_class); |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
751 |
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
752 value = x_get_string_resource (xdb, query_name, query_class); |
159 | 753 |
754 if (value != NULL) | |
4232
f533d585cfc8
Implement search for app-defaults directory and
Jim Blandy <jimb@redhat.com>
parents:
3873
diff
changeset
|
755 printf ("\t%s(%s): %s\n\n", query_name, query_class, value); |
159 | 756 else |
757 printf ("\tNo Value.\n\n"); | |
758 } | |
759 else | |
760 break; | |
761 } | |
762 printf ("\tExit.\n\n"); | |
763 | |
764 XCloseDisplay (display); | |
765 } | |
766 #endif /* TESTRM */ | |
52401 | 767 |
768 /* arch-tag: 37e6fbab-ed05-4363-9e76-6c4109ed511f | |
769 (do not change this comment) */ |