2
* version.c - Return the version of the blkid library
4
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
5
* [Based on libblkid/version.c by Theodore Ts'o]
7
* See COPYING.libmount for the License of this software.
12
* @title: Version functions
13
* @short_description: functions to get library version.
23
static const char *lib_version = LIBMOUNT_VERSION;
26
* mnt_parse_version_string:
27
* @ver_string: version string (e.g "2.18.0")
29
* Returns: release version code.
31
int mnt_parse_version_string(const char *ver_string)
36
for (cp = ver_string; *cp; cp++) {
41
version = (version * 10) + (*cp - '0');
47
* mnt_get_library_version:
48
* @ver_string: return pointer to the static library version string
50
* Returns: release version number.
52
int mnt_get_library_version(const char **ver_string)
55
*ver_string = lib_version;
57
return mnt_parse_version_string(lib_version);
61
int test_version(struct libmnt_test *ts, int argc, char *argv[])
65
mnt_get_library_version(&ver);
67
printf("Library version: %s\n", ver);
68
printf("Library API version: " LIBMOUNT_VERSION "\n");
70
if (mnt_get_library_version(NULL) ==
71
mnt_parse_version_string(LIBMOUNT_VERSION))
77
int main(int argc, char *argv[])
79
struct libmnt_test ts[] = {
80
{ "--print", test_version, "print versions" },
84
return mnt_run_test(ts, argc, argv);