mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-05 16:09:33 +01:00
* Use ansistrings for options. (bug ID 36892)
git-svn-id: trunk@44664 -
This commit is contained in:
parent
9753dd964b
commit
a678192c11
@ -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
|
||||||
***************************************************************************}
|
***************************************************************************}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user