libssh2
1.\" Copyright (C) The libssh2 project and its contributors.
2.\" SPDX-License-Identifier: BSD-3-Clause
3.TH libssh2_version 3 "23 Feb 2009" "libssh2" "libssh2"
4.SH NAME
5libssh2_version - return the libssh2 version number
6.SH SYNOPSIS
7.nf
8#include <libssh2.h>
9
10const char *
11libssh2_version(int required_version);
12.fi
13.SH DESCRIPTION
14If \fIrequired_version\fP is lower than or equal to the version number of the
15libssh2 in use, the version number of libssh2 is returned as a pointer to a
16zero terminated string.
17
18The \fIrequired_version\fP should be the version number as constructed by the
19LIBSSH2_VERSION_NUM define in the libssh2.h public header file, which is a 24
20bit number in the 0xMMmmpp format. MM for major, mm for minor and pp for patch
21number.
22.SH RETURN VALUE
23The version number of libssh2 is returned as a pointer to a zero terminated
24string or NULL if the \fIrequired_version\fP is not fulfilled.
25.SH EXAMPLE
26To make sure you run with the correct libssh2 version:
27
28.nf
29if(!libssh2_version(LIBSSH2_VERSION_NUM)) {
30fprintf(stderr, \&"Runtime libssh2 version too old.\&");
31exit(1);
32}
33.fi
34
35Unconditionally get the version number:
36
37.nf
38printf(\&"libssh2 version: %s\&", libssh2_version(0));
39.fi
40.SH AVAILABILITY
41This function was added in libssh2 1.1, in previous versions there way no way
42to extract this info in run-time.
43