mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 01:48:00 +02:00
* overloaded ExecuteProcess added, EnvStr param changed to longint
This commit is contained in:
parent
04a8acc442
commit
601f2e02ce
@ -167,7 +167,11 @@ End;
|
||||
--- Exec ---
|
||||
******************************************************************************}
|
||||
|
||||
{$ifdef HASTHREADVAR}
|
||||
threadvar
|
||||
{$else HASTHREADVAR}
|
||||
var
|
||||
{$endif HASTHREADVAR}
|
||||
lastdosexitcode : word;
|
||||
|
||||
procedure exec(const path : pathstr;const comline : comstr);
|
||||
@ -892,7 +896,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function envstr(index : integer) : string;
|
||||
function envstr (Index: longint): string;
|
||||
begin
|
||||
if (index<=0) or (index>envcount) then
|
||||
begin
|
||||
@ -946,7 +950,10 @@ End;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.18 2004-02-09 12:03:16 michael
|
||||
Revision 1.19 2004-02-15 21:34:06 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.18 2004/02/09 12:03:16 michael
|
||||
+ Switched to single interface in dosh.inc
|
||||
|
||||
Revision 1.17 2004/01/06 00:58:35 florian
|
||||
|
@ -782,6 +782,25 @@ begin
|
||||
Result := DosExitCode;
|
||||
end;
|
||||
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString;
|
||||
const ComLine: array of AnsiString): integer;
|
||||
|
||||
var
|
||||
CommandLine: AnsiString;
|
||||
I: integer;
|
||||
|
||||
begin
|
||||
Commandline := '';
|
||||
for I := 0 to High (ComLine) do
|
||||
if Pos (' ', ComLine [I]) <> 0 then
|
||||
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
||||
else
|
||||
CommandLine := CommandLine + ' ' + Comline [I];
|
||||
ExecuteProcess := ExecuteProcess (Path, CommandLine);
|
||||
end;
|
||||
|
||||
|
||||
{*************************************************************************
|
||||
Sleep (copied from crt.Delay)
|
||||
*************************************************************************}
|
||||
@ -860,7 +879,10 @@ Finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.23 2004-01-25 13:05:08 jonas
|
||||
Revision 1.24 2004-02-15 21:34:06 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.23 2004/01/25 13:05:08 jonas
|
||||
* fixed compilation errors
|
||||
|
||||
Revision 1.22 2004/01/20 23:09:14 hajny
|
||||
|
@ -105,7 +105,7 @@ function GetLongName(var p : String) : boolean;
|
||||
|
||||
{Environment}
|
||||
Function EnvCount: longint;
|
||||
Function EnvStr(index: integer): string;
|
||||
Function EnvStr (Index: longint): string;
|
||||
Function GetEnv(envvar: string): string;
|
||||
|
||||
{Misc}
|
||||
|
@ -134,7 +134,11 @@ End;
|
||||
--- Exec ---
|
||||
******************************************************************************}
|
||||
|
||||
{$ifdef HASTHREADVAR}
|
||||
threadvar
|
||||
{$else HASTHREADVAR}
|
||||
var
|
||||
{$endif HASTHREADVAR}
|
||||
lastdosexitcode : word;
|
||||
|
||||
procedure exec(const path : pathstr;const comline : comstr);
|
||||
@ -691,7 +695,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function envstr(index : integer) : string;
|
||||
function envstr (index: longint) : string;
|
||||
begin
|
||||
envstr := ''; {is there a netware function to do that ?????}
|
||||
ConsolePrintf ('warning: fpc dos.envstr not implemented'#13#10,0);
|
||||
@ -746,7 +750,10 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 2004-02-09 12:03:16 michael
|
||||
Revision 1.8 2004-02-15 21:34:06 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.7 2004/02/09 12:03:16 michael
|
||||
+ Switched to single interface in dosh.inc
|
||||
|
||||
Revision 1.6 2003/03/25 18:17:54 armin
|
||||
|
@ -509,6 +509,26 @@ begin
|
||||
Result := DosExitCode;
|
||||
end;
|
||||
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString;
|
||||
const ComLine: array of AnsiString): integer;
|
||||
|
||||
var
|
||||
CommandLine: AnsiString;
|
||||
I: integer;
|
||||
|
||||
begin
|
||||
Commandline := '';
|
||||
for I := 0 to High (ComLine) do
|
||||
if Pos (' ', ComLine [I]) <> 0 then
|
||||
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
||||
else
|
||||
CommandLine := CommandLine + ' ' + Comline [I];
|
||||
ExecuteProcess := ExecuteProcess (Path, CommandLine);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Initialization code
|
||||
****************************************************************************}
|
||||
@ -522,7 +542,10 @@ end.
|
||||
{
|
||||
|
||||
$Log$
|
||||
Revision 1.14 2004-01-20 23:11:20 hajny
|
||||
Revision 1.15 2004-02-15 21:34:06 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.14 2004/01/20 23:11:20 hajny
|
||||
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||
|
||||
Revision 1.13 2003/11/26 20:00:19 florian
|
||||
|
@ -93,10 +93,7 @@ const
|
||||
(* For compatibility with VP/2, used for runflags in Exec procedure. *)
|
||||
ExecFlags: cardinal = ord (efwait);
|
||||
|
||||
var
|
||||
dosexitcodevar:word;
|
||||
|
||||
{$I dosh.inc}
|
||||
{$i dosh.inc}
|
||||
|
||||
{OS/2 specific functions}
|
||||
|
||||
@ -160,14 +157,21 @@ begin
|
||||
DosError := integer (RC);
|
||||
end;
|
||||
|
||||
procedure exec(const path:pathstr;const comline:comstr);
|
||||
{$ifdef HASTHREADVAR}
|
||||
threadvar
|
||||
{$else HASTHREADVAR}
|
||||
var
|
||||
{$endif HASTHREADVAR}
|
||||
LastDosExitCode: longint;
|
||||
|
||||
procedure exec (const path:pathstr;const comline:comstr);
|
||||
{Execute a program.}
|
||||
begin
|
||||
dosexitcodevar:=word(exec(path,execrunflags(ExecFlags),efdefault,comline));
|
||||
LastDosExitCode := Exec (Path, ExecRunFlags (ExecFlags), efDefault, ComLine);
|
||||
end;
|
||||
|
||||
function exec(path:pathstr;runflags:execrunflags;winflags:execwinflags;
|
||||
const comline:comstr):longint;
|
||||
function Exec (path:pathstr;runflags:execrunflags;winflags:execwinflags;
|
||||
const comline:comstr): longint;
|
||||
{Execute a program. More suitable for OS/2 than the exec above.}
|
||||
var args:Pbytearray;
|
||||
env:Pbytearray;
|
||||
@ -257,6 +261,13 @@ begin
|
||||
a system function I ever wrote!}
|
||||
end;
|
||||
|
||||
|
||||
function DosExitCode: word;
|
||||
begin
|
||||
DosExitCode := LastDosExitCode and $FFFF;
|
||||
end;
|
||||
|
||||
|
||||
function dosversion:word;
|
||||
{Returns OS/2 version}
|
||||
var
|
||||
@ -425,7 +436,7 @@ begin
|
||||
envcount:=envc;
|
||||
end;
|
||||
|
||||
function envstr(index : integer) : string;
|
||||
function envstr (index : longint) : string;
|
||||
|
||||
var hp:Pchar;
|
||||
|
||||
@ -628,31 +639,33 @@ begin
|
||||
DosError := integer (RC);
|
||||
end;
|
||||
|
||||
function DosExitCode: word;
|
||||
begin
|
||||
DosExitCode:=dosexitcodevar;
|
||||
end;
|
||||
|
||||
Procedure Intr(intno: byte; var regs: registers);
|
||||
|
||||
{******************************************************************************
|
||||
--- Not Supported ---
|
||||
******************************************************************************}
|
||||
|
||||
procedure Keep (ExitCode: word);
|
||||
begin
|
||||
end;
|
||||
|
||||
Procedure MSDos(var regs: registers);
|
||||
procedure GetIntVec (IntNo: byte; var Vector: pointer);
|
||||
begin
|
||||
end;
|
||||
|
||||
Procedure GetIntVec(intno: byte; var vector: pointer);
|
||||
procedure SetIntVec (IntNo: byte; Vector: pointer);
|
||||
begin
|
||||
end;
|
||||
|
||||
Procedure SetIntVec(intno: byte; vector: pointer);
|
||||
procedure Intr (IntNo: byte; var Regs: Registers);
|
||||
begin
|
||||
end;
|
||||
|
||||
Procedure Keep(exitcode: word);
|
||||
procedure MsDos (var Regs: Registers);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
function GetShortName(var p : String) : boolean;
|
||||
begin
|
||||
GetShortName:=true;
|
||||
@ -661,12 +674,20 @@ end;
|
||||
function GetLongName(var p : String) : boolean;
|
||||
begin
|
||||
GetLongName:=true;
|
||||
{$WARNING EA .longname support should be probably added here}
|
||||
end;
|
||||
|
||||
|
||||
|
||||
begin
|
||||
LastDosExitCode := 0;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.35 2004-02-15 08:02:44 yuri
|
||||
Revision 1.36 2004-02-15 21:34:06 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.35 2004/02/15 08:02:44 yuri
|
||||
* fixes for dosh.inc
|
||||
* Executeprocess iverloaded function
|
||||
* updated todo
|
||||
|
@ -944,18 +944,25 @@ begin
|
||||
raise E;
|
||||
end;
|
||||
|
||||
function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString):integer;
|
||||
|
||||
Var
|
||||
CommandLine : AnsiString;
|
||||
i : Integer;
|
||||
function ExecuteProcess (const Path: AnsiString;
|
||||
const ComLine: array of AnsiString): integer;
|
||||
|
||||
var
|
||||
CommandLine: AnsiString;
|
||||
I: integer;
|
||||
|
||||
begin
|
||||
Commandline := '';
|
||||
for I := 0 to High (ComLine) do
|
||||
if Pos (' ', ComLine [I]) <> 0 then
|
||||
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
||||
else
|
||||
CommandLine := CommandLine + ' ' + Comline [I];
|
||||
ExecuteProcess := ExecuteProcess (Path, CommandLine);
|
||||
end;
|
||||
|
||||
|
||||
Begin
|
||||
Commandline:='';
|
||||
For i:=0 to high(ComLine) Do
|
||||
Commandline:=CommandLine+' '+Comline[i];
|
||||
ExecuteProcess:=ExecuteProcess(Path,CommandLine);
|
||||
End;
|
||||
|
||||
{****************************************************************************
|
||||
Initialization code
|
||||
@ -970,7 +977,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.41 2004-02-15 08:02:44 yuri
|
||||
Revision 1.42 2004-02-15 21:36:10 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.41 2004/02/15 08:02:44 yuri
|
||||
* fixes for dosh.inc
|
||||
* Executeprocess iverloaded function
|
||||
* updated todo
|
||||
|
@ -271,6 +271,26 @@ begin
|
||||
Result := DosExitCode;
|
||||
end;
|
||||
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString;
|
||||
const ComLine: array of AnsiString): integer;
|
||||
|
||||
var
|
||||
CommandLine: AnsiString;
|
||||
I: integer;
|
||||
|
||||
begin
|
||||
Commandline := '';
|
||||
for I := 0 to High (ComLine) do
|
||||
if Pos (' ', ComLine [I]) <> 0 then
|
||||
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
||||
else
|
||||
CommandLine := CommandLine + ' ' + Comline [I];
|
||||
ExecuteProcess := ExecuteProcess (Path, CommandLine);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Initialization code
|
||||
****************************************************************************}
|
||||
@ -284,7 +304,10 @@ Finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2004-01-20 23:12:49 hajny
|
||||
Revision 1.5 2004-02-15 21:36:10 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.4 2004/01/20 23:12:49 hajny
|
||||
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||
|
||||
Revision 1.3 2003/03/29 15:16:26 hajny
|
||||
|
@ -223,7 +223,11 @@ End;
|
||||
--- Exec ---
|
||||
******************************************************************************}
|
||||
|
||||
{$ifdef HASTHREADVAR}
|
||||
threadvar
|
||||
{$else HASTHREADVAR}
|
||||
var
|
||||
{$endif HASTHREADVAR}
|
||||
LastDosExitCode: word;
|
||||
|
||||
Procedure Exec (Const Path: PathStr; Const ComLine: ComStr);
|
||||
@ -683,7 +687,7 @@ End;
|
||||
|
||||
|
||||
|
||||
Function EnvStr(Index: Integer): String;
|
||||
Function EnvStr (Index: longint): String;
|
||||
Var
|
||||
i : longint;
|
||||
p : ppchar;
|
||||
@ -824,7 +828,10 @@ End.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.25 2004-02-09 17:01:28 marco
|
||||
Revision 1.26 2004-02-15 21:36:10 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.25 2004/02/09 17:01:28 marco
|
||||
* fixes to get it working under FreeBSD, and probably Linux too
|
||||
|
||||
Revision 1.24 2004/02/09 12:03:16 michael
|
||||
|
@ -167,7 +167,11 @@ End;
|
||||
--- Exec ---
|
||||
******************************************************************************}
|
||||
|
||||
{$ifdef HASTHREADVAR}
|
||||
threadvar
|
||||
{$else HASTHREADVAR}
|
||||
var
|
||||
{$endif HASTHREADVAR}
|
||||
lastdosexitcode : word;
|
||||
|
||||
procedure exec(const path : pathstr;const comline : comstr);
|
||||
@ -892,7 +896,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function envstr(index : integer) : string;
|
||||
function EnvStr (Index: longint): string;
|
||||
begin
|
||||
if (index<=0) or (index>envcount) then
|
||||
begin
|
||||
@ -947,7 +951,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 2004-02-09 12:03:16 michael
|
||||
Revision 1.6 2004-02-15 21:36:10 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.5 2004/02/09 12:03:16 michael
|
||||
+ Switched to single interface in dosh.inc
|
||||
|
||||
Revision 1.4 2003/10/18 09:18:29 hajny
|
||||
|
@ -782,6 +782,26 @@ begin
|
||||
Result := DosExitCode;
|
||||
end;
|
||||
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString;
|
||||
const ComLine: array of AnsiString): integer;
|
||||
|
||||
var
|
||||
CommandLine: AnsiString;
|
||||
I: integer;
|
||||
|
||||
begin
|
||||
Commandline := '';
|
||||
for I := 0 to High (ComLine) do
|
||||
if Pos (' ', ComLine [I]) <> 0 then
|
||||
CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
|
||||
else
|
||||
CommandLine := CommandLine + ' ' + Comline [I];
|
||||
ExecuteProcess := ExecuteProcess (Path, CommandLine);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{*************************************************************************
|
||||
Sleep (copied from crt.Delay)
|
||||
*************************************************************************}
|
||||
@ -861,7 +881,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2004-01-20 23:12:49 hajny
|
||||
Revision 1.5 2004-02-15 21:36:10 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.4 2004/01/20 23:12:49 hajny
|
||||
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||
|
||||
Revision 1.3 2003/12/15 15:57:49 peter
|
||||
|
@ -309,7 +309,11 @@ type
|
||||
function CloseHandle(h : TWin32Handle) : longint;
|
||||
stdcall; external 'kernel32' name 'CloseHandle';
|
||||
|
||||
{$ifdef HASTHREADVAR}
|
||||
threadvar
|
||||
{$else HASTHREADVAR}
|
||||
var
|
||||
{$endif HASTHREADVAR}
|
||||
lastdosexitcode : longint;
|
||||
|
||||
procedure exec(const path : pathstr;const comline : comstr);
|
||||
@ -851,7 +855,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
Function EnvStr(index: integer): string;
|
||||
Function EnvStr (Index: longint): string;
|
||||
var
|
||||
hp,p : pchar;
|
||||
count,i : longint;
|
||||
@ -956,7 +960,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.23 2004-02-09 12:03:16 michael
|
||||
Revision 1.24 2004-02-15 21:36:10 hajny
|
||||
* overloaded ExecuteProcess added, EnvStr param changed to longint
|
||||
|
||||
Revision 1.23 2004/02/09 12:03:16 michael
|
||||
+ Switched to single interface in dosh.inc
|
||||
|
||||
Revision 1.22 2004/01/06 00:58:35 florian
|
||||
|
Loading…
Reference in New Issue
Block a user