[GRASS-SVN] r64413 - grass/trunk/general/g.gisenv

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 3 03:03:00 PST 2015


Author: martinl
Date: 2015-02-03 03:03:00 -0800 (Tue, 03 Feb 2015)
New Revision: 64413

Modified:
   grass/trunk/general/g.gisenv/main.c
Log:
g.gisenv: check for mandatory variable which cannot be unset


Modified: grass/trunk/general/g.gisenv/main.c
===================================================================
--- grass/trunk/general/g.gisenv/main.c	2015-02-03 10:58:21 UTC (rev 64412)
+++ grass/trunk/general/g.gisenv/main.c	2015-02-03 11:03:00 UTC (rev 64413)
@@ -9,7 +9,7 @@
  *               Markus Neteler <neteler itc.it>
  *               Martin Landa <landa.martin gmail.com>
  * PURPOSE:      
- * COPYRIGHT:    (C) 2003-2014 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2003-2015 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -165,6 +165,14 @@
         n = 0;
         while (unset_opt->answers[n]) {
             u_name = parse_variable(unset_opt->answers[n], &value);
+            if (G_strcasecmp(u_name, "GISDBASE") == 0 ||
+                G_strcasecmp(u_name, "LOCATION_NAME") == 0 ||
+                G_strcasecmp(u_name, "MAPSET") == 0) {
+              G_warning(_("Variable <%s> is mandatory. No operation performed."),
+                        u_name);
+              n++;
+              continue;
+            }
             if (value)
                 G_warning(_("Value '%s' ignored when unsetting the GRASS variable"),
                           value);



More information about the grass-commit mailing list