[GRASS-SVN] r45647 - in grass/branches/develbranch_6/lib: gis init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 12 14:42:00 EST 2011


Author: martinl
Date: 2011-03-12 11:41:59 -0800 (Sat, 12 Mar 2011)
New Revision: 45647

Modified:
   grass/branches/develbranch_6/lib/gis/error.c
   grass/branches/develbranch_6/lib/init/variables.html
Log:
libgis: fix G_INFO_FORMAT_SILENT/PLAIN (printing messages to stderr)
(merge r45646 from trunk)


Modified: grass/branches/develbranch_6/lib/gis/error.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/error.c	2011-03-12 19:09:11 UTC (rev 45646)
+++ grass/branches/develbranch_6/lib/gis/error.c	2011-03-12 19:41:59 UTC (rev 45647)
@@ -3,7 +3,7 @@
  * 
  * \brief GIS Library: Error messages functions
  *
- * (C) 1999-2008 by the GRASS Development Team
+ * (C) 1999-2009, 2011 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
@@ -267,22 +267,29 @@
 	ext_error(msg, fatal);
     }
     else {
-	char *w;
-	int len, lead;
-
 	format = G_info_format();
-
+	if (format == G_INFO_FORMAT_SILENT)
+	    return;
+	
 	if (format != G_INFO_FORMAT_GUI) {
 	    if (type == WARN || type == ERR) {
 		log_error(msg, fatal);
 	    }
 
-	    fprintf(stderr, "%s", prefix_std[type]);
-	    len = lead = strlen(prefix_std[type]);
-	    w = (char *)msg;
+	    if (format != G_INFO_FORMAT_PLAIN) {
+		char *w;
+		int len, lead;
+		
+		fprintf(stderr, "%s", prefix_std[type]);
+		len = lead = strlen(prefix_std[type]);
+		w = (char *)msg;
+		
+		while (print_word(stderr, &w, &len, lead)) ;
+	    }
+	    else {
+		fprintf(stderr, "%s\n", msg);
+	    }
 
-	    while (print_word(stderr, &w, &len, lead)) ;
-
 	    if ((type != MSG) && isatty(fileno(stderr))
 		&& (G_info_format() == G_INFO_FORMAT_STANDARD)) {	/* Bell */
 		fprintf(stderr, "\7");

Modified: grass/branches/develbranch_6/lib/init/variables.html
===================================================================
--- grass/branches/develbranch_6/lib/init/variables.html	2011-03-12 19:09:11 UTC (rev 45646)
+++ grass/branches/develbranch_6/lib/init/variables.html	2011-03-12 19:41:59 UTC (rev 45647)
@@ -171,22 +171,6 @@
       The signature is the <string> following the <key>,
     without the bracketing &lt;string&gt; tags.</dd>
 
-  <dt>G_INFO_FORMAT_STANDARD</dt>
-  <dd>[init.sh, wxgui]<br>
-    sets percentage output and message formatting style to standard formatting.</dd>
-
-  <dt>G_INFO_FORMAT_GUI</dt>
-  <dd>[init.sh, wxgui]<br>
-    sets percentage output and message formatting style to GUI formatting.</dd>
-
-  <dt>G_INFO_FORMAT_SILENT</dt>
-  <dd>[init.sh, wxgui]<br>
-    disables percentage output and error messages.</dd>
-
-  <dt>G_INFO_FORMAT_PLAIN</dt>
-  <dd>[init.sh, wxgui]<br>
-    sets percentage output and message formatting style to ASCII output without rewinding control characters.</dd>
- 
   <dt>GRASS_INT_ZLIB</dt>
   <dd>[libgis]<br>
     if the environment variable GRASS_INT_ZLIB exists, new compressed
@@ -199,9 +183,19 @@
   </dd>
   
   <dt>GRASS_MESSAGE_FORMAT</dt>
-  <dd>[various modules]<br>
-    maybe set to either <tt>standard</tt> or <tt>gui</tt> (normally
-    GRASS takes care).</dd>
+  <dd>[various modules, wxGUI]<br>
+    maybe set to either
+    <ul>
+      <li><tt>standard</tt> - sets percentage output and message
+	formatting style to standard formatting,</li>
+      <li><tt>gui</tt> - sets percentage output and message formatting
+	style to GUI formatting,</li>
+      <li><tt>silent</tt> - disables percentage output and error
+	messages,</li>
+      <li><tt>plain</tt> - sets percentage output and message
+	formatting style to ASCII output without rewinding control
+	characters.</li>
+  </ul></dd>
   
   <dt>GRASS_MOUSE_BUTTON</dt>
   <dd>[various modules]<br>



More information about the grass-commit mailing list