summaryrefslogtreecommitdiff
blob: 025226dd367a53e715b3666395f70e9b49d1a240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff -ur core/make/user_home.c core-adc/make/user_home.c
--- user_home.c	2004-02-23 23:02:41.000000000 -0500
+++ user_home.c	2004-08-18 09:34:23.755365944 -0400
@@ -316,6 +316,8 @@
 
       if (*user == '\0' || forceU == 0 || *defs == '\0' || forceD == 0)
 	{
+          char *env_var;
+
 	  strcpy(path, home);
 	  strcat(path, SEP);
 	  strcat(path, ".GNUsteprc");
@@ -381,6 +383,21 @@
 		}
 	      fclose(fptr);
 	    }
+#if !defined(__MINGW__)
+            /* if specified in the environment, as long as system does not override,
+             * observe user environment variables for USER and DEFAULTS here
+             */
+	    if((0 == forceU) && (NULL != (env_var = getenv("GNUSTEP_USER_ROOT"))))
+            {
+		user = malloc(strlen(env_var) + 1);
+            	strcpy(user, env_var);
+	    }
+	    if((0 == forceD) && (NULL != (env_var = getenv("GNUSTEP_DEFAULTS_ROOT"))))
+            {
+		defs = malloc(strlen(env_var) + 1);
+            	strcpy(defs, env_var);
+	    }
+#endif
 	}
 
       if (type == DEFS)
@@ -402,6 +419,15 @@
 	  strcat(path, SEP);
 	  strcat(path, "GNUstep");
 	}
+
+      if (*defs != '\0')
+        {
+          free(defs);
+        }
+      if (*user != '\0')
+        {
+          free(user);
+        }
     }
 #if defined(__MINGW__)
   /*