Bläddra i källkod

* Use ansistrings for options. (bug ID 36892)

git-svn-id: trunk@44664 -
michael 5 år sedan
förälder
incheckning
a678192c11
1 ändrade filer med 19 tillägg och 6 borttagningar
  1. 19 6
      rtl/inc/getopts.pp

+ 19 - 6
rtl/inc/getopts.pp

@@ -14,9 +14,13 @@
 
  **********************************************************************}
 unit getopts;
-Interface
+
 {$modeswitch advancedrecords}
 {$modeswitch defaultparameters}
+{$h+}
+
+Interface
+
 Const
   No_Argument       = 0;
   Required_Argument = 1;
@@ -51,11 +55,6 @@ Function GetLongOpts (ShortOpts : String;LongOpts : POption;var Longind : Longin
 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}
 {***************************************************************************
@@ -147,6 +146,20 @@ end;
 
 {$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
 ***************************************************************************}