comp.lang.ada
 help / color / mirror / Atom feed
* Call to execvp in Rational Ada
@ 2002-11-27 16:41 Peter Richtmyer
  2002-11-27 18:06 ` Warren W. Gay VE3WWG
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Richtmyer @ 2002-11-27 16:41 UTC (permalink / raw)


I want to use Rational's "execvp". The following 
is my test code. test results are listed at the end.
Anybody know what I am doing wrong? Or have an example 
of doing it right that I can look at?

Thanks,
Peter
-------------------------------------------
with system;
with Ada.Exceptions;
use Ada.Exceptions;
with Unix_Operations;   -- in rational.rss
use  Unix_Operations;
with Unix_Types;        -- also
use  Unix_Types;
with text_io;
use  text_io;

procedure artest is


     status : int := 0;

     nul      : constant Character := Character'Val (0);

     command  : String := "ls" & nul;
     
     argvnul  : string := "" & nul;
     argv0    : string := "-la" & nul;
     
     type argv_array_t is array (0 .. 19) of system.address;
     pragma pack (argv_array_t);
     for argv_array_t'size use 20 * 32;
     
     argv_array : argv_array_t := (
             0      => argv0'address,
             others => system.null_address);
    
           
begin  
    text_io.put_line ("calling execvp");
    
    status := execvp (File => To_Char_Ptr(command'address),
                      Argv => To_Char_Ptr_Ptr(argv_array'address));
              
    text_io.put_line ("back fm execvp, status = " & int'image(status));
        
exception
    when E: others => 
         put_line ("artest exception: " &  Exception_Name (E));
   
end artest;
-------------------------------------------
--             TEST RESULTS
--
-- using:  "ls"  and  argv0 of "-la", 
--   get:  list of files, but not with the "-la" option info
--         and then it just stops (does not return to Ada)

-- using:  "ls" and first arg is a null string (argvnul), 
--   get:  list of files, 
--         and then it just stops (does not return to Ada)
          
-- using:  "ls" and all null_address for argv's, 
--   get:  it just stops after calling execvp, no list of files
         
-- using:  "ls" and Argv => To_Char_Ptr_Ptr(system.null_address));
--   get:  status = -1



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-11-29 18:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-27 16:41 Call to execvp in Rational Ada Peter Richtmyer
2002-11-27 18:06 ` Warren W. Gay VE3WWG
2002-11-28  6:15   ` Steven Deller
2002-11-29 18:21     ` Peter Richtmyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox