* Copyright (c) 1995-2002, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.152 2002-05-18 09:52:37 oleg Exp $
+ * $Id: client.c,v 1.157 2002-06-04 11:36:10 adam Exp $
*/
#include <stdio.h>
#include <yaz/pquery.h>
#include <yaz/sortspec.h>
-#if YAZ_MODULE_ill
#include <yaz/ill.h>
-#endif
-#if YAZ_MODULE_ccl
#include <yaz/yaz-ccl.h>
-#endif
#if HAVE_READLINE_READLINE_H
#include <readline/readline.h>
static QueryType queryType = QueryType_Prefix;
-#if YAZ_MODULE_ccl
static CCL_bibset bibset; /* CCL bibset handle */
-#endif
#if HAVE_READLINE_COMPLETION_OVER
p0->which = Z_OtherInfo_externallyDefinedInfo;
p0->information.externallyDefinedInfo =
- yaz_set_charset_and_lang(out, CLASS_NEGOT, VAL_CHARNEG3,
+ yaz_set_proposal_charneg(out,
(const char**)&yazCharset, (yazCharset)?1:0,
- (const char**)&yazLang, (yazLang)?1:0);
+ (const char**)&yazLang, (yazLang)?1:0, 1);
}
}
if (ODR_MASK_GET(res->options, Z_Options_queryType104))
printf (" queryType104");
printf ("\n");
+
+ if (ODR_MASK_GET(res->options, Z_Options_negotiationModel)) {
+
+ Z_CharSetandLanguageNegotiation *p =
+ yaz_get_charneg_record(res->otherInfo);
+
+ if (p) {
+
+ char *charset=NULL, *lang=NULL;
+ int selected;
+
+ yaz_get_response_charneg(session_mem, p, &charset, &lang, &selected);
+
+ printf("Accepted character set : `%s'\n", charset);
+ printf("Accepted code language : `%s'\n", lang);
+ printf("Accepted records in ...: %d\n", selected );
+ }
+ }
fflush (stdout);
return 0;
}
session_mem = NULL;
}
}
- t = tcpip_type;
- base[0] = '\0';
- if (sscanf (arg, "%100[^/]/%100s", type_and_host, base) < 1)
- return 0;
-
- if(yazProxy)
- conn = cs_create_host(yazProxy, 1, &add);
- else
- conn = cs_create_host(type_and_host, 1, &add);
-
+ if (strncmp (arg, "unix:", 5) == 0)
+ {
+ base[0] = '\0';
+ conn = cs_create_host(arg, 1, &add);
+ }
+ else
+ {
+ t = tcpip_type;
+ base[0] = '\0';
+ if (sscanf (arg, "%100[^/]/%100s", type_and_host, base) < 1)
+ return 0;
+
+ if(yazProxy)
+ conn = cs_create_host(yazProxy, 1, &add);
+ else
+ conn = cs_create_host(type_and_host, 1, &add);
+
+ }
if (!conn)
{
printf ("Couldn't create comstack\n");
}
/* SEARCH SERVICE ------------------------------ */
+static void display_record(Z_External *r);
static void display_variant(Z_Variant *v, int level)
{
int i;
if (!r)
+ {
return;
+ }
for (i = 0; i < r->num_elements; i++)
{
Z_TaggedElement *t;
printf("%s) ", t->tagValue->u.string);
if (t->content->which == Z_ElementData_subtree)
{
- printf("\n");
- display_grs1(t->content->u.subtree, level+1);
+ if (!t->content->u.subtree)
+ printf (" (no subtree)\n");
+ else
+ {
+ printf("\n");
+ display_grs1(t->content->u.subtree, level+1);
+ }
}
else if (t->content->which == Z_ElementData_string)
printf("%s\n", t->content->u.string);
printf("[Element empty]\n");
else if (t->content->which == Z_ElementData_elementNotThere)
printf("[Element not there]\n");
+ else if (t->content->which == Z_ElementData_date)
+ printf("Date: %s\n", t->content->u.date);
+ else if (t->content->which == Z_ElementData_ext)
+ {
+ printf ("External\n");
+ display_record (t->content->u.ext);
+ }
else
- printf("??????\n");
+ printf("? type = %d\n",t->content->which);
if (t->appliedVariant)
display_variant(t->appliedVariant, level+1);
if (t->metaData && t->metaData->supportedVariants)
r->which = type->what;
}
}
+ if (ent && ent->oclass != CLASS_RECSYN)
+ return;
if (ent && ent->value == VAL_SOIF)
print_record((const unsigned char *) r->u.octet_aligned->buf,
r->u.octet_aligned->len);
Z_SearchRequest *req = apdu->u.searchRequest;
Z_Query query;
int oid[OID_SIZE];
-#if YAZ_MODULE_ccl
struct ccl_rpn_node *rpn = NULL;
int error, pos;
-#endif
char setstring[100];
Z_RPNQuery *RPNquery;
Odr_oct ccl_query;
-#if YAZ_MODULE_ccl
if (queryType == QueryType_CCL2RPN)
{
rpn = ccl_find_str(bibset, arg, &error, &pos);
return 0;
}
}
-#endif
req->referenceId = set_refid (out);
if (!strcmp(arg, "@big")) /* strictly for troublemaking */
{
ccl_query.buf = (unsigned char*) arg;
ccl_query.len = strlen(arg);
break;
-#if YAZ_MODULE_ccl
case QueryType_CCL2RPN:
query.which = Z_Query_type_1;
RPNquery = ccl_rpn_query(out, rpn);
query.u.type_1 = RPNquery;
ccl_rpn_delete (rpn);
break;
-#endif
default:
printf ("Unsupported query type\n");
return 0;
}
}
-#if YAZ_MODULE_ill
-
const char *get_ill_element (void *clientData, const char *element)
{
return 0;
}
return r;
}
-#endif
-#ifdef YAZ_MODULE_ill
static Z_External *create_external_ILL_APDU(int which)
{
struct ill_get_ctl ctl;
}
return r;
}
-#endif
static Z_External *create_ItemOrderExternal(const char *type, int itemno)