[GRASSLIST:8401] Using fully-qualified names with r.patch

Ralf Gerlich ralf.gerlich at bsse.biz
Sat Sep 24 13:45:19 EDT 2005


Hello all,

today's CVS version of r.patch seems to have problems with
fully-qualified names for input-maps. In the loop starting at main.c:94
the answers to the input-parameter are modified by G_find_file2 and the
mapset name is stripped off. This way support() only gets the stripped
names and will not find rasters whose mapset is not in the current
search path (verified by G_debug).

I have attached a patch for a quick fix, however I'm not sure if this
will work in general, so somebody should have a look on this.

BTW: Is there a symbolic constant for the maximum length of a mapset- or
map-name? I followed the example of the G__find_file-code, but
hardcoding this seems awkward to me.

Regards,
Ralf

-------------- next part --------------
? raster/r.patch/OBJ.i686-pc-linux-gnu
Index: raster/r.patch/main.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/raster/r.patch/main.c,v
retrieving revision 2.1
diff -u -r2.1 main.c
--- raster/r.patch/main.c	15 Jan 2005 11:18:13 -0000	2.1
+++ raster/r.patch/main.c	24 Sep 2005 17:17:26 -0000
@@ -23,7 +23,7 @@
     int row,nrows,ncols;
     int verbose;
     int ZEROFLAG;
-    char *name, *mapset;
+    char name[512], *mapset;
     char *new_name;
     char **names;
     char **ptr; 
@@ -87,7 +87,7 @@
             G_fatal_error ("%s - too many patch files. only %d allowed",
                             G_program_name(), MAXFILES);
 
-        name = *ptr;
+        strcpy(name,*ptr);
         mapset = G_find_cell2 (name, "");
         if (mapset == NULL)
         {



More information about the grass-user mailing list