[GRASS-SVN] r60262 - grass/trunk/general/g.mlist

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 16 07:53:01 PDT 2014


Author: hcho
Date: 2014-05-16 07:53:01 -0700 (Fri, 16 May 2014)
New Revision: 60262

Modified:
   grass/trunk/general/g.mlist/main.c
Log:
g.mlist: Don't add mapset if only one mapset is searched.


Modified: grass/trunk/general/g.mlist/main.c
===================================================================
--- grass/trunk/general/g.mlist/main.c	2014-05-16 14:37:27 UTC (rev 60261)
+++ grass/trunk/general/g.mlist/main.c	2014-05-16 14:53:01 UTC (rev 60262)
@@ -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;
     }
 
@@ -274,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;



More information about the grass-commit mailing list