Hi,

I'm trying to parse a command line that can contain multiple variable
number of arguments for a parameter, e.g.

<program> -r /dev/sda /dev/sdb -m /dev/sdc /dev/sdd -b 16m ...

The reason for the space separated lists is simply shell expansion.
Given existing device nodes you could write <program> -r /dev/sd[ab] -m
/dev/sd[cd] -b 16m ... to reach the same. Similar expansion could be
done with {a..z} or wildcard patterns. However this is not a case of
leftover arguments since the context (in the above example, -r or -m) is
relevant.

So far I tried to use POPT_ARG_ARGV (which expects one -r/-m for each
argument) as well as poptPeekArg from within a r/m handler to look at
the next word in the command line. However, poptPeekArg only seems to
work after all arguments are parsed.

Is there a way to realize what I'm trying within the current version of
popt, and if not, would there be any interest (or chance of being added)
implementing a POP_ARG_LIST that would act like POPT_ARG_ARGV, but take
all arguments until the next parameter starting with a "-"?

Regards,
Christian
______________________________________________________________________
POPT Library                                           http://rpm5.org
Developer Communication List                       popt-devel@rpm5.org

Reply via email to