public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin version detection at run time
@ 2015-08-14 13:56 Václav Haisman
  2015-08-14 14:11 ` Eliot Moss
  0 siblings, 1 reply; 5+ messages in thread
From: Václav Haisman @ 2015-08-14 13:56 UTC (permalink / raw)
  To: cygwin

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?

-- 
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin version detection at run time
  2015-08-14 13:56 Cygwin version detection at run time Václav Haisman
@ 2015-08-14 14:11 ` Eliot Moss
  2015-08-14 15:08   ` Václav Haisman
  0 siblings, 1 reply; 5+ messages in thread
From: Eliot Moss @ 2015-08-14 14:11 UTC (permalink / raw)
  To: cygwin

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 ...

Eliot Moss

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin version detection at run time
  2015-08-14 14:11 ` Eliot Moss
@ 2015-08-14 15:08   ` Václav Haisman
  2015-08-14 15:44     ` Corinna Vinschen
  0 siblings, 1 reply; 5+ messages in thread
From: Václav Haisman @ 2015-08-14 15:08 UTC (permalink / raw)
  To: cygwin

On 14 August 2015 at 16:11, Eliot Moss <moss@cs.umass.edu> 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.

-- 
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin version detection at run time
  2015-08-14 15:08   ` Václav Haisman
@ 2015-08-14 15:44     ` Corinna Vinschen
  2015-08-17 10:20       ` Václav Haisman
  0 siblings, 1 reply; 5+ messages in thread
From: Corinna Vinschen @ 2015-08-14 15:44 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1415 bytes --]

On Aug 14 17:08, Václav Haisman wrote:
> On 14 August 2015 at 16:11, Eliot Moss <moss@cs.umass.edu> 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.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Cygwin version detection at run time
  2015-08-14 15:44     ` Corinna Vinschen
@ 2015-08-17 10:20       ` Václav Haisman
  0 siblings, 0 replies; 5+ messages in thread
From: Václav Haisman @ 2015-08-17 10:20 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-17 10:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-14 13:56 Cygwin version detection at run time 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 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).