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: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: How to find the type of operating system. Date: Thu, 7 Apr 2016 09:33:37 -0700 Organization: A noiseless patient Spider Message-ID: References: <57053167$0$4216$e4fe514c@news.kpn.nl> <533e9e24-e8b6-42e0-b80c-10eae266ee64@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 7 Apr 2016 16:30:22 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="48b46be33beed75863f69afa437f956b"; logging-data="17552"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18o/zYZ8lLjHRyxBcMV46Sge0e92b+FWzQ=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: Cancel-Lock: sha1:ZlcvHa9GowzJKgap5oKKRSGZUvQ= Xref: news.eternal-september.org comp.lang.ada:30042 Date: 2016-04-07T09:33:37-07:00 List-Id: On 04/07/2016 12:31 AM, Randy Brukardt wrote: > "Simon Wright" wrote in message > news:lyoa9ludbf.fsf@pushface.org... >> Anh Vo writes: >>> >>> With GNAT, I managed to make it work for Windows and Linux/Unix not long >>> ago. >>> >>> Dir_Separator : Character; >>> pragma Import (C, Dir_Separator, "__gnat_dir_separator"); >>> --... >>> Put_Line ("The program is run on OS: => " & >>> (if Dir_Separator = '\' then "Windows" else "Unix/Linux")); >> >> GNAT.OS_Lib.Directory_Separator provides exactly this functionality. > > Presumably you could get that value from a suitable use of > Ada.Directories.Compose, which would eliminate the > implementation-definedness for at least that check. But what you'd decide on > VMS I'm not sure. :-) Clearly, "Unix/Linux". -- Jeff Carter "They name the boy Jonathan Ralph Starkwell, after Virgil's mother." Take the Money and Run 141