Hallo,
since nobody complained, i commited the "verbosity" patch for g.remove
to cvs.
if there will be no objections, i'll rewrite g.copy and g.rename on
similar way
one question: in cmd/remove.c, lines 61 to 64 list of raster files is
printed to stderr:
G_warning(
_("[%s@%s] is a base map. Remove reclassed map%s first:"),
name, mapset, (nrmaps > 1 ? "s" : ""));
fprintf(stderr, " %s", *rmaps);
for(rmaps++; *rmaps; rmaps++)
fprintf(stderr, ",%s", *rmaps);
fprintf(stderr, "\n");
which leds to
g.remove rast=pokus
WARNING: [pokus@jachym] is a base map. Remove reclassed map first:
tmp@jachym
would it make sence, rewrite this fprintfs to G_warning too, so the
result would be:
WARNING: [pokus@jachym] is a base map. Remove reclassed map first:
WARNING: tmp@jachym
?
jachym
----- Forwarded message from Jachym Cepicky <jachym.cepicky@centrum.cz> -----
From: Jachym Cepicky <jachym.cepicky@centrum.cz>
Subject: Re: [GRASS-dev] making grass modules less verbose
Date: Sat, 23 Sep 2006 23:23:48 +0200
To: grass-dev@grass.itc.it
I tryed to rewrite g.remove, so it can be managed via --v/--q flags.
could anybody review this patch (grass6/general/manage/lib/do_remove.c)?
it works but i'm shure, G_messge() text could be generated on some
better way.
ones this is done, I'll look at do_rename.c & friends.
thanks
jachym
On Sat, Sep 23, 2006 at 01:23:38PM +0100, Glynn Clements wrote:
Brad Douglas wrote:
> > 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?Are you referring to:
a) printing multiple strings without newlines, then adding a newline
at the end, orb) including blank lines in the output, or
c) something else?
I don't consider either a) or b) to be sufficiently important to
justify bypassing G_message() in favour of explicit fprintf() calls.--
Glynn Clements <glynn@gclements.plus.com>_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev
--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
-----------------------------------------
OFFICE:
GDF-Hannover
Mengendamm 16d
30177 Hannover
Germany
e-mail: cepicky@gdf-hannover.de
URL: http://gdf-hannover.de
Tel.: +49 511-39088507
Index: do_remove.c
RCS file: /grassrepository/grass6/general/manage/lib/do_remove.c,v
retrieving revision 1.6
diff -u -r1.6 do_remove.c
--- do_remove.c 3 May 2006 09:46:33 -0000 1.6
+++ do_remove.c 23 Sep 2006 21:22:53 -0000
@@ -15,7 +15,7 @@
char *mapset;
int result = 0;
- fprintf (stdout,"REMOVE [%s]\n", old);
+ G_message ("REMOVE [%s]", old);
len = get_description_len(n);
@@ -29,22 +29,25 @@
result = 1;
}
} else {
- for (i = 0; i < list[n].nelem; i++)
- {
- fprintf (stdout," %-*s ", len, list[n].desc[i]);
- fflush (stdout);
+ if ((mapset = G_find_cell2 (old, "")) == NULL)
+ G_fatal_error(_("Raster file <%s> not found"), old);
+
+ for (i = 0; i < list[n].nelem; i++) {
+
switch (G_remove (list[n].element[i], old))
{
case -1:
- fprintf (stdout,"COULD NOT REMOVE");
+ G_warning (" %-*s %s", len, list[n].desc[i],_("COULD NOT REMOVE"));
result = 1;
break;
case 0:
- fprintf (stdout,"MISSING");
+ G_message (" %-*s %s", len, list[n].desc[i],_("MISSING"));
+ break;
+ case 1:
+ G_message (" %-*s ", len, list[n].desc[i]);
break;
}
- fprintf (stdout,"\n");
}
}
if (strcmp (list[n].element[0], "cell") == 0)
_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev
----- End forwarded message -----
--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
-----------------------------------------
OFFICE:
GDF-Hannover
Mengendamm 16d
30177 Hannover
Germany
e-mail: cepicky@gdf-hannover.de
URL: http://gdf-hannover.de
Tel.: +49 511-39088507