From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8a0999bfe89e1b4f,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-27 08:41:47 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: prichtmyer@yahoo.com (Peter Richtmyer) Newsgroups: comp.lang.ada Subject: Call to execvp in Rational Ada Date: 27 Nov 2002 08:41:47 -0800 Organization: http://groups.google.com/ Message-ID: <1b585154.0211270841.3ae227e0@posting.google.com> NNTP-Posting-Host: 164.223.72.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1038415307 845 127.0.0.1 (27 Nov 2002 16:41:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 27 Nov 2002 16:41:47 GMT Xref: archiver1.google.com comp.lang.ada:31262 Date: 2002-11-27T16:41:47+00:00 List-Id: 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