projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make an MARC conversion trie for each characterSet section rather than
[yaz-moved-to-github.git]
/
client
/
client.c
diff --git
a/client/client.c
b/client/client.c
index
261ff70
..
59c48a0
100644
(file)
--- a/
client/client.c
+++ b/
client/client.c
@@
-2,7
+2,7
@@
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.346 2007-07-04 09:20:06 adam Exp $
+ * $Id: client.c,v 1.351 2007-08-24 13:25:14 adam Exp $
*/
/** \file client.c
* \brief yaz-client program
*/
/** \file client.c
* \brief yaz-client program
@@
-56,7
+56,6
@@
#include <yaz/comstack.h>
#include <yaz/comstack.h>
-#include <yaz/tcpip.h>
#include <yaz/oid_db.h>
#define NO_OID 1
#include <yaz/proto.h>
#include <yaz/oid_db.h>
#define NO_OID 1
#include <yaz/proto.h>
@@
-91,7
+90,8
@@
static file_history_t file_history = 0;
static file_history_t file_history = 0;
-static char *sru_method = "soap";
+static char sru_method[10] = "soap";
+static char sru_version[10] = "1.2";
static char *codeset = 0; /* character set for output */
static int hex_dump = 0;
static char *dump_file_prefix = 0;
static char *codeset = 0; /* character set for output */
static int hex_dump = 0;
static char *dump_file_prefix = 0;
@@
-172,9
+172,6
@@
static cql_transform_t cqltrans = 0; /* CQL context-set handle */
int rl_attempted_completion_over = 0;
#endif
int rl_attempted_completion_over = 0;
#endif
-/* set this one to 1, to avoid decode of unknown MARCs */
-#define AVOID_MARC_DECODE 1
-
#define maxOtherInfosSupported 10
struct eoi {
Odr_oid oid[OID_SIZE];
#define maxOtherInfosSupported 10
struct eoi {
Odr_oid oid[OID_SIZE];
@@
-718,21
+715,11
@@
int session_connect(const char *arg)
conn = cs_create_host(yazProxy, 1, &add);
else
conn = cs_create_host(arg, 1, &add);
conn = cs_create_host(yazProxy, 1, &add);
else
conn = cs_create_host(arg, 1, &add);
-
if (!conn)
{
printf ("Could not resolve address %s\n", arg);
return 0;
}
if (!conn)
{
printf ("Could not resolve address %s\n", arg);
return 0;
}
- if (1)
- {
- COMSTACK tmp_cs = cs_create (tcpip_type, 0, PROTO_Z3950);
-
- void *addr = cs_straddr(tmp_cs, arg);
- printf ("cs_straddr of %s %s\n", arg, addr ? "OK" : "Failed");
-
- cs_close(tmp_cs);
- }
#if YAZ_HAVE_XML2
if (conn->protocol == PROTO_HTTP)
queryType = QueryType_CQL;
#if YAZ_HAVE_XML2
if (conn->protocol == PROTO_HTTP)
queryType = QueryType_CQL;
@@
-1287,15
+1274,15
@@
static int send_srw(Z_SRW_PDU *sr)
gdu = z_get_HTTP_Request_host_path(out, host_port, path);
gdu = z_get_HTTP_Request_host_path(out, host_port, path);
- if (!strcmp(sru_method, "get"))
+ if (!yaz_matchstr(sru_method, "get"))
{
yaz_sru_get_encode(gdu->u.HTTP_Request, sr, out, charset);
}
{
yaz_sru_get_encode(gdu->u.HTTP_Request, sr, out, charset);
}
- else if (!strcmp(sru_method, "post"))
+ else if (!yaz_matchstr(sru_method, "post"))
{
yaz_sru_post_encode(gdu->u.HTTP_Request, sr, out, charset);
}
{
yaz_sru_post_encode(gdu->u.HTTP_Request, sr, out, charset);
}
- else if (!strcmp(sru_method, "soap"))
+ else if (!yaz_matchstr(sru_method, "soap"))
{
yaz_sru_soap_encode(gdu->u.HTTP_Request, sr, out, charset);
}
{
yaz_sru_soap_encode(gdu->u.HTTP_Request, sr, out, charset);
}
@@
-1358,7
+1345,7
@@
static int send_SRW_scanRequest(const char *arg, int pos, int num)
Z_SRW_PDU *sr = 0;
/* regular requestse .. */
Z_SRW_PDU *sr = 0;
/* regular requestse .. */
- sr = yaz_srw_get(out, Z_SRW_scan_request);
+ sr = yaz_srw_get_pdu(out, Z_SRW_scan_request, sru_version);
switch(queryType)
{
switch(queryType)
{
@@
-1393,10
+1380,11
@@
static int send_SRW_searchRequest(const char *arg)
setno = 1;
/* save this for later .. when fetching individual records */
setno = 1;
/* save this for later .. when fetching individual records */
- srw_sr = yaz_srw_get(srw_sr_odr_out, Z_SRW_searchRetrieve_request);
+ srw_sr = yaz_srw_get_pdu(srw_sr_odr_out, Z_SRW_searchRetrieve_request,
+ sru_version);
/* regular request .. */
/* regular request .. */
- sr = yaz_srw_get(out, Z_SRW_searchRetrieve_request);
+ sr = yaz_srw_get_pdu(out, Z_SRW_searchRetrieve_request, sru_version);
switch(queryType)
{
switch(queryType)
{
@@
-1929,6
+1917,20
@@
void process_ESResponse(Z_ExtendedServicesResponse *res)
}
}
}
}
}
}
+ if (ext->which == Z_External_itemOrder)
+ {
+ Z_IOTaskPackage *otp = ext->u.itemOrder->u.taskPackage;
+ if (otp && otp->targetPart && otp->targetPart->itemRequest)
+ {
+ Z_External *ext = otp->targetPart->itemRequest;
+ if (ext->which == Z_External_octet)
+ {
+ Odr_oct *doc = ext->u.octet_aligned;
+ printf("Got itemRequest doc %.*s\n",
+ doc->len, doc->buf);
+ }
+ }
+ }
}
if (res->taskPackage && res->taskPackage->which == Z_External_octet)
{
}
if (res->taskPackage && res->taskPackage->which == Z_External_octet)
{
@@
-2519,19
+2521,26
@@
static int cmd_sru(const char *arg)
if (!*arg)
{
printf("SRU method is: %s\n", sru_method);
if (!*arg)
{
printf("SRU method is: %s\n", sru_method);
+ printf("SRU version is: %s\n", sru_version);
}
else
{
}
else
{
- if (!yaz_matchstr(arg, "post"))
- sru_method = "post";
- else if (!yaz_matchstr(arg, "get"))
- sru_method = "get";
- else if (!yaz_matchstr(arg, "soap"))
- sru_method = "soap";
- else
+ int r;
+ r = sscanf(arg, "%9s %9s", sru_method, sru_version);
+ if (r >= 1)
{
{
- printf("Unknown SRU method: %s\n", arg);
- printf("Specify one of POST, GET, SOAP\n");
+ if (!yaz_matchstr(sru_method, "post"))
+ ;
+ else if (!yaz_matchstr(sru_method, "get"))
+ ;
+ else if (!yaz_matchstr(sru_method, "soap"))
+ ;
+ else
+ {
+ strcpy(sru_method, "soap");
+ printf("Unknown SRU method: %s\n", arg);
+ printf("Specify one of POST, GET, SOAP\n");
+ }
}
}
return 0;
}
}
return 0;
@@
-3032,13
+3041,13
@@
void display_term(Z_TermInfo *t)
if (t->displayTerm)
printf("%s", t->displayTerm);
else if (t->term->which == Z_Term_general)
if (t->displayTerm)
printf("%s", t->displayTerm);
else if (t->term->which == Z_Term_general)
- {
printf("%.*s", t->term->u.general->len, t->term->u.general->buf);
printf("%.*s", t->term->u.general->len, t->term->u.general->buf);
- sprintf(last_scan_line, "%.*s", t->term->u.general->len,
- t->term->u.general->buf);
- }
else
printf("Term (not general)");
else
printf("Term (not general)");
+ if (t->term->which == Z_Term_general)
+ sprintf(last_scan_line, "%.*s", t->term->u.general->len,
+ t->term->u.general->buf);
+
if (t->globalOccurrences)
printf (" (%d)\n", *t->globalOccurrences);
else
if (t->globalOccurrences)
printf (" (%d)\n", *t->globalOccurrences);
else
@@
-4530,7
+4539,7
@@
static struct {
{"zversion", cmd_zversion, "", NULL, 0, NULL},
{"help", cmd_help, "", NULL,0,NULL},
{"init", cmd_init, "", NULL,0,NULL},
{"zversion", cmd_zversion, "", NULL, 0, NULL},
{"help", cmd_help, "", NULL,0,NULL},
{"init", cmd_init, "", NULL,0,NULL},
- {"sru", cmd_sru, "", NULL,0,NULL},
+ {"sru", cmd_sru, "<method> <version>", NULL,0,NULL},
{"exit", cmd_quit, "",NULL,0,NULL},
{0,0,0,0,0,0}
};
{"exit", cmd_quit, "",NULL,0,NULL},
{0,0,0,0,0,0}
};