|
@@ -33,7 +33,7 @@ Interface
|
|
{$ifdef OS2}
|
|
{$ifdef OS2}
|
|
{$define shell_implemented}
|
|
{$define shell_implemented}
|
|
{$endif}
|
|
{$endif}
|
|
-{$ifdef Win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
{$define implemented}
|
|
{$define implemented}
|
|
{$endif}
|
|
{$endif}
|
|
{$ifdef linux}
|
|
{$ifdef linux}
|
|
@@ -96,9 +96,9 @@ Uses
|
|
{$ifdef netware_clib}
|
|
{$ifdef netware_clib}
|
|
nwserv,
|
|
nwserv,
|
|
{$endif netware_clib}
|
|
{$endif netware_clib}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
windows,
|
|
windows,
|
|
-{$endif win32}
|
|
|
|
|
|
+{$endif Windows}
|
|
{$ifdef unix}
|
|
{$ifdef unix}
|
|
{$ifdef ver1_0}
|
|
{$ifdef ver1_0}
|
|
linux,
|
|
linux,
|
|
@@ -188,13 +188,13 @@ end;
|
|
|
|
|
|
{$ifdef TP}
|
|
{$ifdef TP}
|
|
|
|
|
|
-{$ifndef win32}
|
|
|
|
|
|
+{$ifndef Windows}
|
|
const
|
|
const
|
|
UnusedHandle = -1;
|
|
UnusedHandle = -1;
|
|
StdInputHandle = 0;
|
|
StdInputHandle = 0;
|
|
StdOutputHandle = 1;
|
|
StdOutputHandle = 1;
|
|
StdErrorHandle = 2;
|
|
StdErrorHandle = 2;
|
|
-{$endif win32}
|
|
|
|
|
|
+{$endif Windows}
|
|
|
|
|
|
Type
|
|
Type
|
|
PtrRec = packed record
|
|
PtrRec = packed record
|
|
@@ -280,7 +280,7 @@ end;
|
|
|
|
|
|
{$endif def go32v2}
|
|
{$endif def go32v2}
|
|
|
|
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
Function fpclose(Handle : Longint) : boolean;
|
|
Function fpclose(Handle : Longint) : boolean;
|
|
begin
|
|
begin
|
|
{ Do we need this ?? }
|
|
{ Do we need this ?? }
|
|
@@ -391,14 +391,14 @@ function ChangeRedirOut(Const Redir : String; AppendToFile : Boolean) : Boolean;
|
|
ChangeRedirOut:=True;
|
|
ChangeRedirOut:=True;
|
|
OutRedirDisabled:=False;
|
|
OutRedirDisabled:=False;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
if SetStdHandle(Std_Output_Handle,FileRec(FOUT^).Handle) then
|
|
if SetStdHandle(Std_Output_Handle,FileRec(FOUT^).Handle) then
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
TempHOut:=fpdup(StdOutputHandle);
|
|
TempHOut:=fpdup(StdOutputHandle);
|
|
fpdup2(FileRec(FOUT^).Handle,StdOutputHandle);
|
|
fpdup2(FileRec(FOUT^).Handle,StdOutputHandle);
|
|
if (TempHOut<>UnusedHandle) and
|
|
if (TempHOut<>UnusedHandle) and
|
|
(StdOutputHandle<>UnusedHandle) then
|
|
(StdOutputHandle<>UnusedHandle) then
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
begin
|
|
begin
|
|
ChangeRedirOut:=True;
|
|
ChangeRedirOut:=True;
|
|
OutRedirDisabled:=False;
|
|
OutRedirDisabled:=False;
|
|
@@ -424,14 +424,14 @@ function ChangeRedirIn(Const Redir : String) : Boolean;
|
|
ChangeRedirIn:=True;
|
|
ChangeRedirIn:=True;
|
|
InRedirDisabled:=False;
|
|
InRedirDisabled:=False;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
if SetStdHandle(Std_Input_Handle,FileRec(FIN^).Handle) then
|
|
if SetStdHandle(Std_Input_Handle,FileRec(FIN^).Handle) then
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
TempHIn:=fpdup(StdInputHandle);
|
|
TempHIn:=fpdup(StdInputHandle);
|
|
fpdup2(FileRec(FIn^).Handle,StdInputHandle);
|
|
fpdup2(FileRec(FIn^).Handle,StdInputHandle);
|
|
if (TempHIn<>UnusedHandle) and
|
|
if (TempHIn<>UnusedHandle) and
|
|
(StdInputHandle<>UnusedHandle) then
|
|
(StdInputHandle<>UnusedHandle) then
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
begin
|
|
begin
|
|
ChangeRedirIn:=True;
|
|
ChangeRedirIn:=True;
|
|
InRedirDisabled:=False;
|
|
InRedirDisabled:=False;
|
|
@@ -461,14 +461,14 @@ function ChangeRedirError(Const Redir : String; AppendToFile : Boolean) : Boolea
|
|
ChangeRedirError:=True;
|
|
ChangeRedirError:=True;
|
|
ErrorRedirDisabled:=False;
|
|
ErrorRedirDisabled:=False;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
if SetStdHandle(Std_Error_Handle,FileRec(FERR^).Handle) then
|
|
if SetStdHandle(Std_Error_Handle,FileRec(FERR^).Handle) then
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
TempHError:=fpdup(StdErrorHandle);
|
|
TempHError:=fpdup(StdErrorHandle);
|
|
fpdup2(FileRec(FERR^).Handle,StdErrorHandle);
|
|
fpdup2(FileRec(FERR^).Handle,StdErrorHandle);
|
|
if (TempHError<>UnusedHandle) and
|
|
if (TempHError<>UnusedHandle) and
|
|
(StdErrorHandle<>UnusedHandle) then
|
|
(StdErrorHandle<>UnusedHandle) then
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
begin
|
|
begin
|
|
ChangeRedirError:=True;
|
|
ChangeRedirError:=True;
|
|
ErrorRedirDisabled:=False;
|
|
ErrorRedirDisabled:=False;
|
|
@@ -520,11 +520,11 @@ end;
|
|
Handles^[StdOutputHandle]:=OldHandleOut;
|
|
Handles^[StdOutputHandle]:=OldHandleOut;
|
|
OldHandleOut:=StdOutputHandle;
|
|
OldHandleOut:=StdOutputHandle;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Output_Handle,StdOutputHandle);
|
|
SetStdHandle(Std_Output_Handle,StdOutputHandle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
fpdup2(TempHOut,StdOutputHandle);
|
|
fpdup2(TempHOut,StdOutputHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif FPC}
|
|
{$endif FPC}
|
|
Close (FOUT^);
|
|
Close (FOUT^);
|
|
fpclose(TempHOut);
|
|
fpclose(TempHOut);
|
|
@@ -541,11 +541,11 @@ end;
|
|
Handles^[StdInputHandle]:=OldHandleIn;
|
|
Handles^[StdInputHandle]:=OldHandleIn;
|
|
OldHandleIn:=StdInputHandle;
|
|
OldHandleIn:=StdInputHandle;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Input_Handle,StdInputHandle);
|
|
SetStdHandle(Std_Input_Handle,StdInputHandle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
fpdup2(TempHIn,StdInputHandle);
|
|
fpdup2(TempHIn,StdInputHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif}
|
|
{$endif}
|
|
Close (FIn^);
|
|
Close (FIn^);
|
|
fpclose(TempHIn);
|
|
fpclose(TempHIn);
|
|
@@ -562,11 +562,11 @@ end;
|
|
{$ifndef FPC}
|
|
{$ifndef FPC}
|
|
Handles^[StdInputHandle]:=OldHandleIn;
|
|
Handles^[StdInputHandle]:=OldHandleIn;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Input_Handle,StdInputHandle);
|
|
SetStdHandle(Std_Input_Handle,StdInputHandle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
fpdup2(TempHIn,StdInputHandle);
|
|
fpdup2(TempHIn,StdInputHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif}
|
|
{$endif}
|
|
InRedirDisabled:=True;
|
|
InRedirDisabled:=True;
|
|
end;
|
|
end;
|
|
@@ -582,11 +582,11 @@ end;
|
|
Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
|
|
Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
|
|
Handles^[StdInputHandle]:=Handles^[FileRec (FIn^).Handle];
|
|
Handles^[StdInputHandle]:=Handles^[FileRec (FIn^).Handle];
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Input_Handle,FileRec(FIn^).Handle);
|
|
SetStdHandle(Std_Input_Handle,FileRec(FIn^).Handle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
fpdup2(FileRec(FIn^).Handle,StdInputHandle);
|
|
fpdup2(FileRec(FIn^).Handle,StdInputHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif}
|
|
{$endif}
|
|
InRedirDisabled:=False;
|
|
InRedirDisabled:=False;
|
|
end;
|
|
end;
|
|
@@ -601,11 +601,11 @@ end;
|
|
{$ifndef FPC}
|
|
{$ifndef FPC}
|
|
Handles^[StdOutputHandle]:=OldHandleOut;
|
|
Handles^[StdOutputHandle]:=OldHandleOut;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Output_Handle,StdOutputHandle);
|
|
SetStdHandle(Std_Output_Handle,StdOutputHandle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
fpdup2(TempHOut,StdOutputHandle);
|
|
fpdup2(TempHOut,StdOutputHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif}
|
|
{$endif}
|
|
OutRedirDisabled:=True;
|
|
OutRedirDisabled:=True;
|
|
end;
|
|
end;
|
|
@@ -621,11 +621,11 @@ end;
|
|
Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
|
|
Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
|
|
Handles^[StdOutputHandle]:=Handles^[FileRec (FOut^).Handle];
|
|
Handles^[StdOutputHandle]:=Handles^[FileRec (FOut^).Handle];
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Output_Handle,FileRec(FOut^).Handle);
|
|
SetStdHandle(Std_Output_Handle,FileRec(FOut^).Handle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
fpdup2(FileRec(FOut^).Handle,StdOutputHandle);
|
|
fpdup2(FileRec(FOut^).Handle,StdOutputHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif}
|
|
{$endif}
|
|
OutRedirDisabled:=False;
|
|
OutRedirDisabled:=False;
|
|
end;
|
|
end;
|
|
@@ -640,11 +640,11 @@ end;
|
|
Handles^[StdErrorHandle]:=OldHandleError;
|
|
Handles^[StdErrorHandle]:=OldHandleError;
|
|
OldHandleError:=StdErrorHandle;
|
|
OldHandleError:=StdErrorHandle;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Error_Handle,StdErrorHandle);
|
|
SetStdHandle(Std_Error_Handle,StdErrorHandle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
fpdup2(TempHError,StdErrorHandle);
|
|
fpdup2(TempHError,StdErrorHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif}
|
|
{$endif}
|
|
Close (FERR^);
|
|
Close (FERR^);
|
|
fpclose(TempHError);
|
|
fpclose(TempHError);
|
|
@@ -661,11 +661,11 @@ end;
|
|
{$ifndef FPC}
|
|
{$ifndef FPC}
|
|
Handles^[StdErrorHandle]:=OldHandleError;
|
|
Handles^[StdErrorHandle]:=OldHandleError;
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Error_Handle,StdErrorHandle);
|
|
SetStdHandle(Std_Error_Handle,StdErrorHandle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(TempHError,StdErrorHandle);
|
|
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(TempHError,StdErrorHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif}
|
|
{$endif}
|
|
ErrorRedirDisabled:=True;
|
|
ErrorRedirDisabled:=True;
|
|
end;
|
|
end;
|
|
@@ -681,11 +681,11 @@ end;
|
|
Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
|
|
Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
|
|
Handles^[StdErrorHandle]:=Handles^[FileRec (FErr^).Handle];
|
|
Handles^[StdErrorHandle]:=Handles^[FileRec (FErr^).Handle];
|
|
{$else}
|
|
{$else}
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
SetStdHandle(Std_Error_Handle,FileRec(FErr^).Handle);
|
|
SetStdHandle(Std_Error_Handle,FileRec(FErr^).Handle);
|
|
-{$else not win32}
|
|
|
|
|
|
+{$else not Windows}
|
|
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(FileRec(FERR^).Handle,StdErrorHandle);
|
|
{$ifdef ver1_0}dup2{$else}fpdup2{$endif}(FileRec(FERR^).Handle,StdErrorHandle);
|
|
-{$endif not win32}
|
|
|
|
|
|
+{$endif not Windows}
|
|
{$endif}
|
|
{$endif}
|
|
ErrorRedirDisabled:=False;
|
|
ErrorRedirDisabled:=False;
|
|
end;
|
|
end;
|
|
@@ -693,10 +693,10 @@ end;
|
|
{............................................................................}
|
|
{............................................................................}
|
|
|
|
|
|
function ExecuteRedir (Const ProgName, ComLine, RedirStdIn, RedirStdOut, RedirStdErr : String) : boolean;
|
|
function ExecuteRedir (Const ProgName, ComLine, RedirStdIn, RedirStdOut, RedirStdErr : String) : boolean;
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
var
|
|
var
|
|
mode : word;
|
|
mode : word;
|
|
-{$endif win32}
|
|
|
|
|
|
+{$endif Windows}
|
|
Begin
|
|
Begin
|
|
RedirErrorOut:=0; RedirErrorIn:=0; RedirErrorError:=0;
|
|
RedirErrorOut:=0; RedirErrorIn:=0; RedirErrorError:=0;
|
|
ExecuteResult:=0;
|
|
ExecuteResult:=0;
|
|
@@ -714,12 +714,12 @@ Begin
|
|
ExecuteRedir:=(IOStatus=0) and (RedirErrorOut=0) and
|
|
ExecuteRedir:=(IOStatus=0) and (RedirErrorOut=0) and
|
|
(RedirErrorIn=0) and (RedirErrorError=0) and
|
|
(RedirErrorIn=0) and (RedirErrorError=0) and
|
|
(ExecuteResult=0);
|
|
(ExecuteResult=0);
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
// reenable mouse events
|
|
// reenable mouse events
|
|
GetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), @mode);
|
|
GetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), @mode);
|
|
mode:=mode or ENABLE_MOUSE_INPUT;
|
|
mode:=mode or ENABLE_MOUSE_INPUT;
|
|
SetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), mode);
|
|
SetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), mode);
|
|
-{$endif win32}
|
|
|
|
|
|
+{$endif Windows}
|
|
End;
|
|
End;
|
|
|
|
|
|
{............................................................................}
|
|
{............................................................................}
|
|
@@ -930,10 +930,10 @@ end;
|
|
{............................................................................}
|
|
{............................................................................}
|
|
|
|
|
|
procedure DosExecute(ProgName, ComLine : String);
|
|
procedure DosExecute(ProgName, ComLine : String);
|
|
-{$ifdef win32}
|
|
|
|
|
|
+{$ifdef Windows}
|
|
var
|
|
var
|
|
StoreInherit : BOOL;
|
|
StoreInherit : BOOL;
|
|
-{$endif win32}
|
|
|
|
|
|
+{$endif Windows}
|
|
|
|
|
|
Begin
|
|
Begin
|
|
{$IfDef MsDos}
|
|
{$IfDef MsDos}
|
|
@@ -950,10 +950,10 @@ end;
|
|
ExecuteResult:=((-ExecuteResult) and $ff00) shr 8;
|
|
ExecuteResult:=((-ExecuteResult) and $ff00) shr 8;
|
|
end;
|
|
end;
|
|
{$else}
|
|
{$else}
|
|
- {$ifdef win32}
|
|
|
|
|
|
+ {$ifdef Windows}
|
|
StoreInherit:=ExecInheritsHandles;
|
|
StoreInherit:=ExecInheritsHandles;
|
|
ExecInheritsHandles:=true;
|
|
ExecInheritsHandles:=true;
|
|
- {$endif win32}
|
|
|
|
|
|
+ {$endif Windows}
|
|
DosError:=0;
|
|
DosError:=0;
|
|
If UseComSpec then
|
|
If UseComSpec then
|
|
Dos.Exec (Getenv('COMSPEC'),'/C '+MaybeQuoted(FixPath(progname))+' '+Comline)
|
|
Dos.Exec (Getenv('COMSPEC'),'/C '+MaybeQuoted(FixPath(progname))+' '+Comline)
|
|
@@ -964,9 +964,9 @@ end;
|
|
else
|
|
else
|
|
DosError:=2;
|
|
DosError:=2;
|
|
end;
|
|
end;
|
|
- {$ifdef win32}
|
|
|
|
|
|
+ {$ifdef Windows}
|
|
ExecInheritsHandles:=StoreInherit;
|
|
ExecInheritsHandles:=StoreInherit;
|
|
- {$endif win32}
|
|
|
|
|
|
+ {$endif Windows}
|
|
IOStatus:=DosError;
|
|
IOStatus:=DosError;
|
|
ExecuteResult:=DosExitCode;
|
|
ExecuteResult:=DosExitCode;
|
|
{$endif}
|
|
{$endif}
|