[GRASS5] Inconsistencies among modules

Frank Warmerdam warmerdam at pobox.com
Wed Aug 8 20:35:58 EDT 2001

Helena wrote:

>Frank Warmerdam wrote:
>>Rich Shepard wrote:
>>> Two inconsistencies I've picked up:
>>> 1)  Some modules (e.g., r.in.gdal, r.patch) allow the use of an existing
>>>output file name with no warning that that file already exists, and asking
>>>the user if it's OK to overwrite it. Other modules (e.g., r.poly, v.digit)
>>>tell the user that the output file name exists, does not ask for directions,
>>>and refuses to let the user overwrite it. Recommendation: always check,
>>>always ask, follow the user's directions.
>>What would the normal mechanism be to ask the user if they want to overwrite
>>an existing raster layer?
>r.mapcalc does it the right way, most of other programs don't
>mapcalc> diff=owhusle-owhusle.rst
>diff - already exists. ok to overwrite? (y/n)


For reference, r.mapcalc only prompts if it is in interactive mode, which it
determines using "interactive = isatty(0)".  It uses
"G_find_file ("cell",result,G_mapset())" to test if the raster already 
and G_yes() to test for a user response.

I presume it just overwrites silently if not in interactive mode.

As someone (email already deleted!) pointed out, G_parser() actually 
does this
sort of existance test if it prompts for the raster name, but not if 
supplied on
the command line.  Should we look at fixing G_parser() to check for command
line arguments too instead of trying to build alot of logic into each 

If so, should we leave this for post 5.0? I hate to make dramatic system 
changes shortly before a release.

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the grass-dev mailing list