Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > 26764e702e441b473525f6a16ac25557 > files > 16

hal-0.5.8.1-59.el5.src.rpm

--- hald/device_info.c.orig	2007-06-25 17:40:42.000000000 -0400
+++ hald/device_info.c	2007-06-25 17:58:28.000000000 -0400
@@ -657,6 +657,82 @@
 			return FALSE;
 		else
 			return result >= 0;
+	} else if (strcmp (attr[2], "prefix") == 0) {
+		dbus_bool_t found = FALSE;
+		if (hal_device_property_get_type (d, prop_to_check) == HAL_PROPERTY_TYPE_STRING) {
+			if (hal_device_has_property (d, prop_to_check)) {
+				const char *haystack;
+				const char *needle;
+				needle = attr[3];
+				haystack = hal_device_property_get_string (d, prop_to_check);
+				if (needle != NULL && haystack != NULL && g_str_has_prefix (haystack, needle)) {
+					found = TRUE;
+				}
+			}
+		} else {
+			return FALSE;
+		}
+		return found;
+	} else if (strcmp (attr[2], "suffix") == 0) {
+		dbus_bool_t found = FALSE;
+		if (hal_device_property_get_type (d, prop_to_check) == HAL_PROPERTY_TYPE_STRING) {
+			if (hal_device_has_property (d, prop_to_check)) {
+				const char *haystack;
+				const char *needle;
+				needle = attr[3];
+				haystack = hal_device_property_get_string (d, prop_to_check);
+				if (needle != NULL && haystack != NULL && g_str_has_suffix (haystack, needle)) {
+					found = TRUE;
+				}
+			}
+		} else {
+			return FALSE;
+		}
+		return found;
+	} else if (strcmp (attr[2], "prefix_ncase") == 0) {
+		dbus_bool_t found = FALSE;
+		if (hal_device_property_get_type (d, prop_to_check) == HAL_PROPERTY_TYPE_STRING) {
+			if (hal_device_has_property (d, prop_to_check)) {
+				const char *haystack;
+				const char *needle;
+				char *haystack_lc;
+			        char *needle_lc;
+				needle = attr[3];
+				haystack = hal_device_property_get_string (d, prop_to_check);
+				haystack_lc = (haystack == NULL ? NULL : g_utf8_strdown (haystack, -1));
+				needle_lc = (needle == NULL ? NULL : g_utf8_strdown (needle, -1));
+				if (needle_lc != NULL && haystack_lc != NULL && g_str_has_prefix (haystack_lc, needle_lc)) {
+					found = TRUE;
+				}
+				g_free (haystack_lc);
+				g_free (needle_lc);
+			}
+		} else {
+			return FALSE;
+		}
+		return found;
+	} else if (strcmp (attr[2], "suffix_ncase") == 0) {
+		dbus_bool_t found = FALSE;
+		if (hal_device_property_get_type (d, prop_to_check) == HAL_PROPERTY_TYPE_STRING) {
+			if (hal_device_has_property (d, prop_to_check)) {
+				const char *haystack;
+				const char *needle;
+				char *haystack_lc;
+			        char *needle_lc;
+				needle = attr[3];
+				haystack = hal_device_property_get_string (d, prop_to_check);
+				haystack_lc = (haystack == NULL ? NULL : g_utf8_strdown (haystack, -1));
+				needle_lc = (needle == NULL ? NULL : g_utf8_strdown (needle, -1));
+				if (needle_lc != NULL && haystack_lc != NULL && g_str_has_suffix (haystack_lc, needle_lc)) {
+					found = TRUE;
+				}
+				g_free (haystack_lc);
+				g_free (needle_lc);
+			}
+		} else {
+			return FALSE;
+		}
+		return found;
 	}
 	
 	return FALSE;
--- fdi/fdi.dtd.orig	2007-06-25 18:05:05.000000000 -0400
+++ fdi/fdi.dtd	2007-06-25 18:09:36.000000000 -0400
@@ -24,6 +24,10 @@
     compare_le       CDATA #IMPLIED
     compare_gt       CDATA #IMPLIED
     compare_ge       CDATA #IMPLIED
+    prefix           CDATA #IMPLIED
+    suffix           CDATA #IMPLIED
+    prefix_ncase     CDATA #IMPLIED
+    suffix_ncase     CDATA #IMPLIED
 >
 
 <!ELEMENT merge (#PCDATA) >