[GRASS-SVN] r32682 - in grass/trunk/vector: v.distance v.to.db

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 11 07:48:58 EDT 2008


Author: neteler
Date: 2008-08-11 07:48:57 -0400 (Mon, 11 Aug 2008)
New Revision: 32682

Modified:
   grass/trunk/vector/v.distance/main.c
   grass/trunk/vector/v.to.db/report.c
Log:
conditionalize output to not confuse the user with useless messages

Modified: grass/trunk/vector/v.distance/main.c
===================================================================
--- grass/trunk/vector/v.distance/main.c	2008-08-11 11:16:11 UTC (rev 32681)
+++ grass/trunk/vector/v.distance/main.c	2008-08-11 11:48:57 UTC (rev 32682)
@@ -1095,9 +1095,12 @@
 	db_commit_transaction(driver);
 
     /* print stats */
-    G_message(_("%d categories with more than 1 feature in vector map <%s>"),
-	      update_dupl, from_opt->answer);
-    G_message(_("%d categories - no nearest feature found"), update_notfound);
+    if (update_dupl > 0)
+	G_message(_("%d categories with more than 1 feature in vector map <%s>"),
+		  update_dupl, from_opt->answer);
+    if (update_notfound > 0)
+	G_message(_("%d categories - no nearest feature found"),
+		  update_notfound);
 
     if (!print_flag->answer) {
 	db_close_database_shutdown_driver(driver);
@@ -1107,17 +1110,23 @@
 	if (all && table_opt->answer) {
 	    G_message(_("%d distances calculated"), count);
 	    G_message(_("%d records inserted"), update_ok);
-	    G_message(_("%d insert errors"), update_err);
+	    if (update_err > 0)
+		G_message(_("%d insert errors"), update_err);
 	}
 	else if (!all) {
-	    G_message(_("%d categories read from the map"), nfcats);
-	    G_message(_("%d categories exist in the table"), ncatexist);
-	    G_message(_("%d categories read from the map exist in the table"),
-		      update_exist);
-	    G_message(_("%d categories read from the map don't exist in the table"),
-		      update_notexist);
+	    if (nfcats > 0)
+		G_message(_("%d categories read from the map"), nfcats);
+	    if (ncatexist > 0)
+		G_message(_("%d categories exist in the table"), ncatexist);
+	    if (update_exist > 0)
+		G_message(_("%d categories read from the map exist in the table"),
+			  update_exist);
+	    if (update_notexist > 0)
+		G_message(_("%d categories read from the map don't exist in the table"),
+			  update_notexist);
 	    G_message(_("%d records updated"), update_ok);
-	    G_message(_("%d update errors"), update_err);
+	    if (update_err > 0)
+		G_message(_("%d update errors"), update_err);
 
 	    G_free(catexist);
 	}

Modified: grass/trunk/vector/v.to.db/report.c
===================================================================
--- grass/trunk/vector/v.to.db/report.c	2008-08-11 11:16:11 UTC (rev 32681)
+++ grass/trunk/vector/v.to.db/report.c	2008-08-11 11:48:57 UTC (rev 32682)
@@ -171,14 +171,19 @@
 
 int print_stat(void)
 {
-    G_message(_("%d categories read from map"), vstat.rcat);
-    G_message(_("%d records selected from table"), vstat.select);
-    G_message(_("%d categories read from map exist in selection from table"),
-	      vstat.exist);
-    G_message(_("%d categories read from map don't exist in selection from table"),
-	      vstat.notexist);
+    if (vstat.rcat > 0)
+	G_message(_("%d categories read from map"), vstat.rcat);
+    if (vstat.select > 0)
+	G_message(_("%d records selected from table"), vstat.select);
+    if (vstat.exist > 0)
+	G_message(_("%d categories read from map exist in selection from table"),
+		  vstat.exist);
+    if (vstat.notexist > 0)
+	G_message(_("%d categories read from map don't exist in selection from table"),
+		  vstat.notexist);
     G_message(_("%d records updated/inserted"), vstat.update);
-    G_message(_("%d update/insert errors"), vstat.error);
+    if (vstat.error > 0)
+	G_message(_("%d update/insert errors"), vstat.error);
     if (vstat.dupl > 0)
 	G_message(_("%d categories with more points (coordinates not loaded)"),
 		  vstat.dupl);



More information about the grass-commit mailing list