[GRASS5] g.region G_usage() commented out?

Eric G. Miller egm2 at jps.net
Wed May 15 02:15:31 EDT 2002


On Wed, May 15, 2002 at 12:38:18AM -0400, Russell Nelson wrote:
[snip]
> What about changing die() so that it also prints the ->description
> string?  Like the diff below?  It's not perfect, but it's an
> improvement.
> 
> diff -u -r1.8 main.c
> --- src/general/g.region/cmd/main.c     22 Jan 2002 04:51:04 -0000      1.8
> +++ src/general/g.region/cmd/main.c     15 May 2002 04:34:35 -0000
> @@ -704,7 +704,7 @@
>  
>  static void die(struct Option *parm)
>  {
> -       fprintf(stderr,"<%s=%s> ** illegal value **\n\n", parm->key, parm->answer);
> +       fprintf(stderr,"<%s=%s> not recognized, expecting:\n%s\n", parm->key, parm->answer, parm->description);
>         /*
>      G_usage();
>      */

I'm not sure that adds anything to the error report.  

On a general note, would it be desirable to have G_{lat|lon|llres}_scan
fall back to reading doubles and then range check the value?

Nitpick: I dislike "illegal value". IMHO, "invalid input" is more
"correct" since the law has nothing to do with the matter.  Also, no
good reason not to use G_fatal_error() here.  Technically, exit(1) is
not well defined either (exit(EXIT_FAILURE) is).

-- 
Eric G. Miller <egm2 at jps.net>



More information about the grass-dev mailing list