Thanks Ben!

so this should be in the generated parser, shouldn't it?

cheers
        Lorenzo

Ben Asselstine wrote:
The *end parameter to strto[u]l needs to be checked like this:

      {
        char *end;
        unsigned long int ms = strtoul (arg, &end, 10);
        if (end && *end == '\0')
          timeout = ms;
        else
          {
            argp_error (state,
                        "--timeout needs a numeric argument (milliseconds)");
            return EINVAL;
          }
      }

(yes it's an example from an argp-based program :-) )
Cheers,

Ben

On 12/22/05, Tiago Menezes <[EMAIL PROTECTED]> wrote:

Dear all,

I've recently started using gengetopt, a fantastic tool that has
dramatically increased my productivity - thank you Lorenzo Bettini.

I would like to raise an issue related to the validation of the
command-line options (version 2.14: cygwin on Windows 2000, and on
Linux).

It is possible to type a text string as a value for an integer-type
option. The parsed value will be 0, which may well be part of the
acceptable input range. Reading cmdline.c, the offending code seems to
be the function strtol(), inside cmdline_parser_internal(). Is this
behaviour a true bug, or am I barking up the wrong tree (in which case
I'd appreciate learning how to circumvent the problem from a seasoned
programmer please).

Many thanks and a Happy Christmas everyone,
TM


_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt




_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt



--
+-----------------------------------------------------+
|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        : http://www.lorenzobettini.it    |
|  http://music.dsi.unifi.it         XKlaim language  |
|  http://www.purplesucker.com Deep Purple Cover Band |
|  http://www.gnu.org/software/src-highlite           |
|  http://www.gnu.org/software/gengetopt              |
|  http://www.lorenzobettini.it/software/gengen       |
|  http://www.lorenzobettini.it/software/doublecpp    |
+-----------------------------------------------------+



_______________________________________________
Help-gengetopt mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Reply via email to