X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type :content-transfer-encoding; q=dns; s=default; b=VlVbigsfiBY5HoG4 1OOxPTSQkIAOwU7jeZWznir0OfpJaoXpS+ONtKufBS7V7ZXONus20RBViTvyQ/4A 9hTJor3R6NlTdev/neoUESv/tOQ6f7T1BcYehnxhsJnk3b0LX19QFqRmH8I9PA34 OcyJI8hj8DdoSIZas58aIkwh9z0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type :content-transfer-encoding; s=default; bh=iWFbV7t46+wRH9F++xfX02 0ErIU=; b=gV9BZi9meaTVBpBUClnR0+0W6lOnRBDEe8nR+Tur/hnlEyRc7J/m2H SGBiNOpuRNRukIwWCm9qsig0xKHFNrsZD7gCNoyAYtVQCdnoJU9d/BFy+OelBv9f Deh9CddiilNqA54UbpIZ1zl/azrXllDQMoqug16xRSoAIz1IGrFWI= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f41.google.com MIME-Version: 1.0 X-Received: by 10.112.166.106 with SMTP id zf10mr558495lbb.36.1439806808472; Mon, 17 Aug 2015 03:20:08 -0700 (PDT) In-Reply-To: <20150814154408.GJ28349@calimero.vinschen.de> References: <55CDF6F5 DOT 6030202 AT cs DOT umass DOT edu> <20150814154408 DOT GJ28349 AT calimero DOT vinschen DOT de> Date: Mon, 17 Aug 2015 12:20:08 +0200 Message-ID: Subject: Re: Cygwin version detection at run time From: =?UTF-8?Q?V=C3=A1clav_Haisman?= To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id t7HAKNxT010332 On 14 August 2015 at 17:44, Corinna Vinschen wrote: > On Aug 14 17:08, Václav Haisman wrote: >> On 14 August 2015 at 16:11, Eliot Moss wrote: >> > On 8/14/2015 9:56 AM, Václav Haisman wrote: >> >> >> >> Hi. >> >> >> >> I am trying to find out Cygwin version at run time. >> >> >> >> I have noticed that there is `cygwin_internal (CW_GETVERSIONINFO)` API >> >> for this. However, it seems that the `cygwin_version_info` structure >> >> this call is supposed to fill in is not publicly available and is only >> >> declared internally in `winsup/cygwin/cygwin_version.h`. >> >> >> >> Am I right that my only option is either to copy the internal >> >> declaration of the structure or to use `/proc/version` and parse the >> >> version string out of that? >> > >> > >> > There's uname, whose options allow getting various parts of what >> > /proc/version gives you. uname is also somewhat portable across >> > different flavors of linux ... >> >> Never mind, I have figured it out. The `cygwin_internal >> (CW_GETVERSIONINFO)` actually returns a pointer to string which can >> be parsed reliably. I have used it. > > cygwin_internal(CW_GETVERSIONINFO) is an API for non-Cygwin tools like > cygcheck, not for general consumption. For a Cygwin executable, better > use uname(2) instead. Thanks. Uname call's utsname structure is much easier to parse. -- VH -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple