From 7e5434b773715b1d022a0d7cd7d0dce5a17adcb7 Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Sat, 16 Feb 2008 04:28:55 +0000 Subject: [PATCH] Enabled database wildcards, Bug #2100 --- src/database.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/database.c b/src/database.c index 9228162..bc5c723 100644 --- a/src/database.c +++ b/src/database.c @@ -1,4 +1,4 @@ -/* $Id: database.c,v 1.29 2007-06-28 09:36:10 adam Exp $ +/* $Id: database.c,v 1.30 2008-02-16 04:28:55 quinn Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -175,9 +175,11 @@ struct database *find_database(const char *id, int new) int match_zurl(const char *zurl, const char *pattern) { + int len; + if (!strcmp(pattern, "*")) return 1; - else if (!strncmp(pattern, "*/", 2)) + else if (!strncmp(pattern, "*/", 2)) // host wildcard.. what the heck is that for? { char *db = strchr(zurl, '/'); if (!db) @@ -187,6 +189,13 @@ int match_zurl(const char *zurl, const char *pattern) else return 0; } + else if (*(pattern + (len = strlen(pattern) - 1)) == '*') // db wildcard + { + if (!strncmp(pattern, zurl, len)) + return 1; + else + return 2; + } else if (!strcmp(pattern, zurl)) return 1; else -- 1.7.10.4