* See the file LICENSE for details.
*
* $Log: client.c,v $
- * Revision 1.113 2001-02-21 09:41:15 adam
+ * Revision 1.118 2001-03-27 14:48:06 adam
+ * Fixed scan for bad CCL.
+ *
+ * Revision 1.117 2001/03/25 21:55:12 adam
+ * Added odr_intdup. Ztest server returns TaskPackage for ItemUpdate.
+ *
+ * Revision 1.116 2001/03/21 12:43:36 adam
+ * Implemented cs_create_host. Better error reporting for SSL comstack.
+ *
+ * Revision 1.115 2001/03/13 18:10:58 adam
+ * Added option -c to set CCL config file.
+ *
+ * Revision 1.114 2001/02/21 13:46:53 adam
+ * C++ fixes.
+ *
+ * Revision 1.113 2001/02/21 09:41:15 adam
* Fixed problem with old codecs.
*
* Revision 1.112 2001/02/20 11:25:32 adam
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 last_cmd[100] = "?";
{
void *add;
char type_and_host[101], base[101];
- char *host = 0;
CS_TYPE t;
if (conn)
base[0] = '\0';
if (sscanf (arg, "%100[^/]/%100s", type_and_host, base) < 1)
return 0;
- if (strncmp (type_and_host, "tcp:", 4) == 0)
- host = type_and_host + 4;
- else if (strncmp (type_and_host, "ssl:", 4) == 0)
- {
-#if HAVE_OPENSSL_SSL_H
- t = ssl_type;
-#else
- printf ("SSL not supported\n");
-#endif
- host = type_and_host + 4;
- }
- else
- host = type_and_host;
- if (*base)
- cmd_base (base);
- protocol = PROTO_Z3950;
- if (!(conn = cs_create(t, 1, protocol)))
- {
- perror("cs_create");
- return 0;
- }
- if (!(add = cs_straddr(conn, host)))
+ conn = cs_create_host(type_and_host, 1, &add);
+ if (!conn)
{
- perror(arg);
- return 0;
+ printf ("Couldn't create comstack\n");
+ return 0;
}
printf("Connecting...");
fflush(stdout);
if (cs_connect(conn, add) < 0)
{
- perror("connect");
+ printf ("error = %s\n", cs_strerror(conn));
+ if (conn->cerrno == CSYSERR)
+ perror("system");
cs_close(conn);
conn = 0;
return 0;
}
printf("Ok.\n");
send_initRequest();
+ if (*base)
+ cmd_base (base);
return 2;
}
r->u.single_ASN1_type = (Odr_oct *)
odr_malloc (out, sizeof(*r->u.single_ASN1_type));
- r->u.single_ASN1_type->buf = odr_malloc (out, item_request_size);
+ r->u.single_ASN1_type->buf = (unsigned char *)
+ odr_malloc (out, item_request_size);
r->u.single_ASN1_type->len = item_request_size;
r->u.single_ASN1_type->size = item_request_size;
memcpy (r->u.single_ASN1_type->buf, item_request_buf,
r->u.single_ASN1_type = (Odr_oct *)
odr_malloc (out, sizeof(*r->u.single_ASN1_type));
- r->u.single_ASN1_type->buf = odr_malloc (out, ill_request_size);
+ r->u.single_ASN1_type->buf = (unsigned char *)
+ odr_malloc (out, ill_request_size);
r->u.single_ASN1_type->len = ill_request_size;
r->u.single_ASN1_type->size = ill_request_size;
memcpy (r->u.single_ASN1_type->buf, ill_request_buf, ill_request_size);
static int send_itemorder(const char *type, int itemno)
{
- Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest );
+ Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest);
Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest;
oident ItemOrderRequest;
if (error)
{
printf("CCL ERROR: %s\n", ccl_err_msg(error));
- return 0;
+ return -1;
}
use_rpn = 0;
bib1.proto = PROTO_Z3950;
if (!(req->termListAndStartPoint = ccl_scan_query (out, rpn)))
{
printf("Couldn't convert CCL to Scan term\n");
- return 0;
+ return -1;
}
ccl_rpn_delete (rpn);
}
req->termListAndStartPoint->term->u.general)
{
req->termListAndStartPoint->term->u.general->buf =
- odr_strdup(out, term);
+ (unsigned char *) odr_strdup(out, term);
req->termListAndStartPoint->term->u.general->len =
req->termListAndStartPoint->term->u.general->size =
strlen(term);
#if CCL2RPN
bibset = ccl_qual_mk ();
- inf = fopen ("default.bib", "r");
+ inf = fopen (ccl_fields, "r");
if (inf)
{
ccl_qual_file (bibset, inf);
int ret;
int opened = 0;
- while ((ret = options("a:m:v:", argv, argc, &arg)) != -2)
+ while ((ret = options("c:a:m:v:", argv, argc, &arg)) != -2)
{
switch (ret)
{
exit (1);
}
break;
+ case 'c':
+ strncpy (ccl_fields, arg, sizeof(ccl_fields)-1);
+ ccl_fields[sizeof(ccl_fields)-1] = '\0';
+ break;
case 'a':
if (!strcmp(arg, "-"))
apdu_file=stderr;
break;
default:
fprintf (stderr, "Usage: %s [-m <marclog>] [ -a <apdulog>] "
- "[<server-addr>]\n",
+ "[-c cclfields] [<server-addr>]\n",
prog);
exit (1);
}