1 /* $Id: pazpar2.c,v 1.6 2006-11-27 14:35:15 quinn Exp $ */;
8 #include <sys/socket.h>
13 #include <yaz/comstack.h>
14 #include <yaz/tcpip.h>
15 #include <yaz/proto.h>
16 #include <yaz/readconf.h>
17 #include <yaz/pquery.h>
18 #include <yaz/yaz-util.h>
20 #include <yaz/yaz-ccl.h>
26 #include "termlists.h"
28 #include "relevance.h"
30 #define PAZPAR2_VERSION "0.1"
31 #define MAX_DATABASES 512
34 static void target_destroy(IOCHAN i);
38 struct session *session;
43 char databases[MAX_DATABASES][128];
51 int requestid; // ID of current outstanding request
69 static char *state_strings[] = {
82 IOCHAN channel_list = 0;
84 static struct parameters {
85 int timeout; /* operations timeout, in seconds */
86 char implementationId[128];
87 char implementationName[128];
88 char implementationVersion[128];
89 struct timeval base_time;
92 CCL_bibset ccl_filter;
97 "Index Data PazPar2 (MasterKey)",
106 static int send_apdu(struct target *t, Z_APDU *a)
111 if (!z_APDU(t->odr_out, &a, 0, 0))
113 odr_perror(t->odr_out, "Encoding APDU");
116 buf = odr_getbuf(t->odr_out, &len, 0);
117 r = cs_put(t->link, buf, len);
120 yaz_log(YLOG_WARN, "cs_put: %s", cs_errmsg(cs_errno(t->link)));
125 fprintf(stderr, "cs_put incomplete (ParaZ does not handle that)\n");
127 odr_reset(t->odr_out); /* release the APDU structure */
132 static void send_init(IOCHAN i)
134 struct target *t = iochan_getdata(i);
135 Z_APDU *a = zget_APDU(t->odr_out, Z_APDU_initRequest);
137 a->u.initRequest->implementationId = global_parameters.implementationId;
138 a->u.initRequest->implementationName = global_parameters.implementationName;
139 a->u.initRequest->implementationVersion =
140 global_parameters.implementationVersion;
141 ODR_MASK_SET(a->u.initRequest->options, Z_Options_search);
142 ODR_MASK_SET(a->u.initRequest->options, Z_Options_present);
143 ODR_MASK_SET(a->u.initRequest->options, Z_Options_namedResultSets);
145 ODR_MASK_SET(a->u.initRequest->protocolVersion, Z_ProtocolVersion_1);
146 ODR_MASK_SET(a->u.initRequest->protocolVersion, Z_ProtocolVersion_2);
147 ODR_MASK_SET(a->u.initRequest->protocolVersion, Z_ProtocolVersion_3);
148 if (send_apdu(t, a) >= 0)
150 iochan_setflags(i, EVENT_INPUT);
151 t->state = Initializing;
157 static void send_search(IOCHAN i)
159 struct target *t = iochan_getdata(i);
160 struct session *s = t->session;
161 Z_APDU *a = zget_APDU(t->odr_out, Z_APDU_searchRequest);
162 int ndb, cerror, cpos;
165 struct ccl_rpn_node *cn;
167 yaz_log(YLOG_DEBUG, "Sending search");
169 cn = ccl_find_str(global_parameters.ccl_filter, s->query, &cerror, &cpos);
172 a->u.searchRequest->query = zquery = odr_malloc(t->odr_out, sizeof(Z_Query));
173 zquery->which = Z_Query_type_1;
174 zquery->u.type_1 = ccl_rpn_query(t->odr_out, cn);
177 for (ndb = 0; *t->databases[ndb]; ndb++)
179 databaselist = odr_malloc(t->odr_out, sizeof(char*) * ndb);
180 for (ndb = 0; *t->databases[ndb]; ndb++)
181 databaselist[ndb] = t->databases[ndb];
183 a->u.searchRequest->resultSetName = "Default";
184 a->u.searchRequest->databaseNames = databaselist;
185 a->u.searchRequest->num_databaseNames = ndb;
187 if (send_apdu(t, a) >= 0)
189 iochan_setflags(i, EVENT_INPUT);
190 t->state = Searching;
191 t->requestid = s->requestid;
198 odr_reset(t->odr_out);
201 static void send_present(IOCHAN i)
203 struct target *t = iochan_getdata(i);
204 Z_APDU *a = zget_APDU(t->odr_out, Z_APDU_presentRequest);
206 int start = t->records + 1;
208 toget = global_parameters.chunk;
209 if (toget > t->hits - t->records)
210 toget = t->hits - t->records;
212 yaz_log(YLOG_DEBUG, "Trying to present %d records\n", toget);
214 a->u.presentRequest->resultSetStartPoint = &start;
215 a->u.presentRequest->numberOfRecordsRequested = &toget;
217 a->u.presentRequest->resultSetId = "Default";
219 a->u.presentRequest->preferredRecordSyntax = yaz_oidval_to_z3950oid(t->odr_out,
220 CLASS_RECSYN, VAL_USMARC);
222 if (send_apdu(t, a) >= 0)
224 iochan_setflags(i, EVENT_INPUT);
225 t->state = Presenting;
232 odr_reset(t->odr_out);
235 static void do_initResponse(IOCHAN i, Z_APDU *a)
237 struct target *t = iochan_getdata(i);
238 Z_InitResponse *r = a->u.initResponse;
240 yaz_log(YLOG_DEBUG, "Received init response");
250 static void do_searchResponse(IOCHAN i, Z_APDU *a)
252 struct target *t = iochan_getdata(i);
253 Z_SearchResponse *r = a->u.searchResponse;
255 yaz_log(YLOG_DEBUG, "Searchresponse (status=%d)", *r->searchStatus);
257 if (*r->searchStatus)
259 t->hits = *r->resultCount;
261 t->session->total_hits += t->hits;
268 Z_Records *recs = r->records;
269 if (recs->which == Z_Records_NSD)
271 yaz_log(YLOG_WARN, "Non-surrogate diagnostic");
272 t->diagnostic = *recs->u.nonSurrogateDiagnostic->condition;
279 const char *find_field(const char *rec, const char *field)
281 const char *line = rec;
287 if (!strncmp(line, field, 3) && line[3] == ' ')
289 while (*line && *line != '\n')
291 if (!(eol = strchr(line, '\n')))
298 const char *find_subfield(const char *field, char subfield)
300 const char *p = field;
302 while (*p && *p != '\n')
304 while (*p != '\n' && *p != '\t')
306 if (*p == '\t' && *(++p) == subfield) {
318 // Extract 245 $a $b 100 $a
319 char *extract_title(struct session *s, const char *rec)
321 const char *field, *subfield;
323 unsigned char *obuf, *p;
325 wrbuf_rewind(s->wrbuf);
327 if (!(field = find_field(rec, "245")))
329 if (!(subfield = find_subfield(field, 'a')))
331 ef = index(subfield, '\n');
332 if ((e = index(subfield, '\t')) && e < ef)
336 wrbuf_write(s->wrbuf, subfield, ef - subfield);
337 if ((subfield = find_subfield(field, 'b')))
339 ef = index(subfield, '\n');
340 if ((e = index(subfield, '\t')) && e < ef)
344 wrbuf_putc(s->wrbuf, ' ');
345 wrbuf_write(s->wrbuf, subfield, ef - subfield);
349 if ((field = find_field(rec, "100")))
351 if ((subfield = find_subfield(field, 'a')))
353 ef = index(subfield, '\n');
354 if ((e = index(subfield, '\t')) && e < ef)
358 wrbuf_puts(s->wrbuf, ", by ");
359 wrbuf_write(s->wrbuf, subfield, ef - subfield);
363 wrbuf_putc(s->wrbuf, '\0');
364 obuf = nmem_strdup(s->nmem, wrbuf_buf(s->wrbuf));
365 for (p = obuf; *p; p++)
366 if (*p == '&' || *p == '<' || *p > 122 || *p < ' ')
371 // Extract 245 $a $b 100 $a
372 char *extract_mergekey(struct session *s, const char *rec)
374 const char *field, *subfield;
376 char *out, *p, *pout;
378 wrbuf_rewind(s->wrbuf);
380 if (!(field = find_field(rec, "245")))
382 if (!(subfield = find_subfield(field, 'a')))
384 ef = index(subfield, '\n');
385 if ((e = index(subfield, '\t')) && e < ef)
389 wrbuf_write(s->wrbuf, subfield, ef - subfield);
390 if ((subfield = find_subfield(field, 'b')))
392 ef = index(subfield, '\n');
393 if ((e = index(subfield, '\t')) && e < ef)
397 wrbuf_puts(s->wrbuf, " field ");
398 wrbuf_write(s->wrbuf, subfield, ef - subfield);
402 if ((field = find_field(rec, "100")))
404 if ((subfield = find_subfield(field, 'a')))
406 ef = index(subfield, '\n');
407 if ((e = index(subfield, '\t')) && e < ef)
411 wrbuf_puts(s->wrbuf, " field ");
412 wrbuf_write(s->wrbuf, subfield, ef - subfield);
416 wrbuf_putc(s->wrbuf, '\0');
417 p = wrbuf_buf(s->wrbuf);
418 out = pout = nmem_malloc(s->nmem, strlen(p) + 1);
423 *(pout++) = tolower(*(p++));
424 while (*p && !isalnum(*p))
435 static void push_record(struct session *s, struct record *r)
438 assert(s->recheap_max + 1 < s->recheap_size);
440 s->recheap[p = ++s->recheap_max] = r;
443 int parent = (p - 1) >> 1;
444 if (strcmp(s->recheap[p]->merge_key, s->recheap[parent]->merge_key) < 0)
447 tmp = s->recheap[parent];
448 s->recheap[parent] = s->recheap[p];
457 static struct record *top_record(struct session *s)
459 return s-> recheap_max >= 0 ? s->recheap[0] : 0;
462 static struct record *pop_record(struct session *s)
466 int lastnonleaf = (s->recheap_max - 1) >> 1;
468 if (s->recheap_max < 0)
473 s->recheap[p] = s->recheap[s->recheap_max--];
475 while (p <= lastnonleaf)
477 int right = (p + 1) << 1;
478 int left = right - 1;
481 if (right < s->recheap_max &&
482 strcmp(s->recheap[right]->merge_key, s->recheap[left]->merge_key) < 0)
484 if (strcmp(s->recheap[min]->merge_key, s->recheap[p]->merge_key) < 0)
486 struct record *tmp = s->recheap[min];
487 s->recheap[min] = s->recheap[p];
497 // Like pop_record but collapses identical (merge_key) records
498 // The heap will contain multiple independent matching records and possibly
499 // one cluster, created the last time the list was scanned
500 static struct record *pop_mrecord(struct session *s)
505 if (!(this = pop_record(s)))
508 // Collapse identical records
509 while ((next = top_record(s)))
511 struct record *p, *tmpnext;
512 if (strcmp(this->merge_key, next->merge_key))
514 // Absorb record (and clustersiblings) into a supercluster
515 for (p = next; p; p = tmpnext) {
516 tmpnext = p->next_cluster;
517 p->next_cluster = this->next_cluster;
518 this->next_cluster = p;
526 // Reads records in sort order. Store records in top of heapspace until rewind is called.
527 static struct record *read_recheap(struct session *s)
529 struct record *r = pop_mrecord(s);
533 if (s->recheap_scratch < 0)
534 s->recheap_scratch = s->recheap_size;
535 s->recheap[--s->recheap_scratch] = r;
541 // Return records to heap after read
542 static void rewind_recheap(struct session *s)
544 while (s->recheap_scratch >= 0) {
545 push_record(s, s->recheap[s->recheap_scratch++]);
546 if (s->recheap_scratch >= s->recheap_size)
547 s->recheap_scratch = -1;
553 // FIXME needs to be generalized. Should flexibly generate X lists per search
554 static void extract_subject(struct session *s, const char *rec)
556 const char *field, *subfield;
558 while ((field = find_field(rec, "650")))
560 rec = field + 1; // Crude way to cause a loop through repeating fields
561 if ((subfield = find_subfield(field, 'a')))
567 ef = index(subfield, '\n');
570 if ((e = index(subfield, '\t')) && e < ef)
572 while (ef > subfield && !isalpha(*(ef - 1)) && *(ef - 1) != ')')
576 memcpy(buf, subfield, len);
578 termlist_insert(s->termlist, buf);
583 static void pull_relevance_field(struct session *s, struct record *head, const char *rec,
584 char *field, int mult)
587 while ((fb = find_field(rec, field)))
589 char *ffield = strchr(fb, '\t');
592 char *eol = strchr(ffield, '\n');
595 relevance_countwords(s->relevance, head, ffield, eol - ffield, mult);
596 rec = field + 1; // Crude way to cause a loop through repeating fields
600 static void pull_relevance_keys(struct session *s, struct record *head, struct record *rec)
602 relevance_newrec(s->relevance, head);
603 pull_relevance_field(s, head, rec->buf, "100", 2);
604 pull_relevance_field(s, head, rec->buf, "245", 4);
605 //pull_relevance_field(s, head, rec->buf, "530", 1);
606 pull_relevance_field(s, head, rec->buf, "630", 1);
607 pull_relevance_field(s, head, rec->buf, "650", 1);
608 pull_relevance_field(s, head, rec->buf, "700", 1);
609 relevance_donerecord(s->relevance, head);
612 struct record *ingest_record(struct target *t, char *buf, int len)
614 struct session *s = t->session;
619 wrbuf_rewind(s->wrbuf);
620 yaz_marc_xml(s->yaz_marc, YAZ_MARC_LINE);
621 if (yaz_marc_decode_wrbuf(s->yaz_marc, buf, len, s->wrbuf) < 0)
623 yaz_log(YLOG_WARN, "Failed to decode MARC record");
626 wrbuf_putc(s->wrbuf, '\0');
627 recbuf = wrbuf_buf(s->wrbuf);
629 res = nmem_malloc(s->nmem, sizeof(struct record));
630 res->buf = nmem_strdup(s->nmem, recbuf);
632 extract_subject(s, res->buf);
634 res->title = extract_title(s, res->buf);
635 res->merge_key = extract_mergekey(s, res->buf);
639 res->next_cluster = 0;
640 res->target_offset = -1;
641 res->term_frequency_vec = 0;
643 head = reclist_insert(s->reclist, res);
645 pull_relevance_keys(s, head, res);
652 void ingest_records(struct target *t, Z_Records *r)
654 //struct session *s = t->session;
656 Z_NamePlusRecordList *rlist;
659 if (r->which != Z_Records_DBOSD)
661 rlist = r->u.databaseOrSurDiagnostics;
662 for (i = 0; i < rlist->num_records; i++)
664 Z_NamePlusRecord *npr = rlist->records[i];
669 if (npr->which != Z_NamePlusRecord_databaseRecord)
671 yaz_log(YLOG_WARN, "Unexpected record type, probably diagnostic");
674 e = npr->u.databaseRecord;
675 if (e->which != Z_External_octet)
677 yaz_log(YLOG_WARN, "Unexpected external branch, probably BER");
680 buf = (char*) e->u.octet_aligned->buf;
681 len = e->u.octet_aligned->len;
683 rec = ingest_record(t, buf, len);
689 static void do_presentResponse(IOCHAN i, Z_APDU *a)
691 struct target *t = iochan_getdata(i);
692 Z_PresentResponse *r = a->u.presentResponse;
695 Z_Records *recs = r->records;
696 if (recs->which == Z_Records_NSD)
698 yaz_log(YLOG_WARN, "Non-surrogate diagnostic");
699 t->diagnostic = *recs->u.nonSurrogateDiagnostic->condition;
704 if (!*r->presentStatus && t->state != Error)
706 yaz_log(YLOG_DEBUG, "Good Present response");
707 t->records += *r->numberOfRecordsReturned;
708 ingest_records(t, r->records);
711 else if (*r->presentStatus)
713 yaz_log(YLOG_WARN, "Bad Present response");
718 static void handler(IOCHAN i, int event)
720 struct target *t = iochan_getdata(i);
721 struct session *s = t->session;
722 //static int waiting = 0;
724 if (t->state == No_connection) /* Start connection */
726 int res = cs_connect(t->link, t->addr);
728 t->state = Connecting;
729 if (!res) /* we are go */
730 iochan_setevent(i, EVENT_OUTPUT);
732 iochan_setflags(i, EVENT_OUTPUT);
735 yaz_log(YLOG_WARN|YLOG_ERRNO, "ERROR %s connect\n", t->hostport);
741 else if (t->state == Connecting && event & EVENT_OUTPUT)
744 socklen_t errlen = sizeof(errcode);
746 if (getsockopt(cs_fileno(t->link), SOL_SOCKET, SO_ERROR, &errcode,
747 &errlen) < 0 || errcode != 0)
754 yaz_log(YLOG_DEBUG, "Connect OK");
755 t->state = Connected;
759 else if (event & EVENT_INPUT)
761 int len = cs_get(t->link, &t->ibuf, &t->ibufsize);
775 if (t->requestid == s->requestid || t->state == Initializing)
779 odr_reset(t->odr_in);
780 odr_setbuf(t->odr_in, t->ibuf, len, 0);
781 if (!z_APDU(t->odr_in, &a, 0, 0))
788 case Z_APDU_initResponse:
789 do_initResponse(i, a);
791 case Z_APDU_searchResponse:
792 do_searchResponse(i, a);
794 case Z_APDU_presentResponse:
795 do_presentResponse(i, a);
798 yaz_log(YLOG_WARN, "Unexpected result from server");
802 // if (cs_more(t->link))
803 // iochan_setevent(i, EVENT_INPUT);
805 else // we throw away response and go to idle mode
807 yaz_log(YLOG_DEBUG, "Ignoring result to previous operation");
811 /* if len==1 we do nothing but wait for more input */
814 else if (t->state == Connected) {
818 if (t->state == Idle)
820 if (t->requestid != s->requestid && *s->query) {
823 else if (t->hits > 0 && t->records < global_parameters.toget &&
824 t->records < t->hits) {
830 static void target_destroy(IOCHAN i)
832 struct target *t = iochan_getdata(i);
833 struct session *s = t->session;
835 assert(iochan_getfun(i) == handler);
837 yaz_log(YLOG_DEBUG, "Destroying target");
843 odr_destroy(t->odr_in);
845 odr_destroy(t->odr_out);
846 for (p = &s->targets; *p; p = &(*p)->next)
856 int load_targets(struct session *s, const char *fn)
858 FILE *f = fopen(fn, "r");
860 struct target **target_p;
864 yaz_log(YLOG_WARN|YLOG_ERRNO, "open %s", fn);
869 target_destroy(s->targets->iochan);
872 target_p = &s->targets;
873 while (fgets(line, 255, f))
876 struct target *target;
879 if (strncmp(line, "target ", 7))
882 url[strlen(url) - 1] = '\0';
883 yaz_log(LOG_DEBUG, "Target: %s", url);
885 *target_p = target = xmalloc(sizeof(**target_p));
887 target_p = &target->next;
888 target->state = No_connection;
890 target->ibufsize = 0;
891 target->odr_in = odr_createmem(ODR_DECODE);
892 target->odr_out = odr_createmem(ODR_ENCODE);
896 target->requestid = -1;
898 target->diagnostic = 0;
899 strcpy(target->fullname, url);
900 if ((p = strchr(url, '/')))
903 strcpy(target->hostport, url);
906 strcpy(target->databases[0], p);
907 target->databases[1][0] = '\0';
911 strcpy(target->hostport, url);
912 strcpy(target->databases[0], "Default");
913 target->databases[1][0] = '\0';
916 if (!(target->link = cs_create(tcpip_type, 0, PROTO_Z3950)))
918 yaz_log(YLOG_FATAL|YLOG_ERRNO, "Failed to create comstack");
921 if (!(target->addr = cs_straddr(target->link, target->hostport)))
923 printf("ERROR %s bad-address", target->hostport);
924 target->state = Failed;
927 target->iochan = new = iochan_create(cs_fileno(target->link), handler, 0);
929 iochan_setdata(new, target);
930 iochan_setevent(new, EVENT_EXCEPT);
931 new->next = channel_list;
939 static void pull_terms(NMEM nmem, struct ccl_rpn_node *n, char **termlist, int *num)
947 pull_terms(nmem, n->u.p[0], termlist, num);
948 pull_terms(nmem, n->u.p[1], termlist, num);
951 termlist[(*num)++] = nmem_strdup(nmem, n->u.t.term);
958 // Extract terms from query into null-terminated termlist
959 static int extract_terms(NMEM nmem, char *query, char **termlist)
962 struct ccl_rpn_node *n;
965 n = ccl_find_str(global_parameters.ccl_filter, query, &error, &pos);
968 pull_terms(nmem, n, termlist, &num);
974 char *search(struct session *s, char *query)
977 int live_channels = 0;
979 yaz_log(YLOG_DEBUG, "Search");
981 // Determine what iochans belong to this session
982 // It might have been better to have a list of them
984 strcpy(s->query, query);
987 for (c = channel_list; c; c = c->next)
991 if (iochan_getfun(c) != handler) // Not a Z target
993 t = iochan_getdata(c);
1000 if (t->state == Error)
1003 if (t->state == Idle)
1004 iochan_setflag(c, EVENT_OUTPUT);
1012 int maxrecs = live_channels * global_parameters.toget;
1013 s->termlist = termlist_create(s->nmem, maxrecs, 15);
1014 s->reclist = reclist_create(s->nmem, maxrecs);
1015 extract_terms(s->nmem, query, p);
1016 s->relevance = relevance_create(s->nmem, (const char **) p, maxrecs);
1017 s->total_records = s->total_hits = 0;
1025 struct session *new_session()
1027 struct session *session = xmalloc(sizeof(*session));
1029 yaz_log(YLOG_DEBUG, "New pazpar2 session");
1031 session->total_hits = 0;
1032 session->total_records = 0;
1033 session->termlist = 0;
1034 session->reclist = 0;
1035 session->requestid = -1;
1036 session->targets = 0;
1037 session->pqf_parser = yaz_pqf_create();
1038 session->query[0] = '\0';
1039 session->nmem = nmem_create();
1040 session->yaz_marc = yaz_marc_create();
1041 yaz_marc_subfield_str(session->yaz_marc, "\t");
1042 session->wrbuf = wrbuf_alloc();
1047 void session_destroy(struct session *s)
1049 // FIXME do some shit here!!!!
1052 struct hitsbytarget *hitsbytarget(struct session *s, int *count)
1054 static struct hitsbytarget res[1000]; // FIXME MM
1058 for (c = channel_list; c; c = c->next)
1059 if (iochan_getfun(c) == handler)
1061 struct target *t = iochan_getdata(c);
1062 if (t->session == s)
1064 strcpy(res[*count].id, t->hostport);
1065 res[*count].hits = t->hits;
1066 res[*count].records = t->records;
1067 res[*count].diagnostic = t->diagnostic;
1068 res[*count].state = state_strings[(int) t->state];
1076 struct termlist_score **termlist(struct session *s, int *num)
1078 return termlist_highscore(s->termlist, num);
1081 struct record **show(struct session *s, int start, int *num)
1083 struct record **recs = nmem_malloc(s->nmem, *num * sizeof(struct record *));
1086 // FIXME -- skip initial records
1088 relevance_prepare_read(s->relevance, s->reclist);
1089 for (i = 0; i < *num; i++)
1091 struct record *r = reclist_read_record(s->reclist);
1102 void statistics(struct session *s, struct statistics *stat)
1107 bzero(stat, sizeof(*stat));
1108 for (i = 0, c = channel_list; c; i++, c = c->next)
1111 if (iochan_getfun(c) != handler)
1113 t = iochan_getdata(c);
1116 case No_connection: stat->num_no_connection++; break;
1117 case Connecting: stat->num_connecting++; break;
1118 case Initializing: stat->num_initializing++; break;
1119 case Searching: stat->num_searching++; break;
1120 case Presenting: stat->num_presenting++; break;
1121 case Idle: stat->num_idle++; break;
1122 case Failed: stat->num_failed++; break;
1123 case Error: stat->num_error++; break;
1127 stat->num_hits = s->total_hits;
1128 stat->num_records = s->total_records;
1130 stat->num_connections = i;
1133 static CCL_bibset load_cclfile(const char *fn)
1135 CCL_bibset res = ccl_qual_mk();
1136 if (ccl_qual_fname(res, fn) < 0)
1138 yaz_log(YLOG_FATAL|YLOG_ERRNO, "%s", fn);
1144 int main(int argc, char **argv)
1149 if (signal(SIGPIPE, SIG_IGN) < 0)
1150 yaz_log(YLOG_WARN|YLOG_ERRNO, "signal");
1152 yaz_log_init(YLOG_DEFAULT_LEVEL|YLOG_DEBUG, "pazpar2", 0);
1154 while ((ret = options("c:h:p:C:", argv, argc, &arg)) != -2)
1160 command_init(atoi(arg));
1163 global_parameters.ccl_filter = load_cclfile(arg);
1166 http_init(atoi(arg));
1169 http_set_proxyaddr(arg);
1172 fprintf(stderr, "Usage: pazpar2 -d comport");
1178 if (!global_parameters.ccl_filter)
1179 global_parameters.ccl_filter = load_cclfile("default.bib");
1181 event_loop(&channel_list);
1189 * indent-tabs-mode: nil
1191 * vim: shiftwidth=4 tabstop=8 expandtab