12 #define _RPMEVR_INTERNAL
21 #define MAX(x, y) ( ((x)>(y))?(x):(y) )
30 evr->F[RPMEVR_E] =
"0";
31 evr->F[RPMEVR_V] =
"";
32 evr->F[RPMEVR_R] =
"";
33 evr->F[RPMEVR_D] =
"";
42 evr->str =
_free(evr->str);
43 memset(evr, 0,
sizeof(*evr));
51 #if defined(RPM_VENDOR_MANDRIVA)
82 const char * ae = NULL, * be = NULL;
88 for (; *a && *b && rc == 0; a = ae, b = be) {
96 if (a[0] ==
'*' && a[1] ==
'\0') {
99 if (b[0] ==
'*' && b[1] ==
'\0') {
100 ae = strchr(a,
'\0');
105 while (a[0] ==
'0' &&
xisdigit((
int)a[1])) a++;
106 while (b[0] ==
'0' &&
xisdigit((
int)b[1])) b++;
109 ae = a;
while (
xisdigit((
int)*ae)) ae++;
110 be = b;
while (
xisdigit((
int)*be)) be++;
113 if (a == ae || b == be)
116 rc = (ae - a) - (be - b);
118 rc = strncmp(a, b, (ae - a));
126 rc = strncmp(a, b,
MAX((ae - a), (be - b)));
143 "^(?:([^:-]+):)?([^:-]+)(?:-([^:-]+))?(?::([^:-]+))?$";
175 int noffsets = 6 * 3;
181 memset(evr, 0,
sizeof(*evr));
183 nb = strlen(evr->str);
185 memset(offsets, -1,
sizeof(offsets));
188 xx =
mireRegexec(mire, evr->str, strlen(evr->str));
190 for (i = 0; i < noffsets; i += 2) {
198 case 0:
continue;
break;
199 case 1: ix = RPMEVR_E;
break;
200 case 2: ix = RPMEVR_V;
break;
201 case 3: ix = RPMEVR_R;
break;
202 case 4: ix = RPMEVR_D;
break;
205 assert(offsets[i ] >= 0 && offsets[i ] <= (
int)nb);
206 assert(offsets[i+1] >= 0 && offsets[i+1] <= (
int)nb);
207 {
char * te = (
char *) evr->str;
208 evr->F[ix] = te + offsets[i];
216 if (evr->F[RPMEVR_E] == NULL) evr->F[RPMEVR_E] =
"0";
217 if (evr->F[RPMEVR_V] == NULL) evr->F[RPMEVR_V] =
"";
218 if (evr->F[RPMEVR_R] == NULL) evr->F[RPMEVR_R] =
"";
219 if (evr->F[RPMEVR_D] == NULL) evr->F[RPMEVR_D] =
"";
221 evr->Elong = strtoul(evr->F[RPMEVR_E], NULL, 10);
267 assert(a->F[RPMEVR_E] != NULL);
268 assert(a->F[RPMEVR_V] != NULL);
269 assert(a->F[RPMEVR_R] != NULL);
270 assert(a->F[RPMEVR_D] != NULL);
271 assert(b->F[RPMEVR_E] != NULL);
272 assert(b->F[RPMEVR_V] != NULL);
273 assert(b->F[RPMEVR_R] != NULL);
274 assert(b->F[RPMEVR_D] != NULL);
279 default:
continue;
break;
280 case 'E': ix = RPMEVR_E;
break;
281 case 'V': ix = RPMEVR_V;
break;
282 case 'R': ix = RPMEVR_R;
break;
283 case 'D': ix = RPMEVR_D;
break;
301 if (a->F[RPMEVR_E] == NULL) a->F[RPMEVR_E] =
"0";
302 if (b->F[RPMEVR_E] == NULL) b->F[RPMEVR_E] =
"0";
303 if (a->F[RPMEVR_V] == NULL) a->F[RPMEVR_V] =
"";
304 if (b->F[RPMEVR_V] == NULL) b->F[RPMEVR_V] =
"";
305 if (a->F[RPMEVR_R] == NULL) a->F[RPMEVR_R] =
"";
306 if (b->F[RPMEVR_R] == NULL) b->F[RPMEVR_R] =
"";
307 if (a->F[RPMEVR_D] == NULL) a->F[RPMEVR_D] =
"";
308 if (b->F[RPMEVR_D] == NULL) b->F[RPMEVR_D] =
"";
314 result = (sense != 0);
317 else if (sense > 0 && ((aF & RPMSENSE_LESS) || (bF & RPMSENSE_GREATER)))
319 else if (sense == 0 &&
321 ((aF & RPMSENSE_LESS) && (bF & RPMSENSE_LESS)) ||
322 ((aF & RPMSENSE_GREATER) && (bF & RPMSENSE_GREATER))))
338 const char *
operator;
362 if (op == NULL || *op ==
'\0')
378 HE_t Ahe = memset(
alloca(
sizeof(*Ahe)), 0,
sizeof(*Ahe));
379 HE_t Bhe = memset(
alloca(
sizeof(*Bhe)), 0,
sizeof(*Bhe));
380 const char * one, * two;
388 default:
continue;
break;
398 else if (Eone > Etwo)
404 one = (xx && Ahe->
p.
str ? Ahe->
p.
str :
"");
407 two = (xx && Bhe->
p.
str ? Bhe->
p.
str :
"");
413 one = (xx && Ahe->
p.
str ? Ahe->
p.
str :
"");
416 two = (xx && Bhe->
p.
str ? Bhe->
p.
str :
"");
422 one = (xx && Ahe->
p.
str ? Ahe->
p.
str :
"");
425 two = (xx && Bhe->
p.
str ? Bhe->
p.
str :
"");