mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 16:09:25 +02:00
* Fix bug ID #19842 using patch from Bart Broersma
git-svn-id: trunk@40908 -
This commit is contained in:
parent
7bda42edac
commit
e69f4c1e4b
@ -47,27 +47,24 @@ Function GetLongOpts (ShortOpts : String;LongOpts : POption;var Longind : Longin
|
|||||||
|
|
||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
{$IFNDEF FPC}
|
|
||||||
{$ifdef TP}
|
|
||||||
uses strings;
|
|
||||||
{$else }
|
|
||||||
uses SysUtils;
|
|
||||||
type PtrInt = Integer;
|
|
||||||
{$endif}
|
|
||||||
{$ENDIF FPC}
|
|
||||||
|
|
||||||
|
{$IFNDEF FPC}
|
||||||
{***************************************************************************
|
{***************************************************************************
|
||||||
Create an ArgV
|
Create an ArgV
|
||||||
***************************************************************************}
|
***************************************************************************}
|
||||||
|
|
||||||
{$IF not Declared(argv)} //{$ifdef TP}
|
uses SysUtils;
|
||||||
|
|
||||||
|
type PtrInt = Integer;
|
||||||
|
|
||||||
type
|
type
|
||||||
ppchar = ^pchar;
|
ppchar = ^pchar;
|
||||||
apchar = array[0..127] of pchar;
|
apchar = array[0..127] of pchar;
|
||||||
|
|
||||||
var
|
var
|
||||||
argc : longint;
|
argc : longint;
|
||||||
argv : apchar;
|
argv : apchar;
|
||||||
|
|
||||||
const
|
const
|
||||||
CHAR_SIZE = SizeOf(Char);
|
CHAR_SIZE = SizeOf(Char);
|
||||||
|
|
||||||
@ -139,7 +136,7 @@ begin
|
|||||||
move(argsbuf,argv,count shl 2);
|
move(argsbuf,argv,count shl 2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFEND} //{$endif TP}
|
{$ENDIF}
|
||||||
|
|
||||||
{***************************************************************************
|
{***************************************************************************
|
||||||
Real Getopts
|
Real Getopts
|
||||||
@ -167,7 +164,7 @@ begin
|
|||||||
if (top-middle>middle-bottom) then
|
if (top-middle>middle-bottom) then
|
||||||
begin
|
begin
|
||||||
len:=middle-bottom;
|
len:=middle-bottom;
|
||||||
for i:=1 to len-1 do
|
for i:=0 to len-1 do
|
||||||
begin
|
begin
|
||||||
temp:=argv[bottom+i];
|
temp:=argv[bottom+i];
|
||||||
argv[bottom+i]:=argv[top-(middle-bottom)+i];
|
argv[bottom+i]:=argv[top-(middle-bottom)+i];
|
||||||
@ -496,17 +493,8 @@ begin
|
|||||||
getlongopts:=internal_getopt(shortopts,longopts,@longind,true);
|
getlongopts:=internal_getopt(shortopts,longopts,@longind,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef FPC}
|
initialization
|
||||||
initialization
|
{ create argv if not running under FPC }
|
||||||
{$endif}
|
|
||||||
{$ifndef FPC}
|
|
||||||
{$ifdef TP}
|
|
||||||
begin
|
|
||||||
{$else}
|
|
||||||
initialization
|
|
||||||
{$endif}
|
|
||||||
{$endif}
|
|
||||||
{ create argv if running under TP }
|
|
||||||
{$ifndef FPC}
|
{$ifndef FPC}
|
||||||
setup_arguments;
|
setup_arguments;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
Loading…
Reference in New Issue
Block a user