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.
20
static const char *lib_version = LIBMOUNT_VERSION;
23
* mnt_parse_version_string:
24
* @ver_string: version string (e.g "2.18.0")
26
* Returns: release version code.
28
int mnt_parse_version_string(const char *ver_string)
33
for (cp = ver_string; *cp; cp++) {
38
version = (version * 10) + (*cp - '0');
44
* mnt_get_library_version:
45
* @ver_string: return pointer to the static library version string
47
* Returns: release version number.
49
int mnt_get_library_version(const char **ver_string)
52
*ver_string = lib_version;
54
return mnt_parse_version_string(lib_version);
58
int test_version(struct libmnt_test *ts, int argc, char *argv[])
62
mnt_get_library_version(&ver);
64
printf("Library version: %s\n", ver);
65
printf("Library API version: " LIBMOUNT_VERSION "\n");
67
if (mnt_get_library_version(NULL) ==
68
mnt_parse_version_string(LIBMOUNT_VERSION))
74
int main(int argc, char *argv[])
76
struct libmnt_test ts[] = {
77
{ "--print", test_version, "print versions" },
81
return mnt_run_test(ts, argc, argv);