[GRASS-dev] Empty default answer

Is it correct leave empty a default answer in a module?
An example is in r.out.pov with zmod or objmod option

Thanks
Luca

On Tue, Aug 14, 2012 at 2:52 PM, Luca Delucchi <lucadeluge@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

According to programming manual 'answer' is not required. Also see
[1]. Maybe I am missing something but I can't see the options zmod and
objmod for that module.

Anna

[1] http://grass.osgeo.org/programming7/gislib.html#Answer_member_of_the_Flag_and_Option_structures

Thanks
Luca

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Tue, Aug 14, 2012 at 2:52 PM, Luca Delucchi <lucadeluge@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.

Markus

On Mon, Aug 20, 2012 at 10:29 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Aug 14, 2012 at 2:52 PM, Luca Delucchi <lucadeluge@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

On Mon, Aug 20, 2012 at 11:17 AM, Markus Metz
<markus.metz.giswork@gmail.com> wrote:
...

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.

Fixed in all branches and trunk.

Markus