[GRASS-SVN] r48234 - grass/branches/develbranch_6/lib/gis

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


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

Modified:
   grass/branches/develbranch_6/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/develbranch_6/lib/gis/parser.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/parser.c	2011-09-11 13:32:04 UTC (rev 48233)
+++ grass/branches/develbranch_6/lib/gis/parser.c	2011-09-11 13:32:26 UTC (rev 48234)
@@ -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