aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 58b1d44..528657e 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1641,3 +1641,15 @@ int starts_with_ci(const char *s, const char *p)
for (; *p && tolower(*p) == tolower(*s); s++, p++);
return (*p == '\0');
}
+
+int hash_matches(const char *pattern, const char *hash)
+{
+ int invert = 0;
+
+ if (pattern[0] == '!') {
+ invert = 1;
+ pattern++;
+ }
+
+ return (starts_with(hash, pattern) != invert);
+}