Fwd: [about getopt] a simple option request

Bruce Korb bkorb@gnu.org
Thu Oct 13 15:09:00 GMT 2011


On 10/13/11 06:48, Leaveye wrote:
> ---------- Forwarded message ----------
> From: Leaveye<leaveye.guo@gmail.com>
> Date: 2011/10/12
> Subject: [about getopt] a simple option request
>
>
> hi all,
>
> upon some projects run over, some user and developer reports that a
> option accept more than one parameter is needed.
>
>
> currently, users can only use {--connect HOST:PORT} or {--connect "HOST PORT"}.
> in either way, developers need to handwriting some ugly strtok()s and

There really isn't a generic way to do that.  What you are asking for is
an option argument type of, say, "host-port" that stores its result
in some structure, that perhaps varies based on IPv6 vs. IPv4.
Use an extensible option parser:
   http://www.gnu.org/software/autogen/autoopts.html
That one even spits out your man page and texi invoking chapter for you.



More information about the Libc-help mailing list