/builds/xfbs/passgen/build-clang/src/version.c
Line | Count | Source |
1 | | #include <passgen/config.h> |
2 | | #include <passgen/version.h> |
3 | | #include <stddef.h> |
4 | | |
5 | 6 | passgen_version passgen_version_get() { |
6 | 6 | return (passgen_version) { |
7 | 6 | .major = 1, |
8 | 6 | .minor = 0, |
9 | 6 | .patch = 0, |
10 | 6 | .build = "-", |
11 | 6 | .prerelease = NULL, |
12 | 6 | }; |
13 | 6 | } |
14 | | |
15 | 4 | bool passgen_version_compatible(passgen_version version) { |
16 | 4 | // get current version |
17 | 4 | passgen_version current = passgen_version_get(); |
18 | 4 | |
19 | 4 | // major version must match exactly |
20 | 4 | if(current.major != version.major) { |
21 | 1 | return false; |
22 | 1 | } |
23 | 3 | |
24 | 3 | // minor version must not be smaller |
25 | 3 | if(current.minor < version.minor) { |
26 | 1 | return false; |
27 | 1 | } |
28 | 2 | |
29 | 2 | // if minor version is same, patch must not be smaller |
30 | 2 | if(current.minor == version.minor && current.patch < version.patch) { |
31 | 1 | return false; |
32 | 1 | } |
33 | 1 | |
34 | 1 | return true; |
35 | 1 | } |
36 | | |
37 | 1 | bool passgen_is_debug(void) { |
38 | 1 | #ifdef PASSGEN_DEBUG |
39 | 1 | return true; |
40 | | #else |
41 | | return false; |
42 | | #endif |
43 | 1 | } |