[GRASS-SVN] r34164 - in grass/trunk: include lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 6 05:05:05 EST 2008


Author: neteler
Date: 2008-11-06 05:05:05 -0500 (Thu, 06 Nov 2008)
New Revision: 34164

Modified:
   grass/trunk/include/gis.h
   grass/trunk/lib/gis/error.c
   grass/trunk/lib/gis/percent.c
Log:
added G_INFO_FORMAT_PLAIN

Modified: grass/trunk/include/gis.h
===================================================================
--- grass/trunk/include/gis.h	2008-11-05 14:06:50 UTC (rev 34163)
+++ grass/trunk/include/gis.h	2008-11-06 10:05:05 UTC (rev 34164)
@@ -203,6 +203,7 @@
 #define G_INFO_FORMAT_STANDARD 0	/* GRASS_MESSAGE_FORMAT=standard or not defined */
 #define G_INFO_FORMAT_GUI      1	/* GRASS_MESSAGE_FORMAT=gui */
 #define G_INFO_FORMAT_SILENT   2	/* GRASS_MESSAGE_FORMAT=silent */
+#define G_INFO_FORMAT_PLAIN    3	/* GRASS_MESSAGE_FORMAT=plain */
 
 /* Icon types */
 #define G_ICON_CROSS  0

Modified: grass/trunk/lib/gis/error.c
===================================================================
--- grass/trunk/lib/gis/error.c	2008-11-05 14:06:50 UTC (rev 34163)
+++ grass/trunk/lib/gis/error.c	2008-11-06 10:05:05 UTC (rev 34164)
@@ -332,6 +332,7 @@
 	logfile = getenv("GIS_ERROR_LOG");
 	if (!logfile) {
 	    char buf[GPATH_MAX];
+
 	    sprintf(buf, "%s/GIS_ERROR_LOG", G__home());
 	    logfile = G_store(buf);
 	}
@@ -495,6 +496,8 @@
 	    grass_info_format = G_INFO_FORMAT_GUI;
 	else if (fstr && G_strcasecmp(fstr, "silent") == 0)
 	    grass_info_format = G_INFO_FORMAT_SILENT;
+	else if (fstr && G_strcasecmp(fstr, "plain") == 0)
+	    grass_info_format = G_INFO_FORMAT_BATCH;
 	else
 	    grass_info_format = G_INFO_FORMAT_STANDARD;
     }

Modified: grass/trunk/lib/gis/percent.c
===================================================================
--- grass/trunk/lib/gis/percent.c	2008-11-05 14:06:50 UTC (rev 34163)
+++ grass/trunk/lib/gis/percent.c	2008-11-06 10:05:05 UTC (rev 34164)
@@ -111,15 +111,25 @@
 		fprintf(out, "%4d%%\b\b\b\b\b", x);
 	    }
 	}
-	else {			/* GUI */
-	    if (out != NULL) {
-		if (first) {
-		    fprintf(out, "\n");
+	else {
+	    if (format == G_INFO_FORMAT_BATCH) {
+		if (out != NULL) {
+		    if (x == 100)
+			fprintf(out, "%d\n", x);
+		    else
+			fprintf(out, "%d..", x);
 		}
-		fprintf(out, "GRASS_INFO_PERCENT: %d\n", x);
-		fflush(out);
 	    }
-	    first = 0;
+	    else {		/* GUI */
+		if (out != NULL) {
+		    if (first) {
+			fprintf(out, "\n");
+		    }
+		    fprintf(out, "GRASS_INFO_PERCENT: %d\n", x);
+		    fflush(out);
+		}
+		first = 0;
+	    }
 	}
     }
 



More information about the grass-commit mailing list