[GRASS-SVN] r30803 - grass/trunk/imagery/i.class

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 30 00:01:55 EDT 2008


Author: hamish
Date: 2008-03-30 00:01:55 -0400 (Sun, 30 Mar 2008)
New Revision: 30803

Modified:
   grass/trunk/imagery/i.class/main.c
Log:
remove @mapset part and test to see if the group is in the current mapset (trac bug #70)

Modified: grass/trunk/imagery/i.class/main.c
===================================================================
--- grass/trunk/imagery/i.class/main.c	2008-03-30 03:53:03 UTC (rev 30802)
+++ grass/trunk/imagery/i.class/main.c	2008-03-30 04:01:55 UTC (rev 30803)
@@ -36,6 +36,8 @@
 int main (int argc, char *argv[])
 {
     char *mapset;
+    char group[GNAME_MAX], grp_mapset[GMAPSET_MAX];
+
     struct Cell_head cellhd;
     struct GModule *module;
     struct Option *bg_map, *img_grp, *img_subgrp, *out_sig, *in_sig;
@@ -88,9 +90,23 @@
   if (G_maskfd() >= 0)
         G_fatal_error (_("You have a mask set. Unset mask and run again"));
 
+
+    /* check if current mapset:  (imagery libs are very lacking in this dept)
+	- abort if not,
+	- remove @mapset part if it is
+    */
+    if(G__name_is_fully_qualified(img_grp->answer, group, grp_mapset)) {
+	if(strcmp(grp_mapset, G_mapset()))
+	    G_fatal_error(_("Group must exist in the current mapset"));
+    }
+    else {
+	strcpy(group, img_grp->answer); /* FIXME for buffer overflow (have the parser check that?) */
+    }
+
     /* get group/subgroup, and signature files */
-    check_files (img_grp->answer, img_subgrp->answer, out_sig->answer, in_sig->answer);
+    check_files (group, img_subgrp->answer, out_sig->answer, in_sig->answer);
 
+
   /* initialize the Region structure */
     init_region (Region);
 



More information about the grass-commit mailing list