[GRASS-SVN] r63469 - in grass/trunk: display/d.mon lib/display

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 10 02:44:36 PST 2014


Author: martinl
Date: 2014-12-10 02:44:36 -0800 (Wed, 10 Dec 2014)
New Revision: 63469

Modified:
   grass/trunk/display/d.mon/start.c
   grass/trunk/lib/display/r_raster.c
Log:
d.mon: print warning when overwritting the output file


Modified: grass/trunk/display/d.mon/start.c
===================================================================
--- grass/trunk/display/d.mon/start.c	2014-12-10 10:05:56 UTC (rev 63468)
+++ grass/trunk/display/d.mon/start.c	2014-12-10 10:44:36 UTC (rev 63469)
@@ -28,10 +28,15 @@
         output_name = D_get_file();
         if (!output_name) 
             return;
-        if (!G_get_overwrite() && access(output_name, F_OK) == 0) {
-            D_close_driver();
-            G_fatal_error(_("option <%s>: <%s> exists."),
-                          "output", output_name);
+        if (access(output_name, F_OK) == 0) {
+            if (G_get_overwrite()) {
+                G_warning(_("File '%s' already exists and will be overwritten"), output_name);
+            }
+            else {
+                D_close_driver();
+                G_fatal_error(_("option <%s>: <%s> exists."),
+                              "output", output_name);
+            }
         }
         D_close_driver(); /* must be called after check because this
                            * function produces default map file */

Modified: grass/trunk/lib/display/r_raster.c
===================================================================
--- grass/trunk/lib/display/r_raster.c	2014-12-10 10:05:56 UTC (rev 63468)
+++ grass/trunk/lib/display/r_raster.c	2014-12-10 10:44:36 UTC (rev 63469)
@@ -111,32 +111,35 @@
     p = getenv("GRASS_RENDER_IMMEDIATE");
     m = G__getenv("MONITOR");
     
-    if (m && G_strncasecmp(m, "wx", 2) == 0) {
-	/* wx monitors always use GRASS_RENDER_IMMEDIATE. */
-	p = NULL; /* use default display driver */
-    } else if (m) {
-	char *env;
-	const char *v;
-	char *u_m;
-	
-	if (p)
-	    G_warning(_("%s variable defined, %s ignored"),
-		      "MONITOR", "GRASS_RENDER_IMMEDIATE");
-	/* GRASS variable names should be upper case. */
-	u_m = G_store_upper(m);
+    if (m) {
+        char *env;
+        const char *v;
+        char *u_m;
+        
+        /* GRASS variable names should be upper case. */
+        u_m = G_store_upper(m);
 
-	env = NULL;
-	G_asprintf(&env, "MONITOR_%s_MAPFILE", u_m);
-	v = G__getenv(env);
-	p = m;
-
-	if (v)
+        env = NULL;
+        G_asprintf(&env, "MONITOR_%s_MAPFILE", u_m);
+        v = G__getenv(env);
+        
+        if (v)
             G_putenv("GRASS_RENDER_FILE", v);
-        
-	G_asprintf(&env, "MONITOR_%s_ENVFILE", u_m);
-	v = G__getenv(env);
-	if (v) 
-	    read_env_file(v);
+                
+        if (G_strncasecmp(m, "wx", 2) == 0) {
+            /* wx monitors always use GRASS_RENDER_IMMEDIATE. */
+            p = NULL; /* use default display driver */
+        } else {
+            if (p)
+                G_warning(_("%s variable defined, %s ignored"),
+                          "MONITOR", "GRASS_RENDER_IMMEDIATE");
+            p = m;            
+            
+            G_asprintf(&env, "MONITOR_%s_ENVFILE", u_m);
+            v = G__getenv(env);
+            if (v) 
+                read_env_file(v);
+        }
     }
     
     const struct driver *drv =



More information about the grass-commit mailing list