<!ELEMENT application (option+)>
<!ATTLIST application name CDATA #REQUIRED
executable CDATA #IMPLIED
+ executable_regexp CDATA #IMPLIED
sha1 CDATA #IMPLIED
application_name_match CDATA #IMPLIED
application_versions CDATA #IMPLIED>
uint32_t i;
const char *exec = NULL;
const char *sha1 = NULL;
+ const char *exec_regexp = NULL;
const char *application_name_match = NULL;
const char *application_versions = NULL;
driOptionInfo version_range = {
for (i = 0; attr[i]; i += 2) {
if (!strcmp(attr[i], "name")) /* not needed here */;
else if (!strcmp(attr[i], "executable")) exec = attr[i+1];
+ else if (!strcmp(attr[i], "executable_regexp")) exec_regexp = attr[i+1];
else if (!strcmp(attr[i], "sha1")) sha1 = attr[i+1];
else if (!strcmp(attr[i], "application_name_match"))
application_name_match = attr[i+1];
}
if (exec && strcmp(exec, data->execName)) {
data->ignoringApp = data->inApp;
+ } else if (exec_regexp) {
+ regex_t re;
+
+ if (regcomp(&re, exec_regexp, REG_EXTENDED|REG_NOSUB) == 0) {
+ if (regexec(&re, data->execName, 0, NULL, 0) == REG_NOMATCH)
+ data->ignoringApp = data->inApp;
+ regfree(&re);
+ } else
+ XML_WARNING("Invalid executable_regexp=\"%s\".", exec_regexp);
} else if (sha1) {
/* SHA1_DIGEST_STRING_LENGTH includes terminating null byte */
if (strlen(sha1) != (SHA1_DIGEST_STRING_LENGTH - 1)) {