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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Trying to run ls, pwd, rm, etc. in linux without specifying the exact path Date: Wed, 09 Mar 2016 17:55:27 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="900e1437335c90c92a3116ad49605f53"; logging-data="20655"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bhYdtZ6qOPpsJkknCmtp9BGaxav4FqEg=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:M0tCJsSLbLAHvCt32A2Y9GmLopY= sha1:xtwb+T0UCtAMTJHiiP/beHtOmqI= Xref: news.eternal-september.org comp.lang.ada:29710 Date: 2016-03-09T17:55:27+00:00 List-Id: John Smith writes: > I found this little example and expanded on it: > http://rosettacode.org/wiki/Execute_a_system_command#Ada > > I used the example where GNAT.OS_Lib is used. Everything works like I > want it to, almost. If I want to call a Linux command, I have to > specify the exact path to it /bin/ls. How can I import the various > Linux environment variables so tha I can just call 'ls' without > specifying the direct path to the binary? I think Locate_Exec_On_Path ("ls") should do the trick. -- Try to locate an executable whose name is given by Exec_Name in the -- directories listed in the environment Path. If the Exec_Name does not -- have the executable suffix, it will be appended before the search. -- Otherwise works like Locate_Regular_File below. If the executable is -- not found, null is returned. -- -- Note that this function allocates memory for the returned value. This -- memory needs to be deallocated after use.