[GRASS-dev] [GRASS-SVN] r72590 - grass/trunk/general/g.region

Martin Landa landa.martin at gmail.com
Fri Apr 6 00:20:53 PDT 2018


Hi Jachym,

2018-04-05 22:57 GMT+02:00 Markus Metz <markus.metz.giswork at gmail.com>:
> I agree with Martin, the commit does not make sense, and you should revert
> the commit yourself.

agreed with MarkusM, could you revert it please. Thanks, Martin

>>> committing change into trunk
>>>
>>> Consider reverting this change. g.list functionality is not suitable
>>> for your need?
>>>
>>> Thanks for clarification, Martin
>>>
>>> >
>>> > Modified: grass/trunk/general/g.region/local_proto.h
>>> > ===================================================================
>>> > --- grass/trunk/general/g.region/local_proto.h  2018-04-03 10:43:37 UTC
>>> > (rev 72589)
>>> > +++ grass/trunk/general/g.region/local_proto.h  2018-04-05 10:16:14 UTC
>>> > (rev 72590)
>>> > @@ -12,6 +12,7 @@
>>> >  #define PRINT_NANGLE 0x100
>>> >  #define PRINT_GMT    0x200
>>> >  #define PRINT_WMS    0x400
>>> > +#define PRINT_WF     0x800
>>> >
>>> >  /* zoom.c */
>>> >  int zoom(struct Cell_head *, const char *, const char *);
>>> >
>>> > Modified: grass/trunk/general/g.region/main.c
>>> > ===================================================================
>>> > --- grass/trunk/general/g.region/main.c 2018-04-03 10:43:37 UTC (rev
>>> > 72589)
>>> > +++ grass/trunk/general/g.region/main.c 2018-04-05 10:16:14 UTC (rev
>>> > 72590)
>>> > @@ -13,6 +13,7 @@
>>> >   *             Read the file COPYING that comes with GRASS for
>>> > details.
>>> >
>>> > ****************************************************************************/
>>> >
>>> > +#include <dirent.h>
>>> >  #include <string.h>
>>> >  #include <stdlib.h>
>>> >  #include <math.h>
>>> > @@ -39,8 +40,11 @@
>>> >      const char *value;
>>> >      const char *name;
>>> >      const char *mapset;
>>> > +    char *windows_path = G_malloc(1024);
>>> >      char **rast_ptr, **vect_ptr;
>>> >      int pix;
>>> > +    DIR *d;
>>> > +    struct dirent *dir;
>>> >
>>> >      struct GModule *module;
>>> >      struct
>>> > @@ -48,7 +52,7 @@
>>> >         struct Flag
>>> >             *update, *print, *gprint, *flprint, *lprint, *eprint,
>>> > *nangle,
>>> >             *center, *res_set, *dist_res, *dflt, *z, *savedefault,
>>> > -           *bbox, *gmt_style, *wms_style;
>>> > +           *bbox, *gmt_style, *wms_style, *list;
>>> >      } flag;
>>> >      struct
>>> >      {
>>> > @@ -165,6 +169,11 @@
>>> >      flag.update->description = _("Do not update the current region");
>>> >      flag.update->guisection = _("Effects");
>>> >
>>> > +    flag.list = G_define_flag();
>>> > +    flag.list->key = 'L';
>>> > +    flag.list->description = _("List available regions");
>>> > +    flag.list->guisection = _("Print");
>>> > +
>>> >      /* parameters */
>>> >
>>> >      parm.region = G_define_standard_option(G_OPT_M_REGION);
>>> > @@ -362,7 +371,7 @@
>>> >      G_option_required(flag.dflt, flag.savedefault, flag.print,
>>> > flag.lprint,
>>> >                        flag.eprint, flag.center, flag.gmt_style,
>>> > flag.wms_style,
>>> >                        flag.dist_res, flag.nangle, flag. z, flag.bbox,
>>> > flag.gprint,
>>> > -                      flag.res_set, flag.update, parm.region,
>>> > parm.raster,
>>> > +                      flag.res_set, flag.update, flag.list,
>>> > parm.region, parm.raster,
>>> >                        parm.raster3d, parm.vect, parm.north,
>>> > parm.south, parm.east,
>>> >                        parm.west, parm.top, parm.bottom, parm.rows,
>>> > parm.cols,
>>> >                        parm.res, parm.res3, parm.nsres, parm.ewres,
>>> > parm.tbres,
>>> > @@ -850,6 +859,21 @@
>>> >      if (print_flag)
>>> >         print_window(&window, print_flag, flat_flag);
>>> >
>>> > +    if (flag.list->answer) {
>>> > +          mapset = G_mapset_path();
>>> > +          sprintf(windows_path, "%s/%s", mapset, "windows");
>>> > +          d = opendir(windows_path);
>>> > +
>>> > +          if (d) {
>>> > +            while ((dir = readdir(d)) != NULL) {
>>> > +              if (dir->d_type == DT_REG) {
>>> > +                printf("%s\n", dir->d_name);
>>> > +              }
>>> > +            }
>>> > +            closedir(d);
>>> > +          }
>>> > +    }
>>> > +
>>> >      exit(EXIT_SUCCESS);
>>> >  }
>>> >
>>> >
>>> > _______________________________________________
>>> > grass-commit mailing list
>>> > grass-commit at lists.osgeo.org
>>> > https://lists.osgeo.org/mailman/listinfo/grass-commit
>>>
>>>
>>>
>>> --
>>> Martin Landa
>>> http://geo.fsv.cvut.cz/gwiki/Landa
>>> http://gismentors.cz/mentors/landa
>>
>>
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/grass-dev
>



-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


More information about the grass-dev mailing list