Author Topic: GEtOpt optional argument handled incorrectly (?)  (Read 738 times)


  • Full Member
  • ***
  • Posts: 156
GEtOpt optional argument handled incorrectly (?)
« on: October 12, 2021, 06:48:00 pm »
If the description ( I quoted in my previous topic is correct for short options with optional argument (it seems logic) then such a short option -a with argument test can be written only two ways:
Code: [Select]
./test -atest
./test -a=test
while the third way also allowed for mandatory arguments, cannot be used
Code: [Select]
./test -a testif a is defined as a:: in the ShortOpts (i.e. an option with optional argument) then the last should mean an -a option with no parameter and a non-option value test.
As far as I see FPC GetOpts unit does it differently (wrongly), because even the last is interpreted as -a option with test argument.


TinyPortal © 2005-2018