Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-09

getopts

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

jordi

I'm trying to use the unit getopts, but something goes wrong.

In a program I get extrange results if I insert a non-option between two options. In the example program of the unit:

next is ok.
testopt --verbose --add me --delete you
Long option : verbose
Long option : add With value : me
Long option : delete With value : you

next is ok.
testopt --verbose --add me --delete you hereiam
Long option : verbose
Long option : add With value : me
Long option : delete With value : you
Nomoptions : hereiam

but next is not ok. Non options are wrong.
testopt hereagain --verbose --add me --delete you hereiam Long option : verbose
Long option : add With value : me
Long option : delete With value : you
Nomoptions : you hereiam

Perhaps I don't understand the working of getopts...

Thanks.

Jordi.