- up to 1.0.0
[packages/aterm.git] / aterm-home_etc.patch
CommitLineData
e421fc46 1diff -Nru aterm-0.4.2/src/xdefaults.c aterm-0.4.2.new/src/xdefaults.c
2--- aterm-0.4.2/src/xdefaults.c Thu Sep 6 16:38:07 2001
3+++ aterm-0.4.2.new/src/xdefaults.c Sun Mar 23 13:01:37 2003
4@@ -957,21 +957,38 @@
5 # else /* USE_XGETDEFAULT */
6 /* get resources the hard way, but save lots of memory */
7 const char *fname[] = { ".Xdefaults", ".Xresources" };
8+ const char *fname2[] = { "Xdefaults", "Xresources" };
9 FILE *fd = NULL;
10 char *home;
11+ char *config_dir = getenv("CONFIG_DIR");
12+
13+ if (config_dir != NULL) {
14+ int i, len = strlen(config_dir) + 2;
15+ char *f = NULL;
16
17- if ((home = getenv("HOME")) != NULL) {
18- int i, len = strlen(home) + 2;
19- char *f = NULL;
20-
21- for (i = 0; i < (sizeof(fname) / sizeof(fname[0])); i++) {
22- f = REALLOC(f, (len + strlen(fname[i])) * sizeof(char));
23-
24- sprintf(f, "%s/%s", home, fname[i]);
25-
26- if ((fd = fopen(f, "r")) != NULL)
27- break;
28- }
29+ for (i = 0; i < (sizeof(fname2) / sizeof(fname2[0])); i++) {
30+ f = REALLOC(f, (len + strlen(fname2[i])) * sizeof(char));
31+
32+ sprintf(f, "%s/%s", config_dir, fname2[i]);
33+
34+ if ((fd = fopen(f, "r")) != NULL)
35+ break;
36+ }
37+ } else {
38+
39+ if ((home = getenv("HOME")) != NULL) {
40+ int i, len = strlen(home) + 2;
41+ char *f = NULL;
42+
43+ for (i = 0; i < (sizeof(fname) / sizeof(fname[0])); i++) {
44+ f = REALLOC(f, (len + strlen(fname[i])) * sizeof(char));
45+
46+ sprintf(f, "%s/%s", home, fname[i]);
47+
48+ if ((fd = fopen(f, "r")) != NULL)
49+ break;
50+ }
51+ }
52 FREE(f);
53 }
54 /*
This page took 0.075964 seconds and 4 git commands to generate.