[GRASS-SVN] r48205 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Sep 8 04:44:20 EDT 2011
Author: glynn
Date: 2011-09-08 01:44:20 -0700 (Thu, 08 Sep 2011)
New Revision: 48205
Modified:
grass/trunk/lib/gis/parser.c
Log:
Don't accept multiple answers when opt->multiple == NO (bug #1444)
Fix handling of default option with multiple answers
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2011-09-08 08:24:46 UTC (rev 48204)
+++ grass/trunk/lib/gis/parser.c 2011-09-08 08:44:20 UTC (rev 48205)
@@ -520,6 +520,7 @@
/* If we see the first option with no equal sign */
else if (need_first_opt && st->n_opts) {
st->first_option.answer = G_store(ptr);
+ st->first_option.count++;
need_first_opt = 0;
}
@@ -930,6 +931,10 @@
/* Allocate memory where answer is stored */
if (opt->count++) {
+ if (!opt->multiple) {
+ G_asprintf(&err, _("Option <%s> does not accept multiple answers"), opt->key);
+ append_error(err);
+ }
opt->answer = G_realloc(opt->answer,
strlen(opt->answer) + strlen(string) + 2);
strcat(opt->answer, ",");
More information about the grass-commit
mailing list