[GRASS-SVN] r55841 - grass/branches/develbranch_6/general/g.region
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 17 01:18:31 PDT 2013
Author: hamish
Date: 2013-04-17 01:18:31 -0700 (Wed, 17 Apr 2013)
New Revision: 55841
Modified:
grass/branches/develbranch_6/general/g.region/main.c
Log:
allow fully qual'd region name as inputfor the save= option (as long as it's the current mapset), #1371
Modified: grass/branches/develbranch_6/general/g.region/main.c
===================================================================
--- grass/branches/develbranch_6/general/g.region/main.c 2013-04-17 06:31:43 UTC (rev 55840)
+++ grass/branches/develbranch_6/general/g.region/main.c 2013-04-17 08:18:31 UTC (rev 55841)
@@ -838,12 +838,21 @@
/* save= */
if ((name = parm.save->answer)) {
- if (G_legal_filename(name) < 0)
- G_fatal_error(_("<%s> is an illegal region name"), name);
+ char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
+
+ G_unqualified_name(name, "", xname, xmapset);
+
+ if(strlen(xmapset) && strcmp(G_mapset(), xmapset) != 0)
+ G_fatal_error(_("You can only save to the current mapset"));
+
+ if (G_legal_filename(xname) < 0)
+ G_fatal_error(_("<%s> is an illegal region name"), xname);
+
G_copy(&temp_window, &window, sizeof(window));
adjust_window(&temp_window, 0, 0, 0);
- if (G__put_window(&temp_window, "windows", name) < 0)
- G_fatal_error(_("Unable to set region <%s>"), name);
+
+ if (G__put_window(&temp_window, "windows", xname) < 0)
+ G_fatal_error(_("Unable to set region <%s>"), xname);
}
adjust_window(&window, row_flag, col_flag, 0);
More information about the grass-commit
mailing list