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

Russell Nelson nelson at crynwr.com
Wed May 15 00:38:18 EDT 2002


Glynn Clements writes:
 > Russell Nelson wrote:
 > 
 > > The inter version of g.region has a call to G_usage() in die()
 > > commented out.
 > 
 > die() is in the "cmd" version of g.region, not the "inter" version.

Quite right, yes I meant the cmd version.

 > > Telling somebody that 
 > > something is an "** illegal value **" is almost completely useless to
 > > them.  Much better to explain what change is necessary to bring the
 > > value within bounds.
 > 
 > If die() is called, the error is that one of the values isn't in a
 > suitable format; G_usage() won't help here.

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();
     */

-- 
-russ nelson              http://russnelson.com | Okay, enough is enough!
Crynwr sells support for free software  | PGPok | Can we PLEASE all stop
521 Pleasant Valley Rd. | +1 315 268 1925 voice | using insecure Microsoft
Potsdam, NY 13676-3213  | +1 315 268 9201 FAX   | email products???



More information about the grass-dev mailing list