* Sebastian Hammer, Adam Dickmeiss
*
* $Log: client.c,v $
- * Revision 1.8 1995-06-05 10:52:22 quinn
+ * Revision 1.9 1995-06-06 08:15:19 quinn
+ * Cosmetic.
+ *
+ * Revision 1.8 1995/06/05 10:52:22 quinn
* Added SCAN.
*
* Revision 1.7 1995/06/02 09:50:09 quinn
static int protocol = PROTO_Z3950; /* current app protocol */
static ODR_MEM session_mem; /* memory handle for init-response */
static Z_InitResponse *session = 0; /* session parameters */
+static char last_scan[512] = "0";
+static char last_cmd[100] = "?";
#ifdef RPN_QUERY
#ifndef PREFIX_QUERY
static CCL_bibset bibset; /* CCL bibset handle */
static int process_initResponse(Z_InitResponse *res)
{
- /* save parameters for later use */
+ /* save session parameters for later use */
session_mem = odr_extract_mem(in);
session = res;
Z_ScanRequest *req = apdu->u.scanRequest;
char *db = database;
oident attset;
- Z_AttributesPlusTerm sp;
- Z_Term term;
- Odr_oct trm;
req->num_databaseNames = 1;
req->databaseNames = &db;
attset.class = CLASS_ATTSET;
attset.value = VAL_BIB1;
req->attributeSet = oid_getoidbyent(&attset);
- req->termListAndStartPoint = &sp;
- sp.num_attributes = 0;
- sp.attributeList = ODR_NULLVAL;
- sp.term = &term;
- term.which = Z_Term_general;
- term.u.general = &trm;
- trm.buf = (unsigned char*) string;
- trm.len = trm.size = strlen(string);
+ req->termListAndStartPoint = p_query_scan(out, string);
req->numberOfTermsRequested = #
req->preferredPositionInResponse = &pp;
send_apdu(apdu);
void display_term(Z_TermInfo *t)
{
if (t->term->which == Z_Term_general)
+ {
printf("%.*s (%d)\n", t->term->u.general->len, t->term->u.general->buf,
t->globalOccurrences ? *t->globalOccurrences : -1);
+ sprintf(last_scan, "%.*s", t->term->u.general->len,
+ t->term->u.general->buf);
+ }
else
printf("Term type not general.\n");
}
return 0;
}
if (*arg)
+ {
if (send_scanrequest(arg, 5, 19) < 0)
return 0;
+ }
+ else
+ if (send_scanrequest(last_scan, 1, 19) < 0)
+ return 0;
return 2;
}
break;
if ((res = sscanf(line, "%s %[^;]", word, arg)) <= 0)
{
- printf(C_PROMPT);
- continue;
+ strcpy(word, last_cmd);
+ *arg = '\0';
}
- if (res == 1)
+ else if (res == 1)
*arg = 0;
+ strcpy(last_cmd, word);
for (i = 0; cmd[i].cmd; i++)
if (!strncmp(cmd[i].cmd, word, strlen(word)))
{
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: seshigh.c,v $
- * Revision 1.30 1995-06-05 10:53:32 quinn
+ * Revision 1.31 1995-06-06 08:15:37 quinn
+ * Cosmetic.
+ *
+ * Revision 1.30 1995/06/05 10:53:32 quinn
* Added a better SCAN.
*
* Revision 1.29 1995/06/01 11:25:03 quinn
iochan_setevent(h, EVENT_INPUT);
/* we got a complete PDU. Let's decode it */
+ logf(LOG_DEBUG, "Got PDU, %d bytes", res);
req = request_get(); /* get a new request structure */
odr_reset(assoc->decode);
odr_setbuf(assoc->decode, assoc->input_buffer, res, 0);
iochan_destroy(h);
break;
case 0: /* all sent - release the request structure */
+ logf(LOG_DEBUG, "Wrote PDU, %d bytes", req->len_response);
odr_release_mem(req->request_mem);
request_deq(&assoc->outgoing);
request_release(req);
srq.term = req->termListAndStartPoint;
srq.term_position = req->preferredPositionInResponse ?
*req->preferredPositionInResponse : 1;
+ if (req->termListAndStartPoint->term->which == Z_Term_general)
+ logf(LOG_DEBUG, " term: %.*s",
+ req->termListAndStartPoint->term->u.general->len,
+ req->termListAndStartPoint->term->u.general->buf);
if (!(srs = bend_scan(assoc->backend, &srq, 0)))
ents.u.nonSurrogateDiagnostics = diagrecs(assoc->proto, 2, 0);
else if (srs->errcode)
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: statserv.c,v $
- * Revision 1.20 1995-05-29 08:12:09 quinn
+ * Revision 1.21 1995-06-06 08:15:40 quinn
+ * Cosmetic.
+ *
+ * Revision 1.20 1995/05/29 08:12:09 quinn
* Moved oid to util
*
* Revision 1.19 1995/05/16 09:37:27 quinn
static void catchchld(int num)
{
- while (waitpid(-1, 0, WNOHANG) > 0);
+ while (waitpid(-1, 0, WNOHANG) > 0)
+ ;
signal(SIGCHLD, catchchld);
}