Sign in Join

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

Mailing lists / fpc-pascal / 2004-01

using GetOpts

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Rudolf Harney

Hi!
I want to use the getopts unit but I fear, I don't understand the docu: If I have long options, what is returned by getLongOpts? In the docu-example (see below), c can be '1', '2', '3', ... or #0 or 'a', 'b', ... I don't understand, what getlongopts='9' means. Can soneone explain me, how to use getopts with two or three short and long options?

cut uot from units.pdf:
c := getlongopts ( ’ abc:d:012 ’ ,@theopts [ 1 ] , optionindex ) ;
case c of
’ 1 ’ , ’ 2 ’ , ’ 3 ’ , ’ 4 ’ , ’ 5 ’ , ’ 6 ’ , ’ 7 ’ , ’ 8 ’ , ’ 9 ’ :
begin
wr i teln ( ’Got opt ind : ’ , c )
end ;
# 0 : begin
wr i te ( ’ Longopt ion : ’ , theopts [ optionindex ] . name ) ;
if theopts [ optionindex ] . has_arg >0 then
writeln ( ’ With value : ’ , optarg )
else
writeln
end ;
’ a ’ : writeln ( ’ Option a . ’ ) ;
’ b ’ : writeln ( ’ Option b . ’ ) ;
’ c ’ : writeln ( ’ Option c : ’ , optarg ) ;
’ d ’ : writeln ( ’ Option d : ’ , optarg ) ;
’ ? ’ , ’ : ’ : writeln ( ’ Error with opt : ’ , optopt ) ;
end ; { case }

Thanks, RUDOLF

Rudolf Harney ______________________________________________________________________________ Erdbeben im Iran: Zehntausende Kinder brauchen Hilfe. UNICEF hilft den Kindern - helfen Sie mit! https://www.unicef.de/spe/spe_03.php
Karim
to Rudolf Harney

Hello

I want to know :
What are your favorite sdl bindings for freepascal ? So far I know, there are 2 diffrent bindings.
The Jedi-binings, which are huge and the sdl4fpc bindings, which aren`t complete yet. There are also some docs and tutorials for jedi. But I`ve read they are hard to compile with fpc.
So what are your experiences ?

Greetings Karim

Karim -- http://www.fastmail.fm - Or how I learned to stop worrying and love email again