[GRASS-dev] Re: g.rename consolidation

Glynn Clements glynn at gclements.plus.com
Fri Mar 2 01:21:43 EST 2007


Hamish wrote:

> > > Just one (I hope ;) ) question more: could I somehow disable
> > > module's progress output alone, still letting it print it's ERRORs,
> > > ie. not sending both it's sdout and stderr to /dev/null?
> > 
> > Currently, no. Supporting e.g. GRASS_MESSAGE_FORMAT=silent would be a
> > useful enhancement.
> 
> this little patch adds GRASS_MESSAGE_FORMAT=silent to error.c, but not
> for G_percent() as then it would need a global variable. Better to just
> put another getenv("GRASS_MESSAGE_FORMAT") and strcmp(,"silent") in
> percent.c and clicker.c? Anywhere else?

G_percent2() already calls G_info_format(), so it should only need
this:

--- lib/gis/percent.c	9 Jan 2007 12:30:08 -0000	2.9
+++ lib/gis/percent.c	2 Mar 2007 06:20:47 -0000
@@ -102,7 +102,7 @@
 	: (int) (100 * n / d);
 
     /* be verbose only 1> */
-    if (G_verbose() < 1)
+    if (format == G_INFO_FORMAT_SILENT || G_verbose() < 1)
         return 0;
 
     if (n <= 0 || n >= d || x > prev + s)

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list