You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
628 B
35 lines
628 B
19 years ago
|
|
||
|
#include <apt-pkg/debversion.h>
|
||
|
|
||
|
extern "C" {
|
||
|
|
||
|
#include "dpkg.h"
|
||
|
|
||
|
int versioncmp(char *left, char *right) {
|
||
|
return debVS.CmpVersion(left, right);
|
||
|
}
|
||
|
|
||
|
int cmpversions(char *left, int op, char *right) {
|
||
|
int i = debVS.CmpVersion(left, right);
|
||
|
|
||
|
switch(op) {
|
||
|
case dr_LT: return i < 0;
|
||
|
case dr_LTEQ: return i <= 0;
|
||
|
case dr_EQ: return i == 0;
|
||
|
case dr_GTEQ: return i >= 0;
|
||
|
case dr_GT: return i > 0;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
#ifdef TESTBIN
|
||
|
int main(int argc, char **argv) {
|
||
|
if (argc != 3) { printf("Usage: %s <ver> <ver>\n", argv[0]); exit(1); }
|
||
|
|
||
|
printf("%d\n", versioncmp(argv[1], argv[2]));
|
||
|
return 0;
|
||
|
}
|
||
|
#endif
|