This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cygwin version detection at run time
- From: VÃclav Haisman <vhaisman at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 17 Aug 2015 12:20:08 +0200
- Subject: Re: Cygwin version detection at run time
- Authentication-results: sourceware.org; auth=none
- References: <CAKw7uVjccyLMYEQcxmZ6qHeAkGoowBB+-6VG-eu59_o4h6RKNQ at mail dot gmail dot com> <55CDF6F5 dot 6030202 at cs dot umass dot edu> <CAKw7uVjVdOFi4MJayZ485Sm=S7NvwCYwg_2qU-eT_pWLkSEX0Q at mail dot gmail dot com> <20150814154408 dot GJ28349 at calimero dot vinschen dot 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