libssh2_version.3 1.2 KB

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