[GRASS-dev] g.list -a

Martin Landa landa.martin at gmail.com
Sat Jan 13 05:29:28 EST 2007


Hi Glynn,

2007/1/12, Glynn Clements <glynn at gclements.plus.com>:

[snip]

> +       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)

> > > 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.

Regards, Martin

-- 
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: g_list_all-6.diff.gz
Type: application/x-gzip
Size: 2161 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070113/a1ea0171/g_list_all-6.diff.gz


More information about the grass-dev mailing list