[GRASS-dev] g.list -a
Martin Landa
landa.martin at gmail.com
Sat Jan 13 14:15:40 EST 2007
Glynn,
I committed changes to CVS.
Once more thanks a lot for the help and valuable feedback.
Martin
2007/1/13, Glynn Clements <glynn at gclements.plus.com>:
>
> Martin Landa wrote:
>
> > > + if (G_parser(argc, argv))
> > > + {
> > > + fprintf (stderr, _("\nWhere %s is one of:\n"), element->key);
> > > + show_elements();
> > > + exit(EXIT_FAILURE);
> > > + }
> > >
> > > If G_parser() fails, the program should just call exit(EXIT_FAILURE);
> > > G_parser() will print an error message detailing why it failed.
> >
> > Yes, but the function show_elements() provides the user additional
> > information why it failed. Would you like to remove it (maybe I have
> > missed something)?
> >
> > Where type is one of:
> > rast (raster files)
> > rast3d (raster3D files)
> > vect (binary vector files)
> > oldvect (old (GRASS 5.0) binary vector files)
> > asciivect (ascii vector files)
> > icon (paint icon files)
> > labels (paint label files)
> > sites (site list files)
> > region (region definition files)
> > region3d (region3D definition files)
> > group (imagery group files)
> > 3dview (3D view parameters)
>
> The built-in error handling will display the following message:
>
> Error: value <foo> out of range for parameter <type>
> Legal range: rast,rast3d,vect,oldvect,asciivect,icon,labels,sites,region,region3d,group,3dview
>
> IMHO, this is sufficient. Note that the type descriptions *aren't*
> shown if you use "g.list help", only if there is a parsing error
> (which isn't limited to an invalid value for the type= option).
>
> OTOH, I'm not really that bothered about this issue; assuming that it
> compiles okay, I'll commit your latest version.
>
> > > > > lib/do_list.c doesn't need to change; just have cmd/list.c call
> > > > > do_list() once for each type.
> > > >
> > > > I think that fn do_list() have to be rewritten because of the -f flags
> > > > (calling of execl() fn) ?
> > >
> > > No; do_list() can remain untouched, while the handling of -f should
> > > remain essentially the same, except that it should use G_spawn()
> > > instead of execl().
> >
> > Ops, you are right. Maybe I need study GRASS API more deeply:-) Thanks
> > for pointing to the G_spawn! Now it works.
>
> FWIW, I've added a native Windows version of G_spawn(), although I
> haven't had chance to test it yet.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
--
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
More information about the grass-dev
mailing list