[GRASS-dev] Re: g.rename consolidation
Hamish
hamish_nospam at yahoo.com
Fri Mar 2 00:40:14 EST 2007
Glynn Clements 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?
Hamish
-------------- next part --------------
Index: include/gis.h
===================================================================
RCS file: /home/grass/grassrepository/grass6/include/gis.h,v
retrieving revision 1.39
diff -u -r1.39 gis.h
--- include/gis.h 18 Dec 2006 11:24:48 -0000 1.39
+++ include/gis.h 2 Mar 2007 05:31:28 -0000
@@ -180,6 +180,7 @@
/* Message format */
#define G_INFO_FORMAT_STANDARD 0 /* GRASS_MESSAGE_FORMAT=standard or not defined */
#define G_INFO_FORMAT_GUI 1 /* GRASS_MESSAGE_FORMAT=gui */
+#define G_INFO_FORMAT_SILENT 2 /* GRASS_MESSAGE_FORMAT=silent */
/* Icon types */
#define G_ICON_CROSS 0
Index: lib/gis/error.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/error.c,v
retrieving revision 1.15
diff -u -r1.15 error.c
--- lib/gis/error.c 22 Feb 2007 10:18:53 -0000 1.15
+++ lib/gis/error.c 2 Mar 2007 05:31:28 -0000
@@ -282,7 +282,8 @@
while (print_word(stderr,&w,&len,lead))
;
- if ( (type != MSG) && isatty(fileno(stderr))) { /* Bell */
+ if ( (type != MSG) && isatty(fileno(stderr))
+ && (grass_info_format == G_INFO_FORMAT_STANDARD) ) { /* Bell */
fprintf(stderr,"\7");
fflush (stderr);
if (!no_sleep)
@@ -503,7 +504,9 @@
if ( fstr && G_strcasecmp(fstr,"gui") == 0 )
grass_info_format = G_INFO_FORMAT_GUI;
- else
+ else if ( fstr && G_strcasecmp(fstr,"silent") == 0 )
+ grass_info_format = G_INFO_FORMAT_SILENT;
+ else
grass_info_format = G_INFO_FORMAT_STANDARD;
}
More information about the grass-dev
mailing list