home *** CD-ROM | disk | FTP | other *** search
- { 2/16/89: My thanks to the Turbo Users Group (T.U.G.) & to
- Bela Lubkin of Borland, for releasing to Public Domain Exec.pas. This
- modified version is pared down for Labcoat to call Qchart.exe. If you
- would like to know more about Exec.pas, contact me or, better yet,
- join T.U.G.: $24.00/yr - P.O. Box 1510 - Poulsbo, WA 98370
- If you program in Pascal, you'll find T.U.G.'s newsletters &
- libraries to be a real help, especially now, since Borland has axed
- Turbo Technix. T.U.G.'s interests also serve users of All the other
- Turbo language compilers - not just Pascal. }
-
- program exec;
-
- Type
- Str66=String[66];
- Str255=String[255];
-
- Function SubProcess(CommandLine: Str255): Integer;
-
- Var
- Regs: Record Case Integer Of
- 1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags: Integer);
- 2: (AL,AH,BL,BH,CL,CH,DL,DH: Byte);
- End;
- FCB1,FCB2: Array [0..36] Of Byte;
- PathName: Str66;
- CommandTail: Str255;
- ParmTable: Record
- EnvSeg: Integer;
- ComLin: ^Integer;
- FCB1Pr: ^Integer;
- FCB2Pr: ^Integer;
- End;
-
- Begin
- If Pos(' ',CommandLine)=0 Then
- Begin
- PathName:=CommandLine+#0;
- CommandTail:=^M;
- End
- Else
- Begin
- PathName:=Copy(CommandLine,1,Pos(' ',CommandLine)-1)+#0;
- CommandTail:=Copy(CommandLine,Pos(' ',CommandLine),255)+^M;
- End;
- CommandTail[0]:=Pred(CommandTail[0]);
- With Regs Do
- Begin
- FillChar(FCB1,Sizeof(FCB1),0);
- AX:=$2901;
- DS:=Seg(CommandTail[1]);
- SI:=Ofs(CommandTail[1]);
- ES:=Seg(FCB1);
- DI:=Ofs(FCB1);
- MsDos(Regs); { Create FCB 1 }
- FillChar(FCB2,Sizeof(FCB2),0);
- AX:=$2901;
- ES:=Seg(FCB2);
- DI:=Ofs(FCB2);
- MsDos(Regs); { Create FCB 1 }
- ES:=CSeg;
- BX:=SSeg-CSeg+MemW[CSeg:MemW[CSeg:$0101]+$112];
- AH:=$4A;
- MsDos(Regs); { Deallocate unused memory }
- DS:=Seg(PathName[1]);
- DX:=Ofs(PathName[1]);
- With ParmTable Do
- Begin
- EnvSeg:=MemW[CSeg:$002C];
- ComLin:=Addr(CommandTail);
- FCB1Pr:=Addr(FCB1);
- FCB2Pr:=Addr(FCB2);
- End;
- ES:=Seg(ParmTable);
- BX:=Ofs(ParmTable);
- AX:=$4B00;
- MsDos(Regs); { Call subprocess }
- If (Flags And 1)<>0 Then SubProcess:=AX
- Else SubProcess:=0;
- End;
- End;
-
-
-
- Var Command: Str255;
- I: Integer;
-
- Begin
- Command := 'qchart.exe';
- If Command<>'' Then
- Begin
- I:=SubProcess(Command);
- End;
- End.