(* * * * * * * * * * * *
 *
 * prog2-4.pas
 *
 * test prog2-3 from
 * system call showing
 * how command.com
 * is invoked
 *
 * * * * * * * * * * * *)

(*
 *  Since this program invokes another, we need to explicitly
 *  set the stack and heap sizes.
 *  We use 8192 for stack size, 0 for minimum heap, and 8192 for
 *  maximum heap.
 *)
{$M 8192,0,8192}
program prog2_4;

uses    dos,
        crt;

var
    c:                  Char;
    i:                  Word;

begin

    (*
     *  Print parameter 1 to the screen
     *)
    for i:= 1 to ParamCount do begin
        write(paramStr(i), ' ');
        end;
    writeln;
    writeln;
    writeln('Press any key to continue...');
    writeln;

    (*
     *  Wait for key press
     *)
    c:= readKey;

    (*
     *  Invoke the memory display program from within this
     *  program.
     *)
    DosError:= 0;
    Exec('PROG2-3.EXE', '');
    if DosError <> 0 then begin
        writeln('Exec of PROG2-3 failed with DOS Error #', DosError);
        end;
end.

