[GRASS-SVN] r60207 - grass/trunk/display/d.mon

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 11 20:18:01 PDT 2014


Author: hcho
Date: 2014-05-11 20:18:01 -0700 (Sun, 11 May 2014)
New Revision: 60207

Modified:
   grass/trunk/display/d.mon/start.c
Log:
Prevent starting the same monitor multiple times.

d.mon start=wx0
d.mon start=wx1
d.mon start=wx0 # Creates another wx0 monitor rather than selecting the
		# existing one.



Modified: grass/trunk/display/d.mon/start.c
===================================================================
--- grass/trunk/display/d.mon/start.c	2014-05-12 02:05:05 UTC (rev 60206)
+++ grass/trunk/display/d.mon/start.c	2014-05-12 03:18:01 UTC (rev 60207)
@@ -58,16 +58,21 @@
 	      int width, int height, const char *bgcolor,
 	      int truecolor)
 {
-    const char *curr_mon;
     char *u_name;
     char *env_name, *env_value, *cmd_value;
     char *tempfile, buf[1024];
     int env_fd;
-    
-    curr_mon = G__getenv("MONITOR");
-    if (curr_mon && strcmp(curr_mon, name) == 0 && check_mon(curr_mon))
-	G_fatal_error(_("Monitor <%s> already running"), name);
-    
+
+    if (check_mon(name)) {
+        const char *curr_mon;
+
+        curr_mon = G__getenv("MONITOR");
+	if (select && (!curr_mon || strcmp(curr_mon, name) != 0))
+	    G_setenv("MONITOR", name);
+
+        G_fatal_error(_("Monitor <%s> already running"), name);
+    }
+
     tempfile = G_tempfile();
 
     u_name = G_store_upper(name);



More information about the grass-commit mailing list