comp.lang.ada
 help / color / mirror / Atom feed
* calling a shell script from Ada
@ 1991-11-21 19:43 micro-heart-of-gold.mit.edu!wupost!zaphod.mps.ohio-state.edu!caen!uvaarpa
  0 siblings, 0 replies; only message in thread
From: micro-heart-of-gold.mit.edu!wupost!zaphod.mps.ohio-state.edu!caen!uvaarpa @ 1991-11-21 19:43 UTC (permalink / 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1991-11-21 19:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-11-21 19:43 calling a shell script from Ada micro-heart-of-gold.mit.edu!wupost!zaphod.mps.ohio-state.edu!caen!uvaarpa

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