public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Václav Haisman" <vhaisman@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Cygwin version detection at run time
Date: Mon, 17 Aug 2015 10:20:00 -0000	[thread overview]
Message-ID: <CAKw7uVh8rTQRsVZF_ORUhhK8qBdhDLkKzwaDgQVZeyijom=zZw@mail.gmail.com> (raw)
In-Reply-To: <20150814154408.GJ28349@calimero.vinschen.de>

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

      reply	other threads:[~2015-08-17 10:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 13:56 Václav Haisman
2015-08-14 14:11 ` Eliot Moss
2015-08-14 15:08   ` Václav Haisman
2015-08-14 15:44     ` Corinna Vinschen
2015-08-17 10:20       ` Václav Haisman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKw7uVh8rTQRsVZF_ORUhhK8qBdhDLkKzwaDgQVZeyijom=zZw@mail.gmail.com' \
    --to=vhaisman@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).