+/*
+ * Copyright © 2012, Titanium Mirror, Inc.
+ * All Rights Reserved.
+ *
+ * This document is the proprietary and confidential property of
+ * Titanium Mirror, Inc. All use, distribution, reproduction or re-distribution
+ * is disallowed without the prior express written consent of
+ * Titanium Mirror, Inc.
+ */
+
+/*
+ * Match allowing wildcard ('*')
+ *
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+#include <stdbool.h>
+#include <string.h>
+
+bool match(const char* pattern, const char* string)
+{
+ char* p;
+
+ if (!pattern || !string)
+ return false;
+ p = index(pattern, '*');
+ if (p == pattern)
+ return true;
+ else if (p)
+ return (strncmp(pattern, string, p - pattern) == 0);
+ else
+ return (strcmp(pattern, string) == 0);
+}