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,LOTS_OF_MONEY 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!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How to find the type of operating system. Date: Thu, 7 Apr 2016 02:31:03 -0500 Organization: JSA Research & Innovation Message-ID: References: <57053167$0$4216$e4fe514c@news.kpn.nl> <533e9e24-e8b6-42e0-b80c-10eae266ee64@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1460014264 31225 24.196.82.226 (7 Apr 2016 07:31:04 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 7 Apr 2016 07:31:04 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Original Xref: news.eternal-september.org comp.lang.ada:30033 Date: 2016-04-07T02:31:03-05:00 List-Id: "Simon Wright" wrote in message news:lyoa9ludbf.fsf@pushface.org... > Anh Vo writes: > >> On Wednesday, April 6, 2016 at 2:41:33 PM UTC-7, Randy Brukardt wrote: >>> "ldries46" wrote in message >>> news:57053167$0$4216$e4fe514c@news.kpn.nl... >>> > How can I fin in which operating system a program runs and other >>> > details >>> > of that operating system. >>> >>> Ada has System.System_Name provides an implementation-defined indication >>> of >>> the name of the target, but that often isn't set in any useful way. >>> (Dunno >>> what GNAT does with it, if anything.) >> >> 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. :-) Randy.