comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <marin.condic.auntie.spam@pacemicro.com>
Subject: Re: Unix Executables
Date: Tue, 10 Jul 2001 16:04:49 -0400
Date: 2001-07-10T20:04:51+00:00	[thread overview]
Message-ID: <9ifn53$q4j$1@nh.pace.co.uk> (raw)
In-Reply-To: ab21b49a.0107101051.766f947a@posting.google.com

There's always a way. Depends on what exactly you had in mind. If you just
want to invoke a program, here's some code cut from a batch of utilities on
my web page (see: http://www.mcondic.com/):

with Interfaces.C;

procedure UTIL.Perform_System_Command (
    Command     : in     String ;
    Wait        : in     Boolean := True ;
    Success     :    out Boolean) is
    --
    Return_Code : Integer ;
    --
    function Sys (
        Item    : in     Interfaces.C.Char_Array) return Integer ;
    pragma Import (C, Sys, "system") ;
    --
    package C renames Interfaces.C ;
    --
begin
    --
    if (Wait) then
        Return_Code := Sys (
            Item    => C.To_C ("ksh -c " & '"' & Command & '"'));
    else
        Return_Code := Sys (
            Item    => C.To_C ("ksh -c " & '"' & Command & " &" & '"'));
    end if ;
    --
    if (Return_Code /= 0) then
        Success := False ;
    else
        Success := True ;
    end if;
    --
end UTIL.Perform_System_Command ;

If you want to actually interface to some OS service that is normally got to
via a subprogram call, then perhaps if you post the call (I presume it is
written in C?) we could help you with the appropriate pragmas, linkage, etc.

A Solution Does Exist, but you might need to be a little more specific.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Matt Raikes" <mraikes@vt.edu> wrote in message
news:ab21b49a.0107101051.766f947a@posting.google.com...
> Is there a way to call a Unix executable(such as gzip) from within my
code.





  reply	other threads:[~2001-07-10 20:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-10 18:51 Unix Executables Matt Raikes
2001-07-10 20:04 ` Marin David Condic [this message]
2001-07-10 21:02 ` M. A. Alves
replies disabled

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