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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f890526de6a8a218 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 13 Oct 2005 20:32:22 -0500 From: "Steve" Newsgroups: comp.lang.ada References: <87mzldf7rm.fsf@code-hal.de> Subject: Re: How to detect OS type and version? Date: Thu, 13 Oct 2005 18:33:42 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.22.63.157 X-Trace: sv3-hAcHlWOzE7lmQwck2CIHZ+Vx8ODjowN42EL2Mapp8o3KWjQNYBD7xKSqkqxDGv4FdveaTfWydqRsO+Q!C6zb78oecKGy2lBgF9/Dtn8CV1FGJfrCOL92YuhTylpYOg+gdhOUuvCMRCP1HZQ5opSULb5r/z/P!phGD2G4AdJRC X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:5625 Date: 2005-10-13T18:33:42-07:00 List-Id: "Michael Bode" wrote in message news:87mzldf7rm.fsf@code-hal.de... > Martin Dowie writes: > >> Roger Blum wrote: >>> Is there a way within Ada (GNAT 3.15p) to tell whether the >>> application is running on Linux or Windows (and the version of the >>> OS)? >> >> There is no single standard why... yet! >> >> I think that you will be able to do this with "package >> Ada.Environment_Variables" come Ada200Y, e.g. >> >> if Ada.Environment_Variables.Exists ("OS") >> and Ada.Environment_Variables.Value ("OS") = "Windows_NT" then >> ... >> elsif Ada.Environment_Variables.Exists ("OSTYPE") > > He could use GNAT.Os_Lib.Getenv ("OSTYPE") > > -- > Michael Bode In the implementation of GNAT.OS_Lib there is an interesting definition: On_Windows : constant Boolean := Directory_Separator = '\'; Apparently that's how GNAT finds the OS. Once you have the OS, you can use OS specific code to find the version. Steve (The Duck)