* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.341 2007-05-30 08:40:26 adam Exp $
+ * $Id: client.c,v 1.342 2007-05-30 21:56:59 adam Exp $
*/
/** \file client.c
* \brief yaz-client program
#endif
static char *command_generator(const char *text, int state);
int cmd_register_tab(const char* arg);
+int cmd_querycharset(const char *arg);
static void close_session (void);
negotiationCharsetRecords);
}
}
+ else if (ODR_MASK_GET(req->options, Z_Options_negotiationModel))
+ {
+ Z_OtherInformation **p;
+ Z_OtherInformationUnit *p0;
+
+ yaz_oi_APDU(apdu, &p);
+
+ if ((p0=yaz_oi_update(p, out, NULL, 0, 0)))
+ {
+ p0->which = Z_OtherInfo_externallyDefinedInfo;
+ p0->information.externallyDefinedInfo =
+ yaz_set_proposal_charneg(out, 0, 0, 0, 0, 0);
+ }
+
+ }
if (send_apdu(apdu))
printf("Sent initrequest.\n");
}
Z_CharSetandLanguageNegotiation *p =
yaz_get_charneg_record(res->otherInfo);
- if (p) {
-
+ 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 ? lang : "none");
+ printf("Accepted character set : %s\n", charset ? charset:"none");
+ printf("Accepted code language : %s\n", lang ? lang:"none");
printf("Accepted records in ...: %d\n", selected );
- if (outputCharset && negotiationCharset) {
+ if (outputCharset && charset)
+ {
printf("Converting between %s and %s\n",
- outputCharset, negotiationCharset);
- odr_set_charset (out, charset, outputCharset);
- odr_set_charset (in, outputCharset, charset);
+ outputCharset, charset);
+ odr_set_charset(out, charset, outputCharset);
+ odr_set_charset(in, outputCharset, charset);
+ cmd_querycharset(charset);
}
- else {
- odr_set_charset (out, 0, 0);
- odr_set_charset (in, 0, 0);
+ else
+ {
+ odr_set_charset(out, 0, 0);
+ odr_set_charset(in, 0, 0);
}
}
}
}
xfree (marcCharset);
marcCharset = 0;
- if (strcmp(l1, "-"))
+ if (strcmp(l1, "-") && strcmp(l1, "none"))
marcCharset = xstrdup(l1);
return 1;
}
}
xfree (queryCharset);
queryCharset = 0;
- if (strcmp(l1, "-"))
+ if (strcmp(l1, "-") && strcmp(l1, "none"))
queryCharset = xstrdup(l1);
return 1;
}
if (sscanf(arg, "%29s %d %d", l1, &negotiationCharsetRecords,
&negotiationCharsetVersion) < 1)
{
- printf("Current negotiation character set is `%s'\n",
+ printf("Negotiation character set `%s'\n",
negotiationCharset ? negotiationCharset: "none");
- printf("Records in charset %s\n", negotiationCharsetRecords ?
- "yes" : "no");
- printf("Charneg version %d\n", negotiationCharsetVersion);
+ if (negotiationCharset)
+ {
+ printf("Records in charset %s\n", negotiationCharsetRecords ?
+ "yes" : "no");
+ printf("Charneg version %d\n", negotiationCharsetVersion);
+ }
}
else
{
int cmd_charset(const char* arg)
{
- char l1[30], l2[30], l3[30];
+ char l1[30], l2[30], l3[30], l4[30];
- *l1 = *l2 = *l3 = 0;
- if (sscanf(arg, "%29s %29s %29s", l1, l2, l3) < 1)
+ *l1 = *l2 = *l3 = *l4 = '\0';
+ if (sscanf(arg, "%29s %29s %29s %29s", l1, l2, l3, l4) < 1)
{
cmd_negcharset("");
cmd_displaycharset("");
cmd_marccharset("");
+ cmd_querycharset("");
}
else
{
cmd_displaycharset(l2);
if (*l3)
cmd_marccharset(l3);
+ if (*l4)
+ cmd_querycharset(l4);
}
return 1;
}
int cmd_lang(const char* arg)
{
if (*arg == '\0') {
- printf("Current language is `%s'\n", (yazLang)?yazLang:NULL);
+ printf("Current language is `%s'\n", yazLang ? yazLang : "none");
return 1;
}
xfree (yazLang);
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.120 2007-05-30 08:12:17 adam Exp $
+ * $Id: seshigh.c,v 1.121 2007-05-30 21:56:59 adam Exp $
*/
/**
* \file seshigh.c
strcat(options, " sort");
}
- if (!assoc->init->charneg_response && !assoc->init->charneg_request)
+ if (ODR_MASK_GET(req->options, Z_Options_negotiationModel))
{
- if (assoc->init->query_charset)
+ Z_OtherInformationUnit *p0;
+
+ if (!assoc->init->charneg_response)
{
- assoc->init->charneg_response = yaz_set_response_charneg(
- assoc->encode, assoc->init->query_charset, 0,
- assoc->init->records_in_same_charset);
+ if (assoc->init->query_charset)
+ {
+ assoc->init->charneg_response = yaz_set_response_charneg(
+ assoc->encode, assoc->init->query_charset, 0,
+ assoc->init->records_in_same_charset);
+ }
+ else
+ {
+ yaz_log(YLOG_WARN, "default query_charset not defined by backend");
+ }
}
- else
+ if (assoc->init->charneg_response
+ && (p0=yaz_oi_update(&resp->otherInfo, assoc->encode, NULL, 0, 0)))
{
- yaz_log(YLOG_WARN, "default query_charset not defined by backend");
- }
- }
- if (assoc->init->charneg_response
- && ODR_MASK_GET(req->options, Z_Options_negotiationModel))
- {
- Z_OtherInformation **p;
- Z_OtherInformationUnit *p0;
-
- yaz_oi_APDU(apdu, &p);
-
- if ((p0=yaz_oi_update(p, assoc->encode, NULL, 0, 0))) {
- ODR_MASK_SET(resp->options, Z_Options_negotiationModel);
-
p0->which = Z_OtherInfo_externallyDefinedInfo;
p0->information.externallyDefinedInfo =
assoc->init->charneg_response;
+ ODR_MASK_SET(resp->options, Z_Options_negotiationModel);
+ strcat(options, " negotiation");
}
- ODR_MASK_SET(resp->options, Z_Options_negotiationModel);
- strcat(options, " negotiation");
}
if (ODR_MASK_GET(req->options, Z_Options_triggerResourceCtrl))
ODR_MASK_SET(resp->options, Z_Options_triggerResourceCtrl);
assoc->init->implementation_name,
odr_prepend(assoc->encode, "GFS", resp->implementationName));
- version = odr_strdup(assoc->encode, "$Revision: 1.120 $");
+ version = odr_strdup(assoc->encode, "$Revision: 1.121 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
resp->implementationVersion = odr_prepend(assoc->encode,