comp.lang.ada
 help / color / mirror / Atom feed
From: Nick Gordon <annihilan@gmail.com>
Subject: Re: Help with constructing an Ada Shell
Date: Mon, 2 Nov 2015 16:47:44 -0800 (PST)
Date: 2015-11-02T16:47:44-08:00	[thread overview]
Message-ID: <73cc6782-abaf-49a9-b89e-51ee940b0b3e@googlegroups.com> (raw)
In-Reply-To: <871tccg3af.fsf@adaheads.sparre-andersen.dk>

On Friday, October 30, 2015 at 3:37:46 AM UTC-5, Jacob Sparre Andersen wrote:
> annihilan@gmail.com writes:
> 
> >    Input : aliased String := (1 .. 255 => ' ');
> 
> > 	 IO.Get_Line(Input, Last);
> 
> >       Spawn (Program_Name => Input, -- truncate strings or Input(Input'First..Last)??
> 
> > No matter what command is passed at the prompt, a return value of 1 is
> > given. 
> 
> Have you tried passing a command whose name is exactly 255 characters
> long?
> 
> > I would massively appreciate any help that could be given to me. I
> > don't really have any clue at all what's going on.
> 
> "Global" variables, which aren't really about maintaining state, are
> generally a bad idea.
> 
> Why don't you give Execute_System the profile:
> 
>    function Execute_System (Program : in String) return Integer;
> 
> If GNAT.OS_Lib.Spawn wants access types as parameters, you can always
> allocate a copy on the heap inside Execute_System and pass the access to
> the copy to GNAT.OS_Lib.Spawn.
> 
> Greetings,
> 
> Jacob
> -- 
>                       CAUTION
>                BLADE EXTREMELY SHARP
>                 KEEP OUT OF CHILDREN

The idea of copying the string to the heap and using the copy is sort of what I was going for. I haven't had the time to figure out how exactly to allocate a copy to the function's heap, but I'm currently working that out. I'll report back after I figure this out. Thanks to you and the others for the help.


  reply	other threads:[~2015-11-03  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30  4:53 Help with constructing an Ada Shell annihilan
2015-10-30  8:37 ` Jacob Sparre Andersen
2015-11-03  0:47   ` Nick Gordon [this message]
2015-10-30  9:10 ` Simon Wright
2015-10-30 13:52 ` David Botton
2015-10-30 23:19 ` Xavier Petit
replies disabled

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