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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,34b29f7884ececc8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-17 06:37:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-hub.siol.net!newsfeed1.eu.ignite.net!newsr1.ipcore.viaginterkom.de!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Ada & Scripting Date: Sat, 17 May 2003 09:36:04 +0200 Organization: AdaCL Message-ID: <1791903.ebazZxWUSG@linux1.krischik.com> References: <1352155.Gs21sEmXl2@linux1.krischik.com> <1419124.iFzRYCrhqu@linux1.krischik.com> <1226841.70Sv0M8gQ7@linux1.krischik.com> Reply-To: martin@krischik.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1053178468 05 13135 Y9OWEl1bSnY2x 030517 13:34:28 X-Complaints-To: abuse@t-online.com X-ID: bEsgBOZUZejO0R0V7MC1dllipAtTXIXEq4p2K+gJPP6wfl8JR-QKsr User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:37445 Date: 2003-05-17T09:36:04+02:00 List-Id: sk wrote: > Hi, > > I have some C sources for 'popen' which show how this is > > supposed to work. Now I "only" have to map the function to Ada. > > I saw them. As I said 'popen' ony returns one of the > > pipes - so I have to program my own version of 'popen'. > > ... and as I said, the method is 2 PIPES (not 'popen') I understand that much > The routine (algorithm) goes, roughly, like so ... > > > [...] > > Which is precicly what popen does - only popen then drops one of the pipes and returns only the other one. Personaly I think that was very wastefull of the original designer of popen. > Use the "select" or "poll" system calls in the parent > process to determine if the pipes are open, open but > blocked or closed. > > There is no difficulty in implementing this algorithm > in Ada, but it is a very "C" way to do it. A more Ada > solution is to use Ada tasks or protected objects, but > there is still a 'fork' and 'exec' call involved since > this is the way a Linux system (and Windows I think) > implements the "pipe" concept. So, I tend to stick > to the parent/child fork and exec method retaining the > "C" way to do things. I wonder if I should base my implentation use GNAT.Expect instead. GNAT.Expect does all of the above and I don't like to reinvent the weel just for the fun of it. Only I was planing for line IO and not pattern matching. Well, I'll look into it. Thank you for your help. It enables me to make an informed desicion - which ist probably the most important part in programming. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com