From: Sebastian Hammer Date: Sat, 16 Feb 2008 04:28:55 +0000 (+0000) Subject: Enabled database wildcards, Bug #2100 X-Git-Tag: PAZPAR2.1.0.6~13 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=7e5434b773715b1d022a0d7cd7d0dce5a17adcb7;p=pazpar2-moved-to-github.git Enabled database wildcards, Bug #2100 --- 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