[GRASS-SVN] r48233 - grass/branches/releasebranch_6_4/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 11 09:32:04 EDT 2011


Author: neteler
Date: 2011-09-11 06:32:04 -0700 (Sun, 11 Sep 2011)
New Revision: 48233

Modified:
   grass/branches/releasebranch_6_4/lib/gis/parser.c
Log:
Don't accept multiple answers when opt->multiple == NO (bug #1444); Fix handling of default option with multiple answers (backport from trunk, r48205)

Modified: grass/branches/releasebranch_6_4/lib/gis/parser.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gis/parser.c	2011-09-11 06:42:02 UTC (rev 48232)
+++ grass/branches/releasebranch_6_4/lib/gis/parser.c	2011-09-11 13:32:04 UTC (rev 48233)
@@ -961,6 +961,7 @@
 	    /* If we see the first option with no equal sign */
 	    else if (need_first_opt && n_opts) {
 		first_option.answer = G_store(ptr);
+		first_option.count++;
 		need_first_opt = 0;
 	    }
 
@@ -2203,6 +2204,10 @@
 
     /* Allocate memory where answer is stored */
     if (opt->count++) {
+	if (!opt->multiple) {
+	   fprintf(stderr, _("Option <%s> does not accept multiple answers\n"), the_key);
+	   return (1);
+	}
 	opt->answer = (char *)G_realloc(opt->answer,
 					strlen(opt->answer) + strlen(string) +
 					2);



More information about the grass-commit mailing list