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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.68.253.136 with SMTP id aa8mr21205522pbd.14.1446511664800; Mon, 02 Nov 2015 16:47:44 -0800 (PST) X-Received: by 10.182.112.234 with SMTP id it10mr243784obb.13.1446511664764; Mon, 02 Nov 2015 16:47:44 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!i2no2792918igv.0!news-out.google.com!z4ni44433ign.0!nntp.google.com!i2no1901318igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 2 Nov 2015 16:47:44 -0800 (PST) In-Reply-To: <871tccg3af.fsf@adaheads.sparre-andersen.dk> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=141.225.243.254; posting-account=TqGH2woAAAAOL7cuGUYe_Weq4IpyHmTd NNTP-Posting-Host: 141.225.243.254 References: <9e1e5dc4-f5e6-4d8d-9677-1b66117d8a85@googlegroups.com> <871tccg3af.fsf@adaheads.sparre-andersen.dk> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <73cc6782-abaf-49a9-b89e-51ee940b0b3e@googlegroups.com> Subject: Re: Help with constructing an Ada Shell From: Nick Gordon Injection-Date: Tue, 03 Nov 2015 00:47:44 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28184 Date: 2015-11-02T16:47:44-08:00 List-Id: On Friday, October 30, 2015 at 3:37:46 AM UTC-5, Jacob Sparre Andersen wrot= e: > annihilan@gmail.com writes: >=20 > > Input : aliased String :=3D (1 .. 255 =3D> ' '); >=20 > > IO.Get_Line(Input, Last); >=20 > > Spawn (Program_Name =3D> Input, -- truncate strings or Input(Inpu= t'First..Last)?? >=20 > > No matter what command is passed at the prompt, a return value of 1 is > > given.=20 >=20 > Have you tried passing a command whose name is exactly 255 characters > long? >=20 > > 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. >=20 > "Global" variables, which aren't really about maintaining state, are > generally a bad idea. >=20 > Why don't you give Execute_System the profile: >=20 > function Execute_System (Program : in String) return Integer; >=20 > 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. >=20 > Greetings, >=20 > Jacob > --=20 > CAUTION > BLADE EXTREMELY SHARP > KEEP OUT OF CHILDREN The idea of copying the string to the heap and using the copy is sort of wh= at I was going for. I haven't had the time to figure out how exactly to all= ocate 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 th= e help.