From: micro-heart-of-gold.mit.edu!wupost!zaphod.mps.ohio-state.edu!caen!uvaarpa !software.org!blakemor@bloom-beacon.mit.edu (Alex Blakemore)
Subject: calling a shell script from Ada
Date: 21 Nov 91 19:43:32 GMT [thread overview]
Message-ID: <1991Nov21.194332.27044@software.org> (raw)
In article <1991Nov21.035339.21527nbh@netcom.COM> nbh@netcom.COM (N.B. Hedd) wr
ites:
> I am trying to make a call to a UNIX shell script from within an Ada
> program, have the script terminate, and return to the program. I am
> able to call the system via unix_procs.execute, I think, but my program
> never seems to return to the foreground. Can somebody with Verdix experience
> on a Sun shed some light on this?
>
> Ada ---> shell script (with arguments) ---> return to Ada
why dont you just use the Unix system call "system"
here is a repeat of a previous posting for a similar
problem using Verdix on a Sun to call an executable program
the mechanism is the same
with text_io;
with language;
with system;
procedure sample is
command : constant string := "shell_script param1 param2" & ascii.nul;
-- replace command as appropriate, dont forget fin
al null
exit_code : integer;
function system_call (command : in system.address) return integer;
pragma interface (c, system_call);
pragma interface_name (system_call, language.c_prefix & "system");
begin
exit_code := system_call (command'address);
if exit_code /= 0 then
text_io.put_line ("system call completed normally");
else
text_io.put_line ("system call returned exit code " & integer'image (exit_c
ode));
end if;
end sample;
--
---------------------------------------------------------------------
Alex Blakemore blakemore@software.org (703) 742-7125
Software Productivity Consortium 2214 Rock Hill Rd, Herndon VA 22070
reply other threads:[~1991-11-21 19:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox