? general/manage/cmd/OBJ.i686-pc-linux-gnu
? general/manage/lib/OBJ.i686-pc-linux-gnu
? general/manage/lister/OBJ.i686-pc-linux-gnu
? lib/gis/OBJ.i686-pc-linux-gnu
? lib/gis/html
? lib/gis/latex
Index: general/manage/list.h
===================================================================
RCS file: /home/grass/grassrepository/grass6/general/manage/list.h,v
retrieving revision 1.4
diff -u -r1.4 list.h
--- general/manage/list.h	13 Jan 2007 19:09:45 -0000	1.4
+++ general/manage/list.h	13 Sep 2007 08:27:41 -0000
@@ -39,6 +39,7 @@
 int do_copy(int, char *, char *, char *);
 /* do_list.c */
 int do_list(int, char *);
+int do_list2(int, char *, int, int);
 /* do_remove.c */
 int do_remove(int, char *);
 /* do_rename.c */
Index: general/manage/cmd/list.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/general/manage/cmd/list.c,v
retrieving revision 1.7
diff -u -r1.7 list.c
--- general/manage/cmd/list.c	12 Feb 2007 15:01:02 -0000	1.7
+++ general/manage/cmd/list.c	13 Sep 2007 08:27:41 -0000
@@ -32,7 +32,7 @@
 	int i, n, len;
 	struct GModule *module;
 	struct Option *mapset;
-	struct Flag *full;
+	struct Flag *full, *shell;
 
 	init (argv[0]);
 
@@ -48,7 +48,7 @@
 	element->type     = TYPE_STRING;
 	element->required = YES;
 	element->multiple = YES;
-	element->description = "Data type";
+	element->description = _("Data type");
 	for (len=0,n=0 ; n < nlist; n++)
 	    len += strlen (list[n].alias)+1;
 	element->options = G_malloc(len);
@@ -74,9 +74,16 @@
 
 	full = G_define_flag();
 	full->key = 'f';
-	full->description = _("Verbose listing (also list map titles)");
+	full->label = _("Verbose listing (also list map titles)");
+	full->description = _("Prints one element per line");
 #define FULL full->answer
 
+	shell = G_define_flag();
+	shell->key = 'g';
+	shell->label = _("Print in shell script style");
+	shell->description = _("Prints one element per line");
+#define SHELL shell->answer
+
 	if (G_parser(argc, argv))
 	{
 		exit(EXIT_FAILURE);
@@ -92,22 +99,40 @@
 	while (element -> answers[i])
 	{ 
 		n = parse(element -> answers[i]);
-		
-		if (FULL)
+
+		/* 
+		if (FULL) 
 		{
+		    G_warning (_("Parameter '%s' is ignored for verbose listing"),
+			       "1");
 			char lister[300];
 			sprintf (lister, "%s/etc/lister/%s", G_gisbase(), list[n].element[0]);
 			G_debug(3,"lister CMD: %s",lister);
-			if (access (lister, 1) == 0) /* execute permission? */
+			if (access (lister, 1) == 0) 
 				G_spawn (lister, lister, MAPSET, NULL);
 			else
 				do_list (n, MAPSET);
 		}
+		else 
+		{
+		*/
+
+		/*
+		 * if no specific mapset is requested, list the mapsets
+		 * from the mapset search list
+		 * otherwise just list the specified mapset
+		 */
+		if (strcmp (MAPSET, "") == 0)
+		{
+		    char *mapset;
+		    int i;
+		    for (i = 0; (mapset = G__mapset_name (i)); i++)
+			do_list2 (n, mapset, SHELL ? 1 : 0, FULL ? 1 : 0);
+		}
 		else
 		{
-			do_list (n, MAPSET);
+		    do_list2(n, MAPSET, SHELL ? 1 : 0, FULL ? 1: 0);
 		}
-
 		i++;
 	}
 
Index: general/manage/lib/do_list.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/general/manage/lib/do_list.c,v
retrieving revision 1.1
diff -u -r1.1 do_list.c
--- general/manage/lib/do_list.c	23 Jan 2003 15:40:55 -0000	1.1
+++ general/manage/lib/do_list.c	13 Sep 2007 08:27:41 -0000
@@ -1,8 +1,87 @@
+#include <string.h>
 #include "list.h"
+
+#define SEP "----------------------------------------------"
+
 int 
 do_list (int n, char *mapset)
 {
     G_list_element (list[n].element[0], list[n].desc[0], mapset, (int(*)())0);
 
     return 0;
+}
+
+int do_list2 (int n, char *mapset, int shell, int full)
+{
+    char **elements;
+    int nitems;
+
+    if (!shell)
+	G_message (SEP);
+
+    /* list elements */
+    elements = G_list (n+1, G_gisdbase(), G_location(), mapset);
+    /* deteremine number of elements */
+    nitems = 0; 
+    while (elements[nitems++])
+	;
+    nitems--;
+
+    /* if shell script style print map@mapset */
+    if (shell) {
+	int i;
+	char *title;
+	for (i = 0; i < nitems; i++) {
+	    if (full) {
+		title = G_get_cell_title(elements[i], mapset);
+		elements[i] = (char *) G_realloc (elements[i],
+						  strlen(elements[i]) + strlen(mapset) + 
+						  + strlen(title) + 3);
+	    }
+	    else {
+		elements[i] = (char *) G_realloc (elements[i],
+						  strlen(elements[i]) + strlen(mapset) + 2);
+	    }
+
+	    G_strcat ( elements[i], "@" );
+	    G_strcat ( elements[i], mapset);
+	    if (full) {
+		G_strcat ( elements[i], ":");
+		G_strcat ( elements[i], title);
+		G_free (title);
+	    }
+	}
+    }
+    else if (full) { /* print titles */
+	int i;
+	char * title;
+	for (i = 0; i < nitems; i++) {
+	    title = G_get_cell_title(elements[i], mapset);
+	    elements[i] = (char *) G_realloc (elements[i],
+					      strlen(elements[i]) + strlen(title) + 3);
+	    G_strcat ( elements[i], ": ");
+	    G_strcat ( elements[i], title);
+	    G_free (title);
+	}
+    }
+
+    if (nitems > 0) {
+	if (!shell)
+	    G_important_message (_("%s files available in mapset <%s>:"),
+				 list[n].desc[0], mapset);
+	/* print elements */
+	G_ls_format ((const char**) elements, nitems,
+		     (shell || full) ? 1 : 0, /* one item per line */
+		     stdout);
+    } 
+    else {
+	if (!shell)
+	    G_important_message (_("no %s files available in mapset <%s>:"),
+				 list[n].desc[0], mapset);
+    }		
+
+    /* free list of elements */
+    G_free_list (elements);
+
+    return nitems - 1;
 }
Index: lib/gis/list.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/list.c,v
retrieving revision 2.24
diff -u -r2.24 list.c
--- lib/gis/list.c	4 Sep 2007 08:34:38 -0000	2.24
+++ lib/gis/list.c	13 Sep 2007 08:27:42 -0000
@@ -238,24 +238,56 @@
     
     switch ( element )
     {
-        case G_ELEMENT_RASTER:
-            el = "cell";
-            break;
-
-        case G_ELEMENT_GROUP:
-            el = "group";
-            break;
-
-        case G_ELEMENT_VECTOR:
-            el = "vector";
-            break;
-
-        case G_ELEMENT_REGION:
-            el = "windows";
-            break;
+    case G_ELEMENT_RASTER:
+	el = "cell";
+	break;
+	
+    case G_ELEMENT_RASTER3D:
+	el = "grid3";
+	break;
+	
+    case G_ELEMENT_VECTOR:
+	el = "vector";
+	break;
 
-        default:
-            G_fatal_error (_("G_list: Unknown element type"));
+    case G_ELEMENT_OLDVECTOR:
+	el = "dig";
+	break;
+	
+    case G_ELEMENT_ASCIIVECTOR:
+	el = "dig_ascii";
+	break;
+
+    case G_ELEMENT_ICON:
+	el = "icons";
+	break;
+
+    case G_ELEMENT_LABEL:
+	el = "paint/labels";
+	break;
+
+    case G_ELEMENT_SITE:
+	el = "site_lists";
+	break;
+
+    case G_ELEMENT_REGION:
+	el = "windows";
+	break;
+
+    case G_ELEMENT_REGION3D:
+	el = "windows3d";
+	break;
+
+    case G_ELEMENT_GROUP:
+	el = "group";
+	break;
+    
+    case G_ELEMENT_3DVIEW:
+	el = "3d.view";
+	break;
+
+    default:
+	G_fatal_error (_("G_list: Unknown element type"));
     }			
 	
     buf = (char *) G_malloc ( strlen(gisbase) + strlen(location)
Index: lib/gis/ls.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/gis/ls.c,v
retrieving revision 1.8
diff -u -r1.8 ls.c
--- lib/gis/ls.c	4 Sep 2007 08:34:38 -0000	1.8
+++ lib/gis/ls.c	13 Sep 2007 08:27:42 -0000
@@ -142,6 +142,9 @@
     }   
 #endif                  
 
+    /* Sort list of filenames alphabetically */
+    qsort(list, num_items, sizeof(char *), cmp_names);
+
     if (perline == 0) 
     {	
         int max_len = 0;
