[fpc-pascal]Re: About GetOpts and configuration file parsing

Aitor SantamarĂ­a aitor.sm at wanadoo.es
Fri Jul 12 12:25:26 CEST 2002


Hi,

>program slashopt;
>var
>  I: integer;
>begin
>  { convert options from '/' to '-' before parsing ...
>}
>  for I:=1 to argc -1  do begin
>    if ( argv[I] <> nil ) and ( argv[I][0] = '/' )
>then  begin
>      argv[I][0] := '-' ;
>      if ( argv[I][1] = '/' ) then  argv[I][1] := '-' 
>
well, I am not planning to allow -- at all, I don't like it, so I 
suppose I can skip that row.

>end;
>  end;
>  { ... Now your command line is ready for the getopts
>unit }
>  
>end.
>
do you mean that any FPC program has defined  argc (I suppose ParamCount 
returns this value, then), and argv as an array of PChars, that can be 
modified?

Aitor





More information about the fpc-pascal mailing list