mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-28 17:41:57 +01:00
+ more cleanup
git-svn-id: trunk@2574 -
This commit is contained in:
parent
e363da694b
commit
a00da18d3a
@ -379,7 +379,7 @@ begin
|
|||||||
dispose(cd);
|
dispose(cd);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
[rocedure SetDate(Year, Month, Day: Word);
|
procedure SetDate(Year, Month, Day: Word);
|
||||||
var
|
var
|
||||||
cd : pClockData;
|
cd : pClockData;
|
||||||
oldtime : ttimeval;
|
oldtime : ttimeval;
|
||||||
@ -443,25 +443,24 @@ procedure Exec(const Path: PathStr; const ComLine: ComStr);
|
|||||||
var
|
var
|
||||||
tmpPath: array[0..255] of char;
|
tmpPath: array[0..255] of char;
|
||||||
result : longint;
|
result : longint;
|
||||||
MyLock : longint;
|
tmpLock: longint;
|
||||||
begin
|
begin
|
||||||
DosError := 0;
|
DosError:= 0;
|
||||||
LastDosExitCode := 0;
|
LastDosExitCode:=0;
|
||||||
tmpPath:=PathConv(Path+' '+ComLine);
|
tmpPath:=PathConv(Path)+#0+ComLine+#0; // hacky... :)
|
||||||
Move(p[1],buf,length(p));
|
|
||||||
buf[Length(p)]:=#0;
|
|
||||||
|
|
||||||
{ Here we must first check if the command we wish to execute }
|
{ Here we must first check if the command we wish to execute }
|
||||||
{ actually exists, because this is NOT handled by the }
|
{ actually exists, because this is NOT handled by the }
|
||||||
{ _SystemTagList call (program will abort!!) }
|
{ _SystemTagList call (program will abort!!) }
|
||||||
|
|
||||||
{ Try to open with shared lock }
|
{ Try to open with shared lock }
|
||||||
MyLock:=dosLock(Path,SHARED_LOCK);
|
tmpLock:=Lock(tmpPath,SHARED_LOCK);
|
||||||
if MyLock <> 0 then
|
if tmpLock<>0 then
|
||||||
begin
|
begin
|
||||||
{ File exists - therefore unlock it }
|
{ File exists - therefore unlock it }
|
||||||
Unlock(MyLock);
|
Unlock(tmpLock);
|
||||||
result:=SystemTagList(buf,nil);
|
tmpPath[length(Path)]:=' '; // hacky... replaces first #0 from above, to get the whole string. :)
|
||||||
|
result:=SystemTagList(tmpPath,nil);
|
||||||
{ on return of -1 the shell could not be executed }
|
{ on return of -1 the shell could not be executed }
|
||||||
{ probably because there was not enough memory }
|
{ probably because there was not enough memory }
|
||||||
if result = -1 then
|
if result = -1 then
|
||||||
@ -834,17 +833,16 @@ begin
|
|||||||
DosError:=0;
|
DosError:=0;
|
||||||
flags:=FIBF_WRITE;
|
flags:=FIBF_WRITE;
|
||||||
|
|
||||||
|
{ By default files are read-write }
|
||||||
|
if attr and ReadOnly <> 0 then flags:=FIBF_READ; { Clear the Fibf_write flags }
|
||||||
|
|
||||||
{ no need for path conversion here, because file opening already }
|
{ no need for path conversion here, because file opening already }
|
||||||
{ converts the path (KB) }
|
{ converts the path (KB) }
|
||||||
|
|
||||||
{ create a shared lock on the file }
|
{ create a shared lock on the file }
|
||||||
tmpLock:=Lock(filerec(f).name,SHARED_LOCK);
|
tmpLock:=Lock(filerec(f).name,SHARED_LOCK);
|
||||||
|
if tmpLock <> 0 then begin
|
||||||
{ By default files are read-write }
|
Unlock(tmpLock);
|
||||||
if attr and ReadOnly <> 0 then flags:=FIBF_READ; { Clear the Fibf_write flags }
|
|
||||||
|
|
||||||
if MyLock <> 0 then begin
|
|
||||||
Unlock(MyLock);
|
|
||||||
if not SetProtection(filerec(f).name,flags) then DosError:=5;
|
if not SetProtection(filerec(f).name,flags) then DosError:=5;
|
||||||
end else
|
end else
|
||||||
DosError:=3;
|
DosError:=3;
|
||||||
@ -857,7 +855,7 @@ end;
|
|||||||
******************************************************************************}
|
******************************************************************************}
|
||||||
|
|
||||||
var
|
var
|
||||||
strofpaths : string[255];
|
strofpaths : string;
|
||||||
|
|
||||||
function getpathstring: string;
|
function getpathstring: string;
|
||||||
var
|
var
|
||||||
@ -895,20 +893,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function EnvCount: Longint;
|
function EnvCount: Longint;
|
||||||
{ HOW TO GET THIS VALUE: }
|
{ HOW TO GET THIS VALUE: }
|
||||||
{ Each time this function is called, we look at the }
|
{ Each time this function is called, we look at the }
|
||||||
{ local variables in the Process structure (2.0+) }
|
{ local variables in the Process structure (2.0+) }
|
||||||
{ And we also read all files in the ENV: directory }
|
{ And we also read all files in the ENV: directory }
|
||||||
Begin
|
begin
|
||||||
EnvCount := 0;
|
EnvCount := 0;
|
||||||
End;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function EnvStr(Index: LongInt): String;
|
function EnvStr(Index: LongInt): String;
|
||||||
Begin
|
begin
|
||||||
EnvStr:='';
|
EnvStr:='';
|
||||||
End;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user