* Use ansistrings for options. (bug ID 36892)

git-svn-id: trunk@44664 -
This commit is contained in:
michael 2020-04-09 21:05:59 +00:00
parent 9753dd964b
commit a678192c11

View File

@ -14,9 +14,13 @@
**********************************************************************} **********************************************************************}
unit getopts; unit getopts;
Interface
{$modeswitch advancedrecords} {$modeswitch advancedrecords}
{$modeswitch defaultparameters} {$modeswitch defaultparameters}
{$h+}
Interface
Const Const
No_Argument = 0; No_Argument = 0;
Required_Argument = 1; Required_Argument = 1;
@ -51,11 +55,6 @@ Function GetLongOpts (ShortOpts : String;LongOpts : POption;var Longind : Longin
Implementation Implementation
Procedure TOption.SetOption(const aName:String;AHas_Arg:integer=0;AFlag:PChar=nil;AValue:Char=#0);
begin
Name:=aName; Has_Arg:=AHas_Arg; Flag:=AFlag; Value:=Avalue;
end;
{$IFNDEF FPC} {$IFNDEF FPC}
{*************************************************************************** {***************************************************************************
@ -147,6 +146,20 @@ end;
{$ENDIF} {$ENDIF}
function strpas(p : pchar) : ansistring;
begin
if p=nil then
strpas:=''
else
strpas:=p;
end;
Procedure TOption.SetOption(const aName:String;AHas_Arg:integer=0;AFlag:PChar=nil;AValue:Char=#0);
begin
Name:=aName; Has_Arg:=AHas_Arg; Flag:=AFlag; Value:=Avalue;
end;
{*************************************************************************** {***************************************************************************
Real Getopts Real Getopts
***************************************************************************} ***************************************************************************}