[GRASS-dev] howto rewrite r.colors using G_message and G_warning

Hamish hamish_nospam at yahoo.com
Wed Sep 27 07:16:12 EDT 2006


Jachym Cepicky wrote:
> 
> in error.c print_error() uses G_sleep(5) which makes the module sleep
> about 5 seconds when the warning is printed out:
> 
> echo "1 233:233:443"|r.colors map=pokus color=rules --q
> WARNING: R:G:B value(s) out of range [0..255]: 233:233:443
> (5 seconds )
> WARNING: rule is not added
> (another 5 seconds )
> 
> Is there a way, how to omit this sleeping function or is usage of
> G_warning on this place in general wrong approach?


5 sec is a bit long to wait. 3 might be better. You get a prompt back
just as you figure out what you did and start to get annoyed.

to avoid sleep on error there is G_sleep_on_error(), I don't know if
it's used. (lib/gis/error.c)

If GRASS should beep, or sleep, or email, or log to GIS_ERROR_LOG, or
just display "ERROR" or "WARNING" when an error is found, this is
another question.


Hamish




More information about the grass-dev mailing list