From: Margaret Wasserman Date: Tue, 9 Jul 2013 22:26:34 +0000 (-0400) Subject: Clean up wildcard match code, add debugging printf X-Git-Tag: 1.0~2 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=c7a3c91edb5d9a0a912e7bdfe689d75f9b4f5564;hp=96378f5c4ec53995b9cf596c89c43f06ac43d94f;p=trust_router.git Clean up wildcard match code, add debugging printf --- diff --git a/common/tr_filter.c b/common/tr_filter.c index 857ac5b..fd3171a 100644 --- a/common/tr_filter.c +++ b/common/tr_filter.c @@ -32,6 +32,7 @@ * */ +#include #include #include @@ -45,16 +46,14 @@ int tr_prefix_wildcard_match (char *str, char *wc_str) { if ((!str) || (!wc_str)) return 0; + fprintf(stderr, "tr_prefix_wildcard_match: str = %s, wc_str = %s\n", str, wc_str); + /* TBD -- skip leading white space? */ if ('*' == wc_str[0]) wc_post = &(wc_str[1]); len = strlen(str); - /* Everything matches an empty string or "*" */ - if (0 == (wc_len = strlen(wc_post))) - return 1; - if (wc_len > len) - return 0; + wc_len = strlen(wc_post); if (!strcmp(&(str[len-wc_len]), wc_post)) { return 1;