[GRASS-SVN] r49219 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 14 03:03:58 EST 2011


Author: martinl
Date: 2011-11-14 00:03:58 -0800 (Mon, 14 Nov 2011)
New Revision: 49219

Modified:
   grass/trunk/lib/gis/parser.c
Log:
gislib: allow opt='-' also for multiple options (reserved for standard input/output)


Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2011-11-14 07:58:29 UTC (rev 49218)
+++ grass/trunk/lib/gis/parser.c	2011-11-14 08:03:58 UTC (rev 49219)
@@ -1036,6 +1036,10 @@
 {
     int d, i;
 
+    /* "-" is reserved for standard input */
+    if (strcmp(ans, "-") == 0)
+	return 0;
+
     if (sscanf(ans, "%d", &d) != 1)
 	return MISSING_VALUE;
 
@@ -1080,6 +1084,10 @@
     double d;
     int i;
 
+    /* "-" is reserved for standard input */
+    if (strcmp(ans, "-") == 0)
+	return 0;
+    
     if (sscanf(ans, "%lf", &d) != 1)
 	return MISSING_VALUE;
 
@@ -1237,7 +1245,8 @@
     err = NULL;
     opt = &st->first_option;
     while (opt) {
-	if (opt->answer && opt->key_desc) {
+	/* "-" is reserved from standard input/output */
+	if (opt->answer && strcmp(opt->answer, "-") && opt->key_desc) {
 	    /* count commas */
 	    n_commas = 1;
 	    for (ptr = opt->key_desc; *ptr != '\0'; ptr++)



More information about the grass-commit mailing list