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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,439c480fcf4ce979 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-13 10:00:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!oleane.net!oleane!wanadoo.fr!teaser.fr!enst.fr!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada Subject: Re: Exec shell command with GNAT Date: Mon, 13 Jan 2003 11:59:02 -0600 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1042480803 39669 137.194.161.2 (13 Jan 2003 18:00:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 13 Jan 2003 18:00:03 +0000 (UTC) Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:32972 Date: 2003-01-13T11:59:02-06:00 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" Newsgroups: comp.lang.ada To: 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 >