[GRASS-SVN] r38779 - grass/trunk/raster/r.li/r.li.daemon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 18 06:17:32 EDT 2009


Author: hamish
Date: 2009-08-18 06:17:32 -0400 (Tue, 18 Aug 2009)
New Revision: 38779

Modified:
   grass/trunk/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 (merge from devbr6)

Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.c	2009-08-18 10:14:35 UTC (rev 38778)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.c	2009-08-18 10:17:32 UTC (rev 38779)
@@ -58,6 +58,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)
@@ -97,16 +98,24 @@
     /*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(), "/.grass7/r.li/");
+    if(strncmp(file, testpath, strlen(testpath)) == 0)
+	file += strlen(testpath);
+
     /* TODO: check if this path is portable */
 /* TODO: use G_rc_path() */
     sprintf(pathSetup, "%s/.grass7/r.li/%s", G_home(), file);
     G_debug(1, "r.li.daemon pathSetup: [%s]", pathSetup);
     parsed = parseSetup(pathSetup, l, g, raster);
 
+
     /*########################################################
        -----------------open output file ---------------------
        ####################################################### */
@@ -319,10 +328,6 @@
     int sf_x, sf_y, sf_rl, sf_cl;
     int size;
 
-    /* TODO: if present, strip away G_home()/.r.li/history/ path from string */
-    /*  ? if(strncmp(G_rc_path(), path, strlen(G_rc_path()) ) == 0)
-	?     path += strlen(G_rc_path());
-	? */
     if (stat(path, &s) != 0)
 	G_fatal_error(_("Cannot find configuration file <%s>"), path);
 
@@ -376,7 +381,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;
@@ -392,6 +396,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