[GRASS-SVN] r38778 - grass/branches/develbranch_6/raster/r.li/r.li.daemon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 18 06:14:40 EDT 2009


Author: hamish
Date: 2009-08-18 06:14:35 -0400 (Tue, 18 Aug 2009)
New Revision: 38778

Modified:
   grass/branches/develbranch_6/raster/r.li/r.li.daemon/daemon.c
Log:
strip away config file path if it is present and if it matches the config dir

Modified: grass/branches/develbranch_6/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.daemon/daemon.c	2009-08-18 09:07:47 UTC (rev 38777)
+++ grass/branches/develbranch_6/raster/r.li/r.li.daemon/daemon.c	2009-08-18 10:14:35 UTC (rev 38778)
@@ -57,6 +57,7 @@
     g = (g_areas) G_malloc(sizeof(struct generatore));
     l = (list) G_malloc(sizeof(struct lista));
     mypid = getpid();
+
     /* create report pipe */
     reportChannelName = G_tempfile();
     if (mkfifo(reportChannelName, 0644) == -1)
@@ -96,15 +97,23 @@
     /*open reportChannel */
     receiveChannel = open(reportChannelName, O_RDONLY, 0755);
 
+
     /*########################################################      
        -----------------create area queue----------------------
        ######################################################### */
 
+    /* strip off leading path if present */
+    char testpath[GPATH_MAX];
+    sprintf(testpath, "%s%s", G_home(), "/.r.li/history/");
+    if(strncmp(file, testpath, strlen(testpath)) == 0)
+	file += strlen(testpath);
+
     /* TODO: check if this path is portable */
     sprintf(pathSetup, "%s/.r.li/history/%s", G_home(), file);
     G_debug(1, "r.li.daemon pathSetup: [%s]", pathSetup);
     parsed = parseSetup(pathSetup, l, g, raster);
 
+
     /*########################################################
        -----------------open output file ---------------------
        ####################################################### */
@@ -366,7 +375,6 @@
 	    rel_sa_cl = atof(strtok(NULL, "\n"));
 
 	    if (rel_sa_x == -1.0 && rel_sa_y == -1.0) {
-
 		/* runtime disposition */
 
 		int sa_rl, sa_cl;
@@ -382,6 +390,7 @@
 		g->sf_y = sf_y;
 		g->x = sf_x;
 		g->y = sf_y;
+
 		return disposeAreas(l, g, strtok(NULL, "\n"));
 	    }
 	    else {



More information about the grass-commit mailing list