[GRASS-SVN] r32395 - in grass/branches/develbranch_6: lib/vector/Vlib vector/v.random

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 31 01:48:39 EDT 2008


Author: martinl
Date: 2008-07-31 01:48:39 -0400 (Thu, 31 Jul 2008)
New Revision: 32395

Modified:
   grass/branches/develbranch_6/lib/vector/Vlib/open.c
   grass/branches/develbranch_6/vector/v.random/main.c
Log:
glynn: Allow fully qualified names in Vect_open_new()
Don't call G_legal_filename() on qualified names
(merged from trunk, r32389)


Modified: grass/branches/develbranch_6/lib/vector/Vlib/open.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/open.c	2008-07-31 00:36:39 UTC (rev 32394)
+++ grass/branches/develbranch_6/lib/vector/Vlib/open.c	2008-07-31 05:48:39 UTC (rev 32395)
@@ -481,6 +481,7 @@
 {
     int  ret, ferror;
     char errmsg[2000], buf[200];
+    char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
 
     G_debug ( 2, "Vect_open_new(): name = %s", name);
     
@@ -488,6 +489,16 @@
     ferror = Vect_get_fatal_error ();
     Vect_set_fatal_error (GV_FATAL_EXIT);
 
+    if (G__name_is_fully_qualified(name, xname, xmapset))
+    {
+	if (strcmp(xmapset, G_mapset()) != 0)
+	{
+	    sprintf ( errmsg, _("%s is not in the current mapset (%s)"), name, G_mapset());
+	    fatal_error (ferror , errmsg );
+	}
+	name = xname;
+    }
+
     /* check for [A-Za-z][A-Za-z0-9_]* in name */
     if (Vect_legal_filename(name) < 0 ) {
        sprintf ( errmsg, _("Vector map name is not SQL compliant") );

Modified: grass/branches/develbranch_6/vector/v.random/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.random/main.c	2008-07-31 00:36:39 UTC (rev 32394)
+++ grass/branches/develbranch_6/vector/v.random/main.c	2008-07-31 05:48:39 UTC (rev 32395)
@@ -119,11 +119,6 @@
     n = atoi(parm.nsites->answer);
     b = (flag.drand48->answer == '\0') ? 0 : 1;
 
-    if (G_legal_filename(output) == -1) {
-	G_fatal_error(_("<%s> is an illegal file name"),
-		      output);
-    }
-
     if (n <= 0) {
 	G_fatal_error(_("Number of points must be > 0 (%d given)"),
 		      n);



More information about the grass-commit mailing list