[GRASS-dev] G7: parser - suppressing label in scripts
Glynn Clements
glynn at gclements.plus.com
Wed Aug 10 11:38:45 EDT 2011
Markus Neteler wrote:
> we have a problem with the introduction of labels:
> http://trac.osgeo.org/grass/changeset/39886/grass/trunk/lib/gis/parser_standard_options.c
Actually, the problem only arose with the addition of standard options
in r47421.
> It would be good to be able to suppress "label" with the a reserved word
> like "None" or "NULL":
>
> #%option G_OPT_V_INPUTS
> #% key: vector
> #% label: NULL
> #% description: Name of input vector map(s) used by GRASS script
> #% required: no
> #%end
> Any suggestions how to implement this suppressing "label" in the parser?
In parse.c, I suggest adding e.g.:
static char *xstrdup(const char *arg) {
return (strcmp(arg, "{NULL}") == 0)
? NULL
: strdup(arg);
}
and replacing all references to strdup() with xstrdup(). Also,
translate() will need a test for NULL pointers.
More information about the grass-dev
mailing list