[Lazarus] Parsing command line options
J.A. de Vries
hdv.jadev at gmail.com
Mon Sep 10 23:37:40 CEST 2012
On 2012-09-10 17:59, Bernd wrote:
> 2012/9/10 J.A. de Vries <hdv.jadev at gmail.com>:
>> Might I make a suggestion? Why try and invent the wheel ourselves?
>> There's a very good library named getopts that has been used by masses
>> of programmers for years now. Maybe we could learn from that and
>> re-implement the choices made in there?
> But isn't this a completely separate problem? If I understand this
> thread correctly then the problem here is properly emulating what the
> shell would do when parsing one line of text (splitting the line at
> unquoted spaces, removing quotes, maybe even expanding wildcards) and
> then *producing* the argv array while getopts on the other hand can be
> used to extract key-value pairs that follow a certain syntax from an
> already existing argv array?
You might be right. I seem to remember that the native perl
implementation of getopts parses the argumentstring as a plain string
and builds from that. I could be wrong though. I'll look it up later
this week, as soon as I can find the time.
More information about the Lazarus