[GRASS-dev] Re: [GRASS5] [bug #4331] (grass) delete if file exist - flag

Cedric Shock cedricgrass at shockfamily.net
Sat May 6 19:47:10 EDT 2006


Hi,

>
> This (documentation) should be implemented into the parser.
> A way could be to check if a module used
>
> cd ~/grass61/lib/gis > grep OUTPUT parser.c
>         case G_OPT_R_OUTPUT:
>         case G_OPT_V_OUTPUT:

A simpler and more accurate way would be to check, in parser.c, if any of the 
options use a gisprompt of new,*. But this option really only works for c 
modules. The check_overwrite routine in parser.c will probably reject the map 
name again in modules called from a script that was passed the --o flag.

Scripts probably won't notice this nor pass it to modules that the script 
calls. I'm not sure if there's even a method for passing this back to the 
script from g.parser. There is a grass environment variable OVERWRITE that 
parser.c checks as well as the --o flag, but I don't think it's set for 
scripts run by g.parser. Should it be for consistency (seems dangerous)?

Perhaps it would be possible for parser.c to tell the difference between a 
call from g.parser and a call from other modules to produce this help output 
only for c grass modules that use new,*.

Anyway, I didn't find a simple change that won't produce false positives on 
scripts.

--Cedric




More information about the grass-dev mailing list