2 * Copyright (C) 1995-2000, Index Data
6 * Revision 1.82 2001-07-09 23:40:09 adam
9 * Revision 1.81 2001/02/14 21:42:07 adam
10 * Fixed versions as returned in INIT response.
12 * Revision 1.80 2000/09/05 14:04:05 adam
13 * Updates for prefix 'yaz_' for YAZ log functions.
15 * Revision 1.79 2000/05/09 10:56:50 adam
16 * Added call to xmalloc/nmem debugging functions.
18 * Revision 1.78 2000/04/05 09:49:35 adam
19 * On Unix, zebra/z'mbol uses automake.
21 * Revision 1.77 2000/03/20 19:08:36 adam
22 * Added remote record import using Z39.50 extended services and Segment
25 * Revision 1.76 2000/03/15 15:00:31 adam
26 * First work on threaded version.
28 * Revision 1.75 1999/11/30 13:48:04 adam
29 * Improved installation. Updated for inclusion of YAZ header files.
31 * Revision 1.74 1999/11/29 15:13:26 adam
32 * Server sets implementationName - and Version.
34 * Revision 1.73 1999/11/04 15:00:45 adam
35 * Implemented delete result set(s).
37 * Revision 1.71 1999/07/14 10:59:26 adam
38 * Changed functions isc_getmethod, isams_getmethod.
39 * Improved fatal error handling (such as missing EXPLAIN schema).
41 * Revision 1.70 1999/06/10 12:14:56 adam
42 * Fixed to use bend_start instead of pre_init.
44 * Revision 1.69 1999/06/10 09:20:03 adam
45 * Minor change to pre_init handler.
47 * Revision 1.68 1999/05/26 07:49:13 adam
50 * Revision 1.67 1999/02/02 14:51:14 adam
51 * Updated WIN32 code specific sections. Changed header.
53 * Revision 1.66 1998/10/28 10:54:41 adam
56 * Revision 1.65 1998/10/18 07:54:54 adam
57 * Additional info added for diagnostics 114 (Unsupported use attribute) and
58 * 121 (Unsupported attribute set).
60 * Revision 1.64 1998/09/22 10:48:21 adam
61 * Minor changes in search API.
63 * Revision 1.63 1998/09/02 13:53:21 adam
64 * Extra parameter decode added to search routines to implement
67 * Revision 1.62 1998/08/06 14:35:28 adam
68 * Routine bend_deleterequest removed.
70 * Revision 1.61 1998/06/24 12:16:15 adam
71 * Support for relations on text operands. Open range support in
72 * DFA module (i.e. [-j], [g-]).
74 * Revision 1.60 1998/06/22 11:36:49 adam
75 * Added authentication check facility to zebra.
77 * Revision 1.59 1998/06/12 12:22:13 adam
80 * Revision 1.58 1998/05/27 16:57:46 adam
81 * Zebra returns surrogate diagnostic for single records when
84 * Revision 1.57 1998/04/03 14:45:18 adam
85 * Fixed setting of last_in_set in bend_fetch.
87 * Revision 1.56 1998/03/05 08:45:13 adam
88 * New result set model and modular ranking system. Moved towards
89 * descent server API. System information stored as "SGML" records.
91 * Revision 1.55 1998/02/10 12:03:06 adam
94 * Revision 1.54 1998/01/29 13:39:13 adam
95 * Compress ISAM is default.
97 * Revision 1.53 1998/01/12 15:04:09 adam
98 * The test option (-s) only uses read-lock (and not write lock).
100 * Revision 1.52 1997/11/18 10:05:08 adam
101 * Changed character map facility so that admin can specify character
102 * mapping files for each register type, w, p, etc.
104 * Revision 1.51 1997/10/27 14:33:06 adam
105 * Moved towards generic character mapping depending on "structure"
106 * field in abstract syntax file. Fixed a few memory leaks. Fixed
107 * bug with negative integers when doing searches with relational
110 * Revision 1.50 1997/09/29 09:08:36 adam
111 * Revised locking system to be thread safe for the server.
113 * Revision 1.49 1997/09/25 14:57:23 adam
116 * Revision 1.48 1997/09/17 12:19:19 adam
117 * Zebra version corresponds to YAZ version 1.4.
118 * Changed Zebra server so that it doesn't depend on global common_resource.
120 * Revision 1.47 1997/09/04 13:58:36 adam
121 * New retrieve/extract method tellf (added).
122 * Added O_BINARY for open calls.
124 * Revision 1.46 1997/07/28 08:30:47 adam
125 * Server returns diagnostic 14 when record doesn't exist.
127 * Revision 1.45 1996/12/23 15:30:45 adam
128 * Work on truncation.
129 * Bug fix: result sets weren't deleted after server shut down.
131 * Revision 1.44 1996/12/11 12:08:01 adam
132 * Added better compression.
134 * Revision 1.43 1996/11/15 15:03:58 adam
135 * Logging of execution speed by using the times(2) call.
137 * Revision 1.42 1996/11/08 11:10:36 adam
138 * Buffers used during file match got bigger.
139 * Compressed ISAM support everywhere.
140 * Bug fixes regarding masking characters in queries.
141 * Redesigned Regexp-2 queries.
143 * Revision 1.41 1996/10/29 14:09:56 adam
144 * Use of cisam system - enabled if setting isamc is 1.
146 * Revision 1.40 1996/06/04 10:19:02 adam
147 * Minor changes - removed include of ctype.h.
149 * Revision 1.39 1996/05/31 09:07:05 quinn
150 * Work on character-set handling
152 * Revision 1.38 1996/05/14 11:34:01 adam
153 * Scan support in multiple registers/databases.
155 * Revision 1.37 1996/05/14 06:16:48 adam
156 * Compact use/set bytes used in search service.
158 * Revision 1.36 1996/05/01 13:46:37 adam
159 * First work on multiple records in one file.
160 * New option, -offset, to the "unread" command in the filter module.
162 * Revision 1.35 1996/03/26 16:01:14 adam
163 * New setting lockPath: directory of various lock files.
165 * Revision 1.34 1996/03/20 09:36:46 adam
166 * Function dict_lookup_grep got extra parameter, init_pos, which marks
167 * from which position in pattern approximate pattern matching should occur.
168 * Approximate pattern matching is used in relevance=re-2.
170 * Revision 1.33 1996/01/17 14:57:56 adam
171 * Prototype changed for reader functions in extract/retrieve. File
172 * is identified by 'void *' instead of 'int.
174 * Revision 1.32 1995/12/11 09:12:58 adam
175 * The rec_get function returns NULL if record doesn't exist - will
176 * happen in the server if the result set records have been deleted since
177 * the creation of the set (i.e. the search).
178 * The server saves a result temporarily if it is 'volatile', i.e. the
179 * set is register dependent.
181 * Revision 1.31 1995/12/08 16:22:56 adam
182 * Work on update while servers are running. Three lock files introduced.
183 * The servers reload their registers when necessary, but they don't
184 * reestablish result sets yet.
186 * Revision 1.30 1995/12/07 17:38:48 adam
187 * Work locking mechanisms for concurrent updates/commit.
189 * Revision 1.29 1995/12/04 14:22:32 adam
190 * Extra arg to recType_byName.
191 * Started work on new regular expression parsed input to
192 * structured records.
194 * Revision 1.28 1995/11/28 09:09:48 adam
195 * Zebra config renamed.
196 * Use setting 'recordId' to identify record now.
197 * Bug fix in recindex.c: rec_release_blocks was invokeded even
198 * though the blocks were already released.
199 * File traversal properly deletes records when needed.
201 * Revision 1.27 1995/11/27 13:58:54 adam
202 * New option -t. storeStore data implemented in server.
204 * Revision 1.26 1995/11/25 10:24:07 adam
205 * More record fields - they are enumerated now.
206 * New options: flagStoreData flagStoreKey.
208 * Revision 1.25 1995/11/21 15:29:13 adam
209 * Config file 'base' read by default by both indexer and server.
211 * Revision 1.24 1995/11/20 16:59:47 adam
212 * New update method: the 'old' keys are saved for each records.
214 * Revision 1.23 1995/11/16 17:00:56 adam
215 * Better logging of rpn query.
217 * Revision 1.22 1995/11/16 15:34:55 adam
218 * Uses new record management system in both indexer and server.
220 * Revision 1.21 1995/11/01 16:25:52 quinn
221 * *** empty log message ***
223 * Revision 1.20 1995/10/27 14:00:12 adam
224 * Implemented detection of database availability.
226 * Revision 1.19 1995/10/17 18:02:11 adam
227 * New feature: databases. Implemented as prefix to words in dictionary.
229 * Revision 1.18 1995/10/16 14:03:09 quinn
230 * Changes to support element set names and espec1
232 * Revision 1.17 1995/10/16 09:32:40 adam
233 * More work on relational op.
235 * Revision 1.16 1995/10/13 12:26:44 adam
236 * Optimization of truncation.
238 * Revision 1.15 1995/10/12 12:40:55 adam
239 * Bug fixes in rpn_prox.
241 * Revision 1.14 1995/10/09 16:18:37 adam
242 * Function dict_lookup_grep got extra client data parameter.
244 * Revision 1.13 1995/10/06 14:38:00 adam
245 * New result set method: r_score.
246 * Local no (sysno) and score is transferred to retrieveCtrl.
248 * Revision 1.12 1995/10/06 13:52:06 adam
249 * Bug fixes. Handler may abort further scanning.
251 * Revision 1.11 1995/10/06 10:43:57 adam
252 * Scan added. 'occurrences' in scan entries not set yet.
254 * Revision 1.10 1995/10/02 16:43:32 quinn
255 * Set default resulting record type in fetch.
257 * Revision 1.9 1995/10/02 15:18:52 adam
258 * New member in recRetrieveCtrl: diagnostic.
260 * Revision 1.8 1995/09/28 09:19:47 adam
261 * xfree/xmalloc used everywhere.
262 * Extract/retrieve method seems to work for text records.
264 * Revision 1.7 1995/09/27 16:17:32 adam
265 * More work on retrieve.
267 * Revision 1.6 1995/09/08 08:53:22 adam
268 * Record buffer maintained in server_info.
270 * Revision 1.5 1995/09/06 16:11:18 adam
271 * Option: only one word key per file.
273 * Revision 1.4 1995/09/06 10:33:04 adam
274 * More work on present. Some log messages removed.
276 * Revision 1.3 1995/09/05 15:28:40 adam
277 * More work on search engine.
279 * Revision 1.2 1995/09/04 12:33:43 adam
280 * Various cleanup. YAZ util used instead.
282 * Revision 1.1 1995/09/04 09:10:41 adam
283 * More work on index add/del/update.
284 * Merge sort implemented.
285 * Initial work on z39 server.
299 #include <yaz/data1.h>
310 #include "zebrasdr.h"
313 static int bend_sort (void *handle, bend_sort_rr *rr);
314 static int bend_delete (void *handle, bend_delete_rr *rr);
315 static int bend_esrequest (void *handle, bend_esrequest_rr *rr);
316 static int bend_segment (void *handle, bend_segment_rr *rr);
317 static int bend_search (void *handle, bend_search_rr *r);
318 static int bend_fetch (void *handle, bend_fetch_rr *r);
319 static int bend_scan (void *handle, bend_scan_rr *r);
321 bend_initresult *bend_init (bend_initrequest *q)
323 bend_initresult *r = (bend_initresult *)
324 odr_malloc (q->stream, sizeof(*r));
326 struct statserv_options_block *sob;
332 q->bend_sort = bend_sort;
333 q->bend_delete = bend_delete;
334 q->bend_esrequest = bend_esrequest;
335 q->bend_segment = bend_segment;
336 q->bend_search = bend_search;
337 q->bend_fetch = bend_fetch;
338 q->bend_scan = bend_scan;
341 q->implementation_name = "Z'mbol Information Server";
342 q->implementation_version = "Z'mbol " ZEBRAVER;
344 q->implementation_name = "Zebra Information Server";
345 q->implementation_version = "Zebra " ZEBRAVER;
348 logf (LOG_DEBUG, "bend_init");
350 sob = statserv_getcontrol ();
351 if (!(zh = zebra_open (sob->handle)))
353 logf (LOG_FATAL, "Failed to open Zebra `%s'", sob->configname);
359 if (q->auth->which == Z_IdAuthentication_open)
361 char *openpass = xstrdup (q->auth->u.open);
362 char *cp = strchr (openpass, '/');
366 user = nmem_strdup (odr_getmem (q->stream), openpass);
367 passwd = nmem_strdup (odr_getmem (q->stream), cp+1);
372 if (zebra_auth (zh->service, user, passwd))
383 int bend_search (void *handle, bend_search_rr *r)
385 ZebraHandle zh = (ZebraHandle) handle;
391 logf (LOG_LOG, "ResultSet '%s'", r->setname);
392 switch (r->query->which)
394 case Z_Query_type_1: case Z_Query_type_101:
395 zebra_search_rpn (zh, r->decode, r->stream, r->query->u.type_1,
396 r->num_bases, r->basenames, r->setname);
397 r->errcode = zh->errCode;
398 r->errstring = zh->errString;
403 r->errstring = "type-2";
411 int bend_fetch (void *handle, bend_fetch_rr *r)
413 ZebraHandle zh = (ZebraHandle) handle;
414 ZebraRetrievalRecord retrievalRecord;
416 retrievalRecord.position = r->number;
419 zebra_records_retrieve (zh, r->stream, r->setname, r->comp,
420 r->request_format, 1, &retrievalRecord);
421 if (zh->errCode) /* non Surrogate Diagnostic */
423 r->errcode = zh->errCode;
424 r->errstring = zh->errString;
426 else if (retrievalRecord.errCode) /* Surrogate Diagnostic */
428 r->surrogate_flag = 1;
429 r->errcode = retrievalRecord.errCode;
430 r->errstring = retrievalRecord.errString;
431 r->basename = retrievalRecord.base;
433 else /* Database Record */
436 r->basename = retrievalRecord.base;
437 r->record = retrievalRecord.buf;
438 r->len = retrievalRecord.len;
439 r->output_format = retrievalRecord.format;
444 static int bend_scan (void *handle, bend_scan_rr *r)
446 ZebraScanEntry *entries;
447 ZebraHandle zh = (ZebraHandle) handle;
450 r->entries = (struct scan_entry *)
451 odr_malloc (r->stream, sizeof(*r->entries) * r->num_entries);
452 zebra_scan (zh, r->stream, r->term,
454 r->num_bases, r->basenames,
456 &r->num_entries, &entries, &is_partial);
458 r->status = BEND_SCAN_PARTIAL;
460 r->status = BEND_SCAN_SUCCESS;
461 for (i = 0; i < r->num_entries; i++)
463 r->entries[i].term = entries[i].term;
464 r->entries[i].occurrences = entries[i].occurrences;
466 r->errcode = zh->errCode;
467 r->errstring = zh->errString;
471 void bend_close (void *handle)
473 zebra_close ((ZebraHandle) handle);
474 xmalloc_trav("bend_close");
478 int bend_sort (void *handle, bend_sort_rr *rr)
480 ZebraHandle zh = (ZebraHandle) handle;
482 zebra_sort (zh, rr->stream,
483 rr->num_input_setnames, (const char **) rr->input_setnames,
484 rr->output_setname, rr->sort_sequence, &rr->sort_status);
485 rr->errcode = zh->errCode;
486 rr->errstring = zh->errString;
490 int bend_delete (void *handle, bend_delete_rr *rr)
492 ZebraHandle zh = (ZebraHandle) handle;
494 rr->delete_status = zebra_deleleResultSet(zh, rr->function,
495 rr->num_setnames, rr->setnames,
500 static int es_admin_request (ZebraHandle zh, Z_AdminEsRequest *r)
502 switch (r->toKeep->which)
504 case Z_ESAdminOriginPartToKeep_reIndex:
505 yaz_log(LOG_LOG, "adm-reindex");
507 case Z_ESAdminOriginPartToKeep_truncate:
508 yaz_log(LOG_LOG, "adm-truncate");
510 case Z_ESAdminOriginPartToKeep_drop:
511 yaz_log(LOG_LOG, "adm-drop");
513 case Z_ESAdminOriginPartToKeep_create:
514 yaz_log(LOG_LOG, "adm-create");
515 zebra_admin_create (zh, r->toKeep->databaseName);
517 case Z_ESAdminOriginPartToKeep_import:
518 yaz_log(LOG_LOG, "adm-import");
519 zebra_admin_import_begin (zh, r->toKeep->databaseName);
521 case Z_ESAdminOriginPartToKeep_refresh:
522 yaz_log(LOG_LOG, "adm-refresh");
524 case Z_ESAdminOriginPartToKeep_commit:
525 yaz_log(LOG_LOG, "adm-commit");
527 case Z_ESAdminOriginPartToKeep_shutdown:
528 yaz_log(LOG_LOG, "shutdown");
529 zebra_admin_shutdown(zh);
531 case Z_ESAdminOriginPartToKeep_start:
532 yaz_log(LOG_LOG, "start");
533 zebra_admin_start(zh);
536 yaz_log(LOG_LOG, "unknown admin");
539 if (r->toKeep->databaseName)
541 yaz_log(LOG_LOG, "database %s", r->toKeep->databaseName);
546 static int es_admin (ZebraHandle zh, Z_Admin *r)
550 case Z_Admin_esRequest:
551 es_admin_request (zh, r->u.esRequest);
553 case Z_Admin_taskPackage:
554 yaz_log (LOG_LOG, "adm taskpackage (unhandled)");
564 int bend_segment (void *handle, bend_segment_rr *rr)
566 ZebraHandle zh = (ZebraHandle) handle;
567 Z_Segment *segment = rr->segment;
569 if (segment->num_segmentRecords)
570 zebra_admin_import_segment (zh, rr->segment);
572 zebra_admin_import_end (zh);
576 int bend_esrequest (void *handle, bend_esrequest_rr *rr)
578 ZebraHandle zh = (ZebraHandle) handle;
580 yaz_log(LOG_LOG, "function: %d", *rr->esr->function);
581 if (rr->esr->packageName)
582 yaz_log(LOG_LOG, "packagename: %s", rr->esr->packageName);
583 yaz_log(LOG_LOG, "Waitaction: %d", *rr->esr->waitAction);
585 if (!rr->esr->taskSpecificParameters)
587 yaz_log (LOG_WARN, "No task specific parameters");
589 else if (rr->esr->taskSpecificParameters->which == Z_External_ESAdmin)
591 es_admin (zh, rr->esr->taskSpecificParameters->u.adminService);
592 rr->errcode = zh->errCode;
593 rr->errstring = zh->errString;
595 else if (rr->esr->taskSpecificParameters->which == Z_External_itemOrder)
597 Z_ItemOrder *it = rr->esr->taskSpecificParameters->u.itemOrder;
598 yaz_log (LOG_LOG, "Received ItemOrder");
602 case Z_IOItemOrder_esRequest:
604 case Z_ItemOrder_esRequest:
607 Z_IORequest *ir = it->u.esRequest;
608 Z_IOOriginPartToKeep *k = ir->toKeep;
609 Z_IOOriginPartNotToKeep *n = ir->notToKeep;
613 if (k->contact->name)
614 yaz_log(LOG_LOG, "contact name %s", k->contact->name);
615 if (k->contact->phone)
616 yaz_log(LOG_LOG, "contact phone %s", k->contact->phone);
617 if (k->contact->email)
618 yaz_log(LOG_LOG, "contact email %s", k->contact->email);
622 yaz_log(LOG_LOG, "Billing info (not shown)");
625 if (n->resultSetItem)
627 yaz_log(LOG_LOG, "resultsetItem");
628 yaz_log(LOG_LOG, "setId: %s", n->resultSetItem->resultSetId);
629 yaz_log(LOG_LOG, "item: %d", *n->resultSetItem->item);
634 Z_External *r = (Z_External*) n->itemRequest;
635 ILL_ItemRequest *item_req = 0;
636 ILL_Request *ill_req = 0;
637 if (r->direct_reference)
639 oident *ent = oid_getentbyoid(r->direct_reference);
641 yaz_log(LOG_LOG, "OID %s", ent->desc);
642 if (ent && ent->value == VAL_ISO_ILL_1)
644 yaz_log (LOG_LOG, "ItemRequest");
645 if (r->which == ODR_EXTERNAL_single)
647 odr_setbuf(rr->decode,
648 r->u.single_ASN1_type->buf,
649 r->u.single_ASN1_type->len, 0);
651 if (!ill_ItemRequest (rr->decode, &item_req, 0, 0))
654 "Couldn't decode ItemRequest %s near %d",
655 odr_errmsg(odr_geterror(rr->decode)),
656 odr_offset(rr->decode));
657 yaz_log(LOG_LOG, "PDU dump:");
658 odr_dumpBER(yaz_log_file(),
659 r->u.single_ASN1_type->buf,
660 r->u.single_ASN1_type->len);
664 ill_ItemRequest (rr->print, &item_req, 0,
666 odr_reset (rr->print);
669 if (!item_req && r->which == ODR_EXTERNAL_single)
671 yaz_log (LOG_LOG, "ILLRequest");
672 odr_setbuf(rr->decode,
673 r->u.single_ASN1_type->buf,
674 r->u.single_ASN1_type->len, 0);
676 if (!ill_Request (rr->decode, &ill_req, 0, 0))
679 "Couldn't decode ILLRequest %s near %d",
680 odr_errmsg(odr_geterror(rr->decode)),
681 odr_offset(rr->decode));
682 yaz_log(LOG_LOG, "PDU dump:");
683 odr_dumpBER(yaz_log_file(),
684 r->u.single_ASN1_type->buf,
685 r->u.single_ASN1_type->len);
689 ill_Request (rr->print, &ill_req, 0,
691 odr_reset (rr->print);
698 yaz_log (LOG_LOG, "ILL protocol version = %d",
699 *item_req->protocol_version_num);
707 else if (rr->esr->taskSpecificParameters->which == Z_External_update)
709 Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update;
710 yaz_log (LOG_LOG, "Received DB Update");
711 if (up->which == Z_IUUpdate_esRequest)
713 Z_IUUpdateEsRequest *esRequest = up->u.esRequest;
714 Z_IUOriginPartToKeep *toKeep = esRequest->toKeep;
715 Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep;
717 yaz_log (LOG_LOG, "action");
720 switch (*toKeep->action)
722 case Z_IUOriginPartToKeep_recordInsert:
723 yaz_log (LOG_LOG, "recordInsert");
725 case Z_IUOriginPartToKeep_recordReplace:
726 yaz_log (LOG_LOG, "recordUpdate");
728 case Z_IUOriginPartToKeep_recordDelete:
729 yaz_log (LOG_LOG, "recordDelete");
731 case Z_IUOriginPartToKeep_elementUpdate:
732 yaz_log (LOG_LOG, "elementUpdate");
734 case Z_IUOriginPartToKeep_specialUpdate:
735 yaz_log (LOG_LOG, "specialUpdate");
737 case Z_ESAdminOriginPartToKeep_shutdown:
738 yaz_log (LOG_LOG, "shutDown");
740 case Z_ESAdminOriginPartToKeep_start:
741 yaz_log (LOG_LOG, "start");
744 yaz_log (LOG_LOG, " unknown (%d)", *toKeep->action);
747 if (toKeep->databaseName)
749 yaz_log (LOG_LOG, "database: %s", toKeep->databaseName);
750 if (!strcmp(toKeep->databaseName, "fault"))
753 rr->errstring = toKeep->databaseName;
755 if (!strcmp(toKeep->databaseName, "accept"))
761 for (i = 0; i < notToKeep->num; i++)
763 Z_External *rec = notToKeep->elements[i]->record;
765 if (rec->direct_reference)
767 struct oident *oident;
768 oident = oid_getentbyoid(rec->direct_reference);
770 yaz_log (LOG_LOG, "record %d type %s", i,
775 case Z_External_sutrs:
776 if (rec->u.octet_aligned->len > 170)
777 yaz_log (LOG_LOG, "%d bytes:\n%.168s ...",
781 yaz_log (LOG_LOG, "%d bytes:\n%s",
785 case Z_External_octet:
786 if (rec->u.octet_aligned->len > 170)
787 yaz_log (LOG_LOG, "%d bytes:\n%.168s ...",
788 rec->u.octet_aligned->len,
789 rec->u.octet_aligned->buf);
791 yaz_log (LOG_LOG, "%d bytes\n%s",
792 rec->u.octet_aligned->len,
793 rec->u.octet_aligned->buf);
801 yaz_log (LOG_WARN, "Unknown Extended Service(%d)",
802 rr->esr->taskSpecificParameters->which);
808 static void bend_start (struct statserv_options_block *sob)
815 char *pidfile = "zebrasrv.pid";
816 int fd = creat (pidfile, 0666);
818 logf (LOG_WARN|LOG_ERRNO, "creat %s", pidfile);
823 sprintf (pidstr, "%ld", (long) getpid ());
824 write (fd, pidstr, strlen(pidstr));
830 zebra_stop((ZebraService) sob->handle);
831 sob->handle = zebra_start(sob->configname);
834 static void bend_stop(struct statserv_options_block *sob)
838 ZebraService service = sob->handle;
843 int main (int argc, char **argv)
845 struct statserv_options_block *sob;
847 sob = statserv_getcontrol ();
848 strcpy (sob->configname, FNAME_CONFIG);
849 sob->bend_start = bend_start;
850 sob->bend_stop = bend_stop;
852 statserv_setcontrol (sob);
854 return statserv_main (argc, argv, bend_init, bend_close);