Version number comparison library and utility.
About
libcvercmp is library providing functions to compare arbitrary
version numbers with each other. Distribution contains also
cvercmp-command that uses cvercmp library to compare version numbers
given to it.
libcvercmp
Available comparison operations (enum cvercmp_type) are:
- CVERCMP_EQUAL
- CVERCMP_NONEQUAL
- CVERCMP_GREATER
- CVERCMP_LESSER
- CVERCMP_MIN
- CVERCMP_MAX
API has these functions:
- Highest level API
- bool cvercmp(const char *ver1, const char *ver2, enum cvercmp_type type);
- Mid-level API
- bool cvercmp_equal(const char *ver1, const char *ver2);
- bool cvercmp_nonequal(const char *ver1, const char *ver2);
- bool cvercmp_greater(const char *ver1, const char *ver2);
- bool cvercmp_lesser(const char *ver1, const char *ver2);
- bool cvercmp_min(const char *ver1, const char *ver2);
- bool cvercmp_max(const char *ver1, const char *ver2);
- Lowest level API
- enum cvercmp_type cvercmp_cmp(const char *ver1, const char *ver2);
cvercmp_cmp() returns either CVERCMP_LESSER, CVERCMP_EQUAL, or CVERCMP_GREATER.
cvercmp
Command vercmp takes three arguments; two versions, and comparison
operation between them. It both prints out either "Yes" or "No", and
sets its return value to indicate the result of the comparison.
First version must be [operation] than latter version, e.g.,
cvercmp $INSTALLED_VERSION min 2.0-beta3 returns true if
INSTALLED_VERSION is at least 2.0-beta3.
Comparison operations are:
- equal
- nonequal
- lesser
- greater
- min
- max
Releases
1.0.5 (30-May-22)
cvercmp-1.0.5.tar.xz
1.0.4 (01-Jan-16)
cvercmp-1.0.4.tar.xz
1.0.3 (17-Apr-15)
cvercmp-1.0.3.tar.xz
1.0.2 (31-Mar-13)
cvercmp-1.0.2.tar.xz
1.0.1 (29-Mar-13)
cvercmp-1.0.1.tar.xz
1.0 (16-May-12)
cvercmp-1.0.tar.xz
Contact
Marko Lindqvist |
|