Recent

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

jollytall

  • Full Member
  • ***
  • Posts: 128
GEtOpt optional argument handled incorrectly (?)
« on: October 12, 2021, 06:48:00 pm »
If the description (https://azrael.digipen.edu/~mmead/www/mg/getopt/index.html) 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