<div dir="ltr"><div><div><div><br><br>On Thu, Apr 5, 2018 at 1:09 PM, Jachym Cepicky <<a href="mailto:jachym.cepicky@gmail.com">jachym.cepicky@gmail.com</a>> wrote:<br>><br>> Hi,<br>><br>> sorry for too rush approach, you can certainly revert the commit<br><br></div>I agree with Martin, the commit does not make sense, and you should revert the commit yourself.<br><br></div>Thanks,<br><br></div>Markus M<br><div><div><div>><br>> Jachym<br>><br>> čt 5. 4. 2018 v 13:01 odesílatel Martin Landa <<a href="mailto:landa.martin@gmail.com">landa.martin@gmail.com</a>> napsal:<br>>><br>>> Hi,<br>>><br>>> 2018-04-05 12:16 GMT+02:00  <<a href="mailto:svn_grass@osgeo.org">svn_grass@osgeo.org</a>>:<br>>> > Author: jachym<br>>> > Date: 2018-04-05 03:16:14 -0700 (Thu, 05 Apr 2018)<br>>> > New Revision: 72590<br>>> ><br>>> > Modified:<br>>> >    grass/trunk/general/g.region/local_proto.h<br>>> >    grass/trunk/general/g.region/main.c<br>>> > Log:<br>>> > Adding -L flag to g.region for getting list of regions<br>>><br>>> 1) upper-case flags should not be used<br>>> 2) this functionality is already available as `g.list type=region` if<br>>> I understand well<br>>> 3) I would prefer to see ticket with related discussion before<br>>> committing change into trunk<br>>><br>>> Consider reverting this change. g.list functionality is not suitable<br>>> for your need?<br>>><br>>> Thanks for clarification, Martin<br>>><br>>> ><br>>> > Modified: grass/trunk/general/g.region/local_proto.h<br>>> > ===================================================================<br>>> > --- grass/trunk/general/g.region/local_proto.h  2018-04-03 10:43:37 UTC (rev 72589)<br>>> > +++ grass/trunk/general/g.region/local_proto.h  2018-04-05 10:16:14 UTC (rev 72590)<br>>> > @@ -12,6 +12,7 @@<br>>> >  #define PRINT_NANGLE 0x100<br>>> >  #define PRINT_GMT    0x200<br>>> >  #define PRINT_WMS    0x400<br>>> > +#define PRINT_WF     0x800<br>>> ><br>>> >  /* zoom.c */<br>>> >  int zoom(struct Cell_head *, const char *, const char *);<br>>> ><br>>> > Modified: grass/trunk/general/g.region/main.c<br>>> > ===================================================================<br>>> > --- grass/trunk/general/g.region/main.c 2018-04-03 10:43:37 UTC (rev 72589)<br>>> > +++ grass/trunk/general/g.region/main.c 2018-04-05 10:16:14 UTC (rev 72590)<br>>> > @@ -13,6 +13,7 @@<br>>> >   *             Read the file COPYING that comes with GRASS for details.<br>>> >   ****************************************************************************/<br>>> ><br>>> > +#include <dirent.h><br>>> >  #include <string.h><br>>> >  #include <stdlib.h><br>>> >  #include <math.h><br>>> > @@ -39,8 +40,11 @@<br>>> >      const char *value;<br>>> >      const char *name;<br>>> >      const char *mapset;<br>>> > +    char *windows_path = G_malloc(1024);<br>>> >      char **rast_ptr, **vect_ptr;<br>>> >      int pix;<br>>> > +    DIR *d;<br>>> > +    struct dirent *dir;<br>>> ><br>>> >      struct GModule *module;<br>>> >      struct<br>>> > @@ -48,7 +52,7 @@<br>>> >         struct Flag<br>>> >             *update, *print, *gprint, *flprint, *lprint, *eprint, *nangle,<br>>> >             *center, *res_set, *dist_res, *dflt, *z, *savedefault,<br>>> > -           *bbox, *gmt_style, *wms_style;<br>>> > +           *bbox, *gmt_style, *wms_style, *list;<br>>> >      } flag;<br>>> >      struct<br>>> >      {<br>>> > @@ -165,6 +169,11 @@<br>>> >      flag.update->description = _("Do not update the current region");<br>>> >      flag.update->guisection = _("Effects");<br>>> ><br>>> > +    flag.list = G_define_flag();<br>>> > +    flag.list->key = 'L';<br>>> > +    flag.list->description = _("List available regions");<br>>> > +    flag.list->guisection = _("Print");<br>>> > +<br>>> >      /* parameters */<br>>> ><br>>> >      parm.region = G_define_standard_option(G_OPT_M_REGION);<br>>> > @@ -362,7 +371,7 @@<br>>> >      G_option_required(flag.dflt, flag.savedefault, flag.print, flag.lprint,<br>>> >                        flag.eprint, flag.center, flag.gmt_style, flag.wms_style,<br>>> >                        flag.dist_res, flag.nangle, flag. z, flag.bbox, flag.gprint,<br>>> > -                      flag.res_set, flag.update, parm.region, parm.raster,<br>>> > +                      flag.res_set, flag.update, flag.list, parm.region, parm.raster,<br>>> >                        parm.raster3d, parm.vect, parm.north, parm.south, parm.east,<br>>> >                        parm.west, parm.top, parm.bottom, parm.rows, parm.cols,<br>>> >                        parm.res, parm.res3, parm.nsres, parm.ewres, parm.tbres,<br>>> > @@ -850,6 +859,21 @@<br>>> >      if (print_flag)<br>>> >         print_window(&window, print_flag, flat_flag);<br>>> ><br>>> > +    if (flag.list->answer) {<br>>> > +          mapset = G_mapset_path();<br>>> > +          sprintf(windows_path, "%s/%s", mapset, "windows");<br>>> > +          d = opendir(windows_path);<br>>> > +<br>>> > +          if (d) {<br>>> > +            while ((dir = readdir(d)) != NULL) {<br>>> > +              if (dir->d_type == DT_REG) {<br>>> > +                printf("%s\n", dir->d_name);<br>>> > +              }<br>>> > +            }<br>>> > +            closedir(d);<br>>> > +          }<br>>> > +    }<br>>> > +<br>>> >      exit(EXIT_SUCCESS);<br>>> >  }<br>>> ><br>>> ><br>>> > _______________________________________________<br>>> > grass-commit mailing list<br>>> > <a href="mailto:grass-commit@lists.osgeo.org">grass-commit@lists.osgeo.org</a><br>>> > <a href="https://lists.osgeo.org/mailman/listinfo/grass-commit">https://lists.osgeo.org/mailman/listinfo/grass-commit</a><br>>><br>>><br>>><br>>> --<br>>> Martin Landa<br>>> <a href="http://geo.fsv.cvut.cz/gwiki/Landa">http://geo.fsv.cvut.cz/gwiki/Landa</a><br>>> <a href="http://gismentors.cz/mentors/landa">http://gismentors.cz/mentors/landa</a><br>><br>><br>> _______________________________________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a><br><br></div></div></div></div>