+static int match_key(const char *key, const char *key_val, enum key_operation key_op, const char *val)
+{
+ int match;
+
+ if (key_op == KEY_OP_UNSET)
+ return 0;
+
+ dbg("check for %s '%s' <-> '%s'", key, key_val, val);
+ match = (strcmp_pattern(key_val, val) == 0);
+ if (match && (key_op != KEY_OP_NOMATCH)) {
+ dbg("%s key is matching (matching value)", key);
+ return 0;
+ }
+ if (!match && (key_op == KEY_OP_NOMATCH)) {
+ dbg("%s key is matching, (non matching value)", key);
+ return 0;
+ }
+
+ dbg("%s key is not matching", key);
+ return -1;
+}
+