[GRASS-dev] Empty default answer
Markus Metz
markus.metz.giswork at gmail.com
Mon Aug 20 02:17:55 PDT 2012
On Mon, Aug 20, 2012 at 10:29 AM, Markus Neteler <neteler at osgeo.org> wrote:
> On Tue, Aug 14, 2012 at 2:52 PM, Luca Delucchi <lucadeluge at gmail.com> wrote:
>> Is it correct leave empty a default answer in a module?
>> An example is in r.out.pov with zmod or objmod option
>
> (it is about v.out.pov):
> http://grass.osgeo.org/grass64/manuals/html64_user/v.out.pov.html
>
> I think that the empty ("") answers in
> grass64/vector/v.out.pov/main.c
>
> 58 zmod_opt = G_define_option();
> 59 zmod_opt->key = "zmod";
> 60 zmod_opt->type = TYPE_STRING;
> 61 zmod_opt->required = NO;
> 62 zmod_opt->answer = "";
> 63 zmod_opt->description =
> 64 "Modifier for z coordinates, this string is appended
> to each z coordinate.\n"
> 65 "\t\tExamples: '*10', '+1000', '*10+100', '*exaggeration'";
>
> 66 objmod_opt = G_define_option();
> 67 objmod_opt->key = "objmod";
> 68 objmod_opt->type = TYPE_STRING;
> 69 objmod_opt->required = NO;
> 70 objmod_opt->answer = "";
> 71 objmod_opt->description =
> 72 "Object modifier (OBJECT_MODIFIER in POV-Ray documentation).\n"
> 73 "\t\tExample: \"pigment { color red 0 green 1 blue 0 }\"";
>
> should be removed.
I agree because the test is usually if (opt->answer), that is if
answer != NULL, which is true if the answer is "" = '\0', IOW, ""
would be treated as a valid answer.
Markus M
More information about the grass-dev
mailing list