X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=5782e89597c3f606fce35c5a51fcfeec3d1007b1;hb=96714f89e8a4577ce57683d80c2c3147541e3efa;hp=8aeede66bb5a368355960f59ddc932b003aa9c59;hpb=772d9a39dd0e3e139ab975d7d45d1262f5471164;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index 8aeede6..5782e89 100644 --- a/client/client.c +++ b/client/client.c @@ -3,7 +3,24 @@ * See the file LICENSE for details. * * $Log: client.c,v $ - * Revision 1.119 2001-04-05 13:08:48 adam + * Revision 1.122 2001-05-16 07:27:29 adam + * Reference id set for InitRequest. + * + * Revision 1.121 2001/04/22 12:26:17 ja7 + * if Compiled with Command line history a open command is pushed into + * the command history if yaz-client is startet with a server on the + * command line. eg + * yaz-clinet tcp:server:port/database + * hash the commend + * open tcp:server:port/database + * in the command history on startup + * + * Added the refid set with setrefid to the update APDU + * + * Revision 1.120 2001/04/06 12:26:46 adam + * Optional CCL module. Moved atoi_n to marcdisp.h from yaz-util.h. + * + * Revision 1.119 2001/04/05 13:08:48 adam * New configure options: --enable-module. * * Revision 1.118 2001/03/27 14:48:06 adam @@ -408,7 +425,7 @@ #include #endif -#if CCL2RPN +#if YAZ_MODULE_ccl #include #endif @@ -445,7 +462,7 @@ static Z_InitResponse *session = 0; /* session parameters */ static char last_scan_line[512] = "0"; static char last_scan_query[512] = "0"; static char ccl_fields[512] = "default.bib"; -char* esPackageName = 0; +static char* esPackageName = 0; static char last_cmd[100] = "?"; static FILE *marcdump = 0; @@ -459,7 +476,7 @@ typedef enum { static QueryType queryType = QueryType_Prefix; -#if CCL2RPN +#if YAZ_MODULE_ccl static CCL_bibset bibset; /* CCL bibset handle */ #endif @@ -538,6 +555,8 @@ static void send_initRequest() req->idAuthentication = auth; + req->referenceId = set_refid (out); + send_apdu(apdu); printf("Sent initrequest.\n"); } @@ -1022,7 +1041,7 @@ static int send_searchRequest(char *arg) Z_SearchRequest *req = apdu->u.searchRequest; Z_Query query; int oid[OID_SIZE]; -#if CCL2RPN +#if YAZ_MODULE_ccl struct ccl_rpn_node *rpn = NULL; int error, pos; #endif @@ -1030,7 +1049,7 @@ static int send_searchRequest(char *arg) Z_RPNQuery *RPNquery; Odr_oct ccl_query; -#if CCL2RPN +#if YAZ_MODULE_ccl if (queryType == QueryType_CCL2RPN) { rpn = ccl_find_str(bibset, arg, &error, &pos); @@ -1098,7 +1117,7 @@ static int send_searchRequest(char *arg) ccl_query.buf = (unsigned char*) arg; ccl_query.len = strlen(arg); break; -#if CCL2RPN +#if YAZ_MODULE_ccl case QueryType_CCL2RPN: query.which = Z_Query_type_1; RPNquery = ccl_rpn_query(out, rpn); @@ -1502,6 +1521,17 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno) r->u.itemOrder->u.esRequest->notToKeep->itemRequest = create_external_ILL_APDU(ILL_APDU_ILL_Request); } + else if (!strcmp(type, "xml") || !strcmp(type, "3")) + { + const char *xml_buf = + "\n" + " request\n" + " 000200\n" + " 1212 \n" + ""; + r->u.itemOrder->u.esRequest->notToKeep->itemRequest = + z_ext_record (out, VAL_TEXT_XML, xml_buf, strlen(xml_buf)); + } else r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0; @@ -1549,6 +1579,8 @@ static int cmd_update(char *arg) oid_ent_to_oid (&update_oid, oid); req->packageType = odr_oiddup(out,oid); req->packageName = esPackageName; + + req->referenceId = set_refid (out); r = req->taskSpecificParameters = (Z_External *) odr_malloc (out, sizeof(*r)); @@ -1864,9 +1896,9 @@ int send_scanrequest(const char *query, int pp, int num, const char *term) Z_APDU *apdu = zget_APDU(out, Z_APDU_scanRequest); Z_ScanRequest *req = apdu->u.scanRequest; int use_rpn = 1; +#if YAZ_MODULE_ccl int oid[OID_SIZE]; -#if CCL2RPN if (queryType == QueryType_CCL2RPN) { oident bib1; @@ -2288,7 +2320,7 @@ int cmd_querytype (char *arg) queryType = QueryType_CCL; else if (!strcmp (arg, "prefix") || !strcmp(arg, "rpn")) queryType = QueryType_Prefix; -#if CCL2RPN +#if YAZ_MODULE_ccl else if (!strcmp (arg, "ccl2rpn") || !strcmp (arg, "cclrpn")) queryType = QueryType_CCL2RPN; #endif @@ -2297,7 +2329,7 @@ int cmd_querytype (char *arg) printf ("Querytype must be one of:\n"); printf (" prefix - Prefix query\n"); printf (" ccl - CCL query\n"); -#if CCL2RPN +#if YAZ_MODULE_ccl printf (" ccl2rpn - CCL query converted to RPN\n"); #endif return 0; @@ -2346,7 +2378,7 @@ int cmd_packagename(char* arg) { static void initialize(void) { -#if CCL2RPN +#if YAZ_MODULE_ccl FILE *inf; #endif nmem_init(); @@ -2361,7 +2393,7 @@ static void initialize(void) if (apdu_file) odr_setprint(print, apdu_file); -#if CCL2RPN +#if YAZ_MODULE_ccl bibset = ccl_qual_mk (); inf = fopen (ccl_fields, "r"); if (inf) @@ -2621,8 +2653,17 @@ int main(int argc, char **argv) if (!opened) { initialize (); - if (cmd_open (arg) == 2) - opened = 1; + if (cmd_open (arg) == 2) { +#if HAVE_READLINE_HISTORY_H + char* tmp=(char*)malloc(strlen(arg)+6); + *tmp=0; + strcat(tmp,"open "); + strcat(tmp,arg); + add_history(tmp); + free(tmp); +#endif + opened = 1; + }; } break; case 'm':