From acd965f3e537fd2449d99a8ce7ee731112cd7c4e Mon Sep 17 00:00:00 2001 From: Sebastian Hammer Date: Sun, 8 Apr 2007 22:38:45 +0000 Subject: [PATCH] Removed dead code. --- src/pazpar2.c | 110 +-------------------------------------------------------- 1 file changed, 1 insertion(+), 109 deletions(-) diff --git a/src/pazpar2.c b/src/pazpar2.c index 9797eee..79bc2ba 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -1,4 +1,4 @@ -/* $Id: pazpar2.c,v 1.65 2007-04-08 21:51:58 quinn Exp $ */ +/* $Id: pazpar2.c,v 1.66 2007-04-08 22:38:45 quinn Exp $ */ #include #include @@ -1139,114 +1139,6 @@ static int client_prep_connection(struct client *cl) return 0; } -#ifdef GAGA // Moved to database.c - -// 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, *db; - char *name; - struct host *host; - struct database *database; - - if (strncmp(line, "target ", 7)) - continue; - line[strlen(line) - 1] = '\0'; - - if ((name = strchr(line, ';'))) - *(name++) = '\0'; - - url = line + 7; - if ((db = strchr(url, '/'))) - *(db++) = '\0'; - else - db = "Default"; - - yaz_log(YLOG_LOG, "Target: %s, '%s'", url, db); - for (host = hosts; host; host = host->next) - if (!strcmp((const char *) url, host->hostport)) - break; - if (!host) - { - struct addrinfo *addrinfo, hints; - char *port; - char ipport[128]; - unsigned char addrbuf[4]; - int res; - - host = xmalloc(sizeof(struct host)); - host->hostport = xstrdup(url); - host->connections = 0; - - if ((port = strchr(url, ':'))) - *(port++) = '\0'; - else - port = "210"; - - hints.ai_flags = 0; - hints.ai_family = PF_INET; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - hints.ai_addrlen = 0; - hints.ai_addr = 0; - hints.ai_canonname = 0; - hints.ai_next = 0; - // This is not robust code. It assumes that getaddrinfo returns AF_INET - // address. - if ((res = getaddrinfo(url, port, &hints, &addrinfo))) - { - yaz_log(YLOG_WARN, "Failed to resolve %s: %s", url, gai_strerror(res)); - xfree(host->hostport); - xfree(host); - continue; - } - assert(addrinfo->ai_family == PF_INET); - memcpy(addrbuf, &((struct sockaddr_in*)addrinfo->ai_addr)->sin_addr.s_addr, 4); - sprintf(ipport, "%u.%u.%u.%u:%s", - addrbuf[0], addrbuf[1], addrbuf[2], addrbuf[3], port); - host->ipport = xstrdup(ipport); - freeaddrinfo(addrinfo); - host->next = hosts; - hosts = host; - } - database = xmalloc(sizeof(struct database)); - database->host = host; - database->url = xmalloc(strlen(url) + strlen(db) + 2); - strcpy(database->url, url); - strcat(database->url, "/"); - strcat(database->url, db); - if (name) - database->name = xstrdup(name); - else - database->name = 0; - - database->databases = xmalloc(2 * sizeof(char *)); - database->databases[0] = xstrdup(db); - database->databases[1] = 0; - database->errors = 0; - database->qprofile = 0; - database->rprofile = database_retrieval_profile(database); - database->next = databases; - databases = database; - - } - fclose(f); -} - -#endif - static struct client *client_create(void) { struct client *r; -- 1.7.10.4