comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: Exec shell command with GNAT
Date: Mon, 13 Jan 2003 11:59:02 -0600
Date: 2003-01-13T11:59:02-06:00	[thread overview]
Message-ID: <mailman.1042480803.13226.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: baf7991b.0301130858.215e70b7@posting.google.com

Here's such a function I've been using for some years:
It should be portable across compilers and OSs, as long
as the C-runtime library has the "system" function.
------------------------------------------------------------------------
-- $Source: /usr/local/cvsroot/execute_shell_command.adb,v $
-- $Revision: 1.1 $
-- $Date: 1999/08/11 12:58:58 $
-- $Author: hoosd $
-- $State: Exp $
-- Revision History:
-- $Log: execute_shell_command.adb,v $
-- Revision 1.1  1999/08/11 12:58:58  hoosd
-- Initial checkin
--
--
-- Execute_Shell_Command
-- Purpose:
--   This library-level function is an Ada interface to the "system"
--   command of the C run-time library.
------------------------------------------------------------------------
with Ada.Characters.Latin_1;
with System;
function Execute_Shell_Command
  (The_Command : String) return Integer is

   function Execute
              (The_Command_Address : System.Address) return Integer;
   pragma Import (C, Execute, "system");
   The_Nul_Terminated_Command_String : constant String :=
     The_Command & Ada.Characters.Latin_1.Nul;
begin
   return Execute (The_Nul_Terminated_Command_String'Address);
end Execute_Shell_Command;

----- Original Message ----- 
From: "JuK" <calvinix@caramail.com>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: Monday, January 13, 2003 10:58 AM
Subject: Exec shell command with GNAT


> Hello 
> I want to execute a shell command in my ADA application :
> 
>  function EXEC_SHELL_COMMAND (COMMAND : in STRING) return EXIT_STATUS ;
> 
> 
> How Can I do that  ?
> 
> ( SOLARIS with GNAT 3.14 )
> 
> Thank you
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
> 



  reply	other threads:[~2003-01-13 17:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-13 16:58 Exec shell command with GNAT JuK
2003-01-13 17:59 ` David C. Hoos [this message]
2003-01-14  8:58   ` Thomas Wolf
2003-01-14 12:15     ` David C. Hoos, Sr.
2003-01-14 15:41     ` Adrian Knoth
2003-01-14 10:34   ` Lutz Donnerhacke
2003-01-13 18:52 ` Per Sandbergs
2003-01-13 19:01 ` Jeffrey Carter
replies disabled

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