X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fdatabase.c;h=2553b7cacb6ece25fdbc71bf1622cf202b4a0aaf;hb=b3356073151093f1f2267ee7bf75139f4d650d40;hp=df6f11aae57c3a1a7b631de91b763a318597f7f5;hpb=dedbc922fbe49e599466f41c618ba9ba8ddb9477;p=pazpar2-moved-to-github.git diff --git a/src/database.c b/src/database.c index df6f11a..2553b7c 100644 --- a/src/database.c +++ b/src/database.c @@ -1,4 +1,4 @@ -/* $Id: database.c,v 1.23 2007-04-21 12:00:54 adam Exp $ +/* $Id: database.c,v 1.26 2007-05-11 16:57:42 quinn Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -29,6 +29,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include "pazpar2.h" +#include "host.h" #include "config.h" #include "settings.h" #include "http.h" @@ -158,7 +159,7 @@ struct database *find_database(const char *id, int new) return load_database(id); } -// This whole session_grep database thing should be moved to pazpar2.c +// This whole session_grep database thing should be moved elsewhere int match_zurl(const char *zurl, const char *pattern) { @@ -235,6 +236,8 @@ int session_grep_databases(struct session *se, struct database_criterion *cl, { if (p->settings && p->settings[PZ_ALLOW] && *p->settings[PZ_ALLOW]->value == '0') continue; + if (!p->settings[PZ_NAME]) + continue; if (database_match_criteria(p->settings, cl)) { (*fun)(se, p); @@ -259,41 +262,6 @@ int grep_databases(void *context, struct database_criterion *cl, return i; } -// This function will most likely vanish when a proper target profile mechanism is -// introduced. -void load_simpletargets(const char *fn) -{ - FILE *f = fopen(fn, "r"); - char line[256]; - - if (!f) - { - yaz_log(YLOG_WARN|YLOG_ERRNO, "open %s", fn); - exit(1); - } - - while (fgets(line, 255, f)) - { - char *url; - char *name; - struct database *db; - - if (strncmp(line, "target ", 7)) - continue; - line[strlen(line) - 1] = '\0'; - - if ((name = strchr(line, ';'))) - *(name++) = '\0'; - - url = line + 7; - - if (!(db = find_database(url, 0))) - yaz_log(YLOG_WARN, "Unable to load database %s", url); - } - fclose(f); -} - - /* * Local variables: * c-basic-offset: 4