home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / os2apipm.zip / APIEXAM / PARENV.ADB < prev    next >
Text File  |  1996-08-20  |  1KB  |  36 lines

  1. -- process with arg and env list DosKillProcess API OS/2
  2. with Ada.text_io; use Ada.text_io;
  3. with builtin; use builtin;
  4. with Os2; use Os2;
  5. with Os2.Bse; use Os2.Bse;
  6. procedure parenv is
  7.  
  8. LENGTH: ulong := 40;
  9. FLAGS : ulong := 2 ;
  10. buf   : aliased string(1..integer(LENGTH));
  11. pbuf  :Pch:=buf(1)'address;
  12. name  :aliased constant string:="CHARGENV.EXE"  & ' ' & character'val(0);
  13. ppgmname:pch   :=name(1)'address;
  14. childID:aliased RESULTCODES ;
  15. pchildid:PRESULTCODES :=childId'unchecked_access;
  16. KillAll :ulong :=0 ;
  17. rc      : apiret ;
  18. lit     : character;
  19. ArgStr  : string := "PARGENV.EXE" & character'val(0) & "arg1 arg2 arg3"
  20.                                   & character'val(0) ;
  21. EnvStr  : string :="Temp=d:\tmp" & character'val(0) &
  22.                    "LIB=d:\gcc\lib" & character'val(0) ;
  23. pARGS  : psz  :=argStr(1)'address;
  24. pENVS  : psz  :=envStr(1)'address;
  25.  
  26. begin
  27.  rc := dosexecpgm(pbuf,length,flags,pargs,penvs,pchildid,ppgmname);
  28.  if rc>0 then put_edit("DosExecPgm error =",integer(rc),4); goto fin; end if;
  29. get(lit);
  30.                           -- kill
  31. rc := DosKillProcess(KillAll,childID.codeTerminate);
  32. new_line; put_edit("DosKillProcess error =",integer(rc),4);
  33.  
  34. <<fin>> null;
  35. end parenv;
  36.