bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: argp limitation


From: Niels Möller
Subject: Re: argp limitation
Date: 11 Mar 2002 09:49:06 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de> writes:

> From a quick glance, argp seems to be reentrant, is this really
> true? Are there any (better) alternatives?

argp (at least the version in glibc-2.2.5, which is the latest glibc I
have around) uses getopt, which is inherently non-reentrant. There
sems to be some locking of the "getopt resource" going on, but I'm not
sure exactly what it does.

A while ago I hacked argp to get it to build separately from glibc,
and I also changed it to not use getopt. Miles Bader said he would
look at integrating it, but I haven't heard anything about it for a
year or so. Anyway, my code can be found at

  cvs -d :pserver:anonymous@cvs.lysator.liu.se:/cvsroot/lsh co argp

That should be fully reentrant, and simpler, because it doesn't have
to create any getopt_long arguments like the old code.

Perhaps one could create a new flag, say OPTION_PARELLEL, one you can
set on an option in a parent parser that says that the option should
be processed by all children (and it's probably easier to implement
"by all descendants" than "by all children", given that argp organizes
the groups in a _linear_ list corresponding to preorder traversal of
the tree of parsers).

/Niels



reply via email to

[Prev in Thread] Current Thread [Next in Thread]