Getoptionvalue returns next option if no value is provided
Original Reporter info from Mantis: whizkidz
-
Reporter name: Anton
Original Reporter info from Mantis: whizkidz
- Reporter name: Anton
Description:
When using command line parameters with optional value, if no value is given then next option is returned instead of a empty string.
IMHO the problem is that there is no check on the first character in getoptionvalue (custapp.pp)
Steps to reproduce:
example
progname -c test -d -p
getoptionvalue('c') gives 'test'
getoptionvalue('d') gives '-p'
getoptionvalue('p') gives ''
Additional information:
330 else
begin // short options have form '-o value'
If (I<ParamCount) then
Result:=Params[I+1]; <-- check first character = '-'
end;
335 end;
Mantis conversion info:
- Mantis ID: 24674
- Platform: All
- Version: 2.6.3
- Fixed in version: 2.6.4
- Fixed in revision: 26853 (#ad7953a5)
- Target version: 3.0.0