[GRASS-SVN] r37806 - grass/trunk/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 10 09:32:43 EDT 2009


Author: hamish
Date: 2009-06-10 09:32:43 -0400 (Wed, 10 Jun 2009)
New Revision: 37806

Modified:
   grass/trunk/ps/ps.map/r_plt.c
   grass/trunk/ps/ps.map/r_vareas.c
Log:
expand $GISBASE if present in eps filename (merge from devbr6)

Modified: grass/trunk/ps/ps.map/r_plt.c
===================================================================
--- grass/trunk/ps/ps.map/r_plt.c	2009-06-10 13:30:34 UTC (rev 37805)
+++ grass/trunk/ps/ps.map/r_plt.c	2009-06-10 13:32:43 UTC (rev 37806)
@@ -106,7 +106,7 @@
 
 int read_eps(double e, double n)
 {
-    char buf[1024];
+    char buf[1024], eps_file[GPATH_MAX];
     char *eps;
     double scale, rotate;
     int have_eps;
@@ -140,7 +140,18 @@
 
 	if (KEY("epsfile")) {
 	    G_chop(data);
-	    eps = G_store(data);
+
+	    /* expand "$GISBASE" if present */
+	    if (strncmp(data, "$GISBASE", 8) != 0)
+		strcpy(eps_file, data);
+	    else {
+		strcpy(eps_file, G_gisbase());
+		data += 8;
+		strcat(eps_file, data);
+	    }
+
+	    eps = G_store(eps_file);
+
 	    /* test if file is accessible */
 	    if ((fp = fopen(eps, "r")) == NULL)
 		error(key, data, "Can't open eps file");

Modified: grass/trunk/ps/ps.map/r_vareas.c
===================================================================
--- grass/trunk/ps/ps.map/r_vareas.c	2009-06-10 13:30:34 UTC (rev 37805)
+++ grass/trunk/ps/ps.map/r_vareas.c	2009-06-10 13:32:43 UTC (rev 37806)
@@ -34,7 +34,7 @@
 int read_vareas(char *name, char *mapset)
 {
     char fullname[GNAME_MAX + GMAPSET_MAX + 5];
-    char buf[1024];
+    char buf[1024], eps_file[GPATH_MAX];
     char *key, *data;
     double width;
     int itmp, vec;
@@ -172,7 +172,17 @@
 
 	if (KEY("pat") || KEY("pattern")) {
 	    G_chop(data);
-	    vector.layer[vec].pat = G_store(data);
+
+	    /* expand "$GISBASE" if present */
+	    if (strncmp(data, "$GISBASE", 8) != 0)
+		strcpy(eps_file, data);
+	    else {
+		strcpy(eps_file, G_gisbase());
+		data += 8;
+		strcat(eps_file, data);
+	    }
+
+	    vector.layer[vec].pat = G_store(eps_file);
 	    continue;
 	}
 



More information about the grass-commit mailing list