[GRASS-dev] making grass modules less verbose

Brad Douglas rez at touchofmadness.com
Fri Sep 22 19:11:35 EDT 2006


On Fri, 2006-09-22 at 17:12 +0100, Glynn Clements wrote:
> Brad Douglas wrote:
> 
> > > > A smaller issue is that of '\n'.  G_message("\n") doesn't work well and
> > > > the alternative has been to use:
> > > > 
> > > > fprintf(stderr, "\n");
> > > > 
> > > > Going quiet may yield an extraneous number of CRs depending on the
> > > > module...
> > > 
> > > Can you clarify.
> > > 
> > > G_message() ought to terminate anything it writes.
> > 
> > I was thinking of the many loops that output text.  After the loop is
> > finished, there is usually a single CR after the loop:
> > 
> > fprintf(stderr, "\n");
> > 
> > For the loops that use fprintf() throughout, it won't be a major
> > inconvenience (it just won't shut up :-), but for loops that use
> > G_message(), you'll probably end up with a few extra CRs output to
> > stderr...
> 
> Anything which is using fprintf(stderr, ...) should be changed to use
> G_message() instead. Then the problem goes away, right?

G_message("\n") = '\n\n' on screen.  G_message(" ") seems a bit obscure.
But yes, that particular problem would go away, but potentially creating
a new one.

Also, in loops outputting text, G_message() is generally not desirable
because of it's "auto-CR" feature.

Would be better to add a function [eg. G_message2()] that does not
automatically append '\n' to text?


-- 
Brad Douglas <rez touchofmadness com>                      KB8UYR
Address: 37.493,-121.924 / WGS84    National Map Corps #TNMC-3785




More information about the grass-dev mailing list