if (end2 != NULL)
s2 = end2 + 1;
else
s2 = NULL;
} while (res == 0 && ((s1 != NULL) && (s2 != NULL)));
JLI_MemFree(m1);
JLI_MemFree(m2);
return (res);
}
/*
* Modeled after strcmp(), compare two version-ids for an Exact
* Match as defined in JSR 56.
*/
int
JLI_ExactVersionId(char *id1, char *id2)
{
char *s1 = JLI_StringDup(id1);
char *s2 = JLI_StringDup(id2);
char *m1 = s1;
char *m2 = s2;
char *end1 = NULL;
char *end2 = NULL;
int res = 0;
do {
if ((s1 != NULL) && ((end1 = strpbrk(s1, separators)) != NULL))
*end1 = '\0';
if ((s2 != NULL) && ((end2 = strpbrk(s2, separators)) != NULL))
*end2 = '\0';
if ((s1 != NULL) && (s2 == NULL))
res = comp_string(s1, zero_string);
else if ((s1 == NULL) && (s2 != NULL))
res = comp_string(zero_string, s2);
else
res = comp_string(s1, s2);
if (end1 != NULL)
s1 = end1 + 1;
else
s1 = NULL;
if (end2 != NULL)
s2 = end2 + 1;
else
s2 = NULL;
} while (res == 0 && ((s1 != NULL) || (s2 != NULL)));
JLI_MemFree(m1);
JLI_MemFree(m2);
return (res);
}
/*
* Return true if this simple-element (as defined in JSR 56) forms
* an acceptable match.
*
* JSR 56 is modified by the Java Web Start <rel> Developer Guide
* where it is stated "... Java Web Start will not consider an installed
* non-FCS (i.e., milestone) JRE as a match. ... a JRE from Sun
* Microsystems, Inc., is by convention a non-FCS (milestone) JRE
* if there is a dash (-) in the version string."
*
* An undocumented caveat to the above is that an exact match with a
* hyphen is accepted as a development extension.
*
* These modifications are addressed by the specific comparisons
* for releases with hyphens.
*/
static int
acceptable_simple_element(char *release, char *simple_element)
{
char *modifier;
modifier = simple_element + strlen(simple_element) - 1;
if (*modifier == '*') {
*modifier = '\0';
if (strchr(release, '-'))
return ((strcmp(release, simple_element) == 0)?1:0);
return ((JLI_PrefixVersionId(release, simple_element) == 0)?1:0);
} else if (*modifier == '+') {
*modifier = '\0';
if (strchr(release, '-'))
return ((strcmp(release, simple_element) == 0)?1:0);
return ((JLI_ExactVersionId(release, simple_element) >= 0)?1:0);
} else {
return ((JLI_ExactVersionId(release, simple_element) == 0)?1:0);
}
}
/*
* Return true if this element (as defined in JSR 56) forms
* an acceptable match. An element is the intersection (and)
* of multiple simple-elements.
*/
static int
acceptable_element(char *release, char *element)
=2= |