[GRASS-dev] G7: parser - suppressing label in scripts

Soeren Gebbert soerengebbert at googlemail.com
Thu Aug 11 11:27:25 EDT 2011


Hello Glynn,
thanks for your suggestions. But i think you are two steps ahead from
me, because i am not able to find any strdup() usage in parser*.c.

Are there any steps to do before replacing strdup with your suggested xstrdup?

Thanks and best regards
Soeren

2011/8/10 Glynn Clements <glynn at gclements.plus.com>:
>
> 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.
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>


More information about the grass-dev mailing list