summaryrefslogtreecommitdiff
path: root/x11/xplanet/patches/patch-ad
blob: e3b4c16c493628b5baadcaa3be5ea120f2de9773 (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
51
52
53
54
55
56
57
$NetBSD: patch-ad,v 1.1 2002/04/04 16:47:55 atatat Exp $

Add support for $XPLANET/images and $HOME/.xplanet/images images, etc.

--- util.cc.orig	Tue Jan 22 21:07:42 2002
+++ util.cc	Tue Apr  2 22:43:04 2002
@@ -28,6 +28,7 @@
 using namespace std;
 
 #include <errno.h>
+#include <stdlib.h>
 #include <sys/time.h>
 
 #include "auxfiles.h"
@@ -339,7 +340,41 @@
         filename = newname;
         return(true);
     }            
-    
+
+    char *xplanet = getenv("XPLANET");
+    if (xplanet != NULL)
+    {
+        newname = xplanet;
+        newname += separator;
+        newname += "images";
+        newname += separator;
+        newname += filename;
+
+        if (fileExists(newname))
+        {
+            filename = newname;
+            return(true);
+        }
+    }
+
+    char *home = getenv("HOME");
+    if (home != NULL)
+    {
+        newname = home;
+        newname += separator;
+        newname += ".xplanet";
+        newname += separator;
+        newname += "images";
+        newname += separator;
+        newname += filename;
+
+        if (fileExists(newname))
+        {
+            filename = newname;
+            return(true);
+        }
+    }
+
     newname = prefix;
     newname += separator;
     newname += "images";