[GRASS-SVN] r69645 - grass/trunk/raster/r.info

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 2 18:17:12 PDT 2016


Author: annakrat
Date: 2016-10-02 18:17:11 -0700 (Sun, 02 Oct 2016)
New Revision: 69645

Modified:
   grass/trunk/raster/r.info/main.c
Log:
r.info: make category title the primary also when using -e flag, see #3035

Modified: grass/trunk/raster/r.info/main.c
===================================================================
--- grass/trunk/raster/r.info/main.c	2016-10-03 00:46:40 UTC (rev 69644)
+++ grass/trunk/raster/r.info/main.c	2016-10-03 01:17:11 UTC (rev 69645)
@@ -129,23 +129,25 @@
 
     out = stdout;
 
+    if (eflag->answer || (!gflag->answer && !rflag->answer && !hflag->answer)) {
+	title = "";
+	/* empty title by default */
+	/* use title from category file as the primary (and only) title */
+	if (cats_ok)
+	    title = cats.title;
+	/* only use hist file title if there is none in the category file */
+	if ((!title || title[0] == '\0') && hist_ok) {
+	    title = Rast_get_history(&hist, HIST_TITLE);
+	    /* if the title is the same as name of the map, don't use it */
+	    if (strcmp(title, name) == 0)
+		title = "";
+	}
+    }
+
     if (!gflag->answer && !rflag->answer &&
 	!eflag->answer && !hflag->answer) {
 	divider('+');
 
-    /* empty title by default */
-    title = "";
-    /* use title from category file as the primary (and only) title */
-    if (cats_ok)
-        title = cats.title;
-    /* only use hist file title if there is none in the category file */
-    if ((!title || title[0] == '\0') && hist_ok) {
-        title = Rast_get_history(&hist, HIST_TITLE);
-        /* if the title is the same as name of the map, don't use it */
-        if (strcmp(title, name) == 0)
-            title = "";
-    }
-
 	compose_line(out, "Map:      %-29.29s  Date: %s", name,
 		     hist_ok ? Rast_get_history(&hist, HIST_MAPID) : "??");
 	compose_line(out, "Mapset:   %-29.29s  Login of Creator: %s",
@@ -380,8 +382,7 @@
             fprintf(out, "database=%s\n", G_gisdbase());
             fprintf(out, "date=\"%s\"\n", hist_ok ? Rast_get_history(&hist, HIST_MAPID) : "??");
             fprintf(out, "creator=\"%s\"\n", hist_ok ? Rast_get_history(&hist, HIST_CREATOR) : "??");
-	    fprintf(out, "title=\"%s (%s)\"\n", cats_ok ? cats.title :
-		    "??", hist_ok ? Rast_get_history(&hist, HIST_TITLE) : "??");
+	    fprintf(out, "title=\"%s\"\n", title);
 	    if (time_ok && (first_time_ok || second_time_ok)) {
 
 		G_format_timestamp(&ts, timebuff);



More information about the grass-commit mailing list