[GRASS-SVN] r60351 - grass/branches/releasebranch_7_0/general/g.mlist
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 19 13:49:46 PDT 2014
Author: hcho
Date: 2014-05-19 13:49:46 -0700 (Mon, 19 May 2014)
New Revision: 60351
Modified:
grass/branches/releasebranch_7_0/general/g.mlist/main.c
Log:
g.mlist: found in more mapsets warnings suppressed. don't add mapset for a single mapset search (merge from 60261, 60262)
Modified: grass/branches/releasebranch_7_0/general/g.mlist/main.c
===================================================================
--- grass/branches/releasebranch_7_0/general/g.mlist/main.c 2014-05-19 20:41:30 UTC (rev 60350)
+++ grass/branches/releasebranch_7_0/general/g.mlist/main.c 2014-05-19 20:49:46 UTC (rev 60351)
@@ -29,7 +29,7 @@
static void make_list(const struct list *,
const char *, const char *,
- int, int, int);
+ int, int, int, int);
int main(int argc, char *argv[])
{
@@ -200,7 +200,7 @@
else
make_list(M_get_list(n), mapset, separator,
flag.pretty->answer, flag.type->answer,
- flag.mapset->answer);
+ flag.mapset->answer, mapset && *mapset);
}
if (!flag.pretty->answer && any)
@@ -218,7 +218,7 @@
static void make_list(
const struct list *elem,
const char *mapset, const char *separator,
- int pretty, int add_type, int add_mapset)
+ int pretty, int add_type, int add_mapset, int single_mapset)
{
char path[GPATH_MAX];
const char *element = elem->element[0];
@@ -236,7 +236,7 @@
int n;
for (n = 0; mapset = G__mapset_name(n), mapset; n++)
make_list(elem, mapset, separator,
- pretty, add_type, add_mapset);
+ pretty, add_type, add_mapset, n == 0);
return;
}
@@ -258,7 +258,10 @@
G_message(_("%s available in mapset <%s>:"),
elem->text, mapset);
}
-
+
+ /* Suppress "... found in more mapsets" warnings from G_find_file2. */
+ G_suppress_warnings(1);
+
for (i = 0; i < count; i++) {
char *name = list[i];
int need_mapset = 0;
@@ -271,7 +274,7 @@
fprintf(stdout, "%s", name);
- if (!add_mapset) {
+ if (!add_mapset && !single_mapset) {
const char *mapset2 = G_find_file2(element, name, "");
if (mapset2)
need_mapset = strcmp(mapset, mapset2) != 0;
@@ -284,6 +287,7 @@
any++;
}
+ G_suppress_warnings(0);
fflush(stdout);
G_free(list);
More information about the grass-commit
mailing list