mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 18:47:54 +02:00
* preopened dirs structure in the system unit modified to be a pointer to an
array of records
This commit is contained in:
parent
e078408dcf
commit
d45915b6ba
@ -48,12 +48,19 @@ const
|
|||||||
sLineBreak = LineEnding;
|
sLineBreak = LineEnding;
|
||||||
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
|
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
|
||||||
|
|
||||||
|
type
|
||||||
|
PPreopenedDir = ^TPreopenedDir;
|
||||||
|
TPreopenedDir = record
|
||||||
|
dir_name: PChar;
|
||||||
|
fd: longint;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
argc: longint;
|
argc: longint;
|
||||||
argv: PPChar;
|
argv: PPChar;
|
||||||
envp: PPChar;
|
envp: PPChar;
|
||||||
preopened_dirs_count: longint;
|
preopened_dirs_count: longint;
|
||||||
preopened_dirs: PPChar;
|
preopened_dirs: PPreopenedDir;
|
||||||
drives_count: longint;
|
drives_count: longint;
|
||||||
current_dirs: PPChar;
|
current_dirs: PPChar;
|
||||||
current_dir_fds: Plongint;
|
current_dir_fds: Plongint;
|
||||||
@ -128,7 +135,7 @@ begin
|
|||||||
for I:=0 to preopened_dirs_count-1 do
|
for I:=0 to preopened_dirs_count-1 do
|
||||||
begin
|
begin
|
||||||
path:=savepath;
|
path:=savepath;
|
||||||
pdir:=preopened_dirs[I];
|
pdir:=preopened_dirs[I].dir_name;
|
||||||
if HasDriveLetter(pdir) then
|
if HasDriveLetter(pdir) then
|
||||||
begin
|
begin
|
||||||
pdir_drive:=Ord(UpCase(pdir[0]))-(Ord('A')-1);
|
pdir_drive:=Ord(UpCase(pdir[0]))-(Ord('A')-1);
|
||||||
@ -151,7 +158,7 @@ begin
|
|||||||
longest_match:=pdir_length;
|
longest_match:=pdir_length;
|
||||||
while path^ in ['/','\'] do
|
while path^ in ['/','\'] do
|
||||||
Inc(path);
|
Inc(path);
|
||||||
fd:=I+3;
|
fd:=preopened_dirs[I].fd;
|
||||||
FreeMem(relfd_path);
|
FreeMem(relfd_path);
|
||||||
relfd_path:=GetMem(StrLen(path)+1);
|
relfd_path:=GetMem(StrLen(path)+1);
|
||||||
Move(path^,relfd_path^,StrLen(path)+1);
|
Move(path^,relfd_path^,StrLen(path)+1);
|
||||||
@ -203,10 +210,11 @@ begin
|
|||||||
prestat_dir_name[prestat.u.dir.pr_name_len]:=#0;
|
prestat_dir_name[prestat.u.dir.pr_name_len]:=#0;
|
||||||
Inc(preopened_dirs_count);
|
Inc(preopened_dirs_count);
|
||||||
if preopened_dirs=nil then
|
if preopened_dirs=nil then
|
||||||
preopened_dirs:=AllocMem(preopened_dirs_count*SizeOf(PChar))
|
preopened_dirs:=AllocMem(preopened_dirs_count*SizeOf(TPreopenedDir))
|
||||||
else
|
else
|
||||||
ReAllocMem(preopened_dirs, preopened_dirs_count*SizeOf(PChar));
|
ReAllocMem(preopened_dirs, preopened_dirs_count*SizeOf(TPreopenedDir));
|
||||||
preopened_dirs[preopened_dirs_count-1]:=prestat_dir_name;
|
preopened_dirs[preopened_dirs_count-1].dir_name:=prestat_dir_name;
|
||||||
|
preopened_dirs[preopened_dirs_count-1].fd:=fd;
|
||||||
if HasDriveLetter(prestat_dir_name) then
|
if HasDriveLetter(prestat_dir_name) then
|
||||||
drive_nr:=Ord(UpCase(prestat_dir_name[0]))-(Ord('A')-1)
|
drive_nr:=Ord(UpCase(prestat_dir_name[0]))-(Ord('A')-1)
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user