X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=a79c51c0480aa892e92dcb34d3ee8be171de2bfa;hb=d35622cea47fdf58f47d31023e28e49eaf1ecb47;hp=b46b330254ccef232aacc11771a345156b252140;hpb=20554c224bb8e4dfec150889ebd91c6494fb92ce;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index b46b330..a79c51c 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.259 2004-12-09 07:53:21 adam Exp $ + * $Id: client.c,v 1.264 2005-01-02 20:31:39 adam Exp $ */ #include @@ -32,6 +32,8 @@ #include #define S_ISREG(x) (x & _S_IFREG) #define S_ISDIR(x) (x & _S_IFDIR) +#else +#include #endif #include @@ -51,11 +53,10 @@ #include #include #include -#include +#include #if HAVE_READLINE_READLINE_H #include -#include #endif #if HAVE_READLINE_HISTORY_H #include @@ -104,6 +105,8 @@ static char *esPackageName = 0; static char *yazProxy = 0; static int kilobytes = 1024; static char *negotiationCharset = 0; +static int negotiationCharsetRecords = 1; +static int negotiationCharsetVersion = 3; static char *outputCharset = 0; static char *marcCharset = 0; static char* yazLang = 0; @@ -327,7 +330,8 @@ static void send_initRequest(const char* type_and_host) out, (const char**)&negotiationCharset, negotiationCharset ? 1 : 0, - (const char**)&yazLang, yazLang ? 1 : 0, 1); + (const char**)&yazLang, yazLang ? 1 : 0, + negotiationCharsetRecords); } } @@ -2987,7 +2991,11 @@ int cmd_marccharset(const char *arg) *l1 = 0; if (sscanf(arg, "%29s", l1) < 1) + { + printf("MARC character set is `%s'\n", + marcCharset ? marcCharset: "none"); return 1; + } xfree (marcCharset); marcCharset = 0; if (strcmp(l1, "-")) @@ -3021,8 +3029,6 @@ int cmd_displaycharset(const char *arg) } else if (strcmp(l1, "-") && strcmp(l1, "none")) outputCharset = xstrdup(l1); - else - printf ("Display character set conversion disabled\n"); } return 1; } @@ -3032,39 +3038,46 @@ int cmd_negcharset(const char *arg) char l1[30]; *l1 = 0; - if (sscanf(arg, "%29s", l1) < 1) + if (sscanf(arg, "%29s %d %d", l1, &negotiationCharsetRecords, + &negotiationCharsetVersion) < 1) { printf("Current negotiation character set is `%s'\n", - negotiationCharset ? negotiationCharset: "none"); - return 1; + negotiationCharset ? negotiationCharset: "none"); + printf("Records in charset %s\n", negotiationCharsetRecords ? + "yes" : "no"); + printf("Charneg version %d\n", negotiationCharsetVersion); } - xfree (negotiationCharset); - negotiationCharset = NULL; - if (*l1 && strcmp(l1, "-") && strcmp(l1, "none")) + else { - negotiationCharset = xstrdup(l1); - printf ("Character set negotiation : %s\n", negotiationCharset); + xfree (negotiationCharset); + negotiationCharset = NULL; + if (*l1 && strcmp(l1, "-") && strcmp(l1, "none")) + { + negotiationCharset = xstrdup(l1); + printf ("Character set negotiation : %s\n", negotiationCharset); + } } - else - printf ("Character set negotiation disabled\n"); return 1; } int cmd_charset(const char* arg) { - char l1[30], l2[30]; + char l1[30], l2[30], l3[30]; - *l1 = *l2 = 0; - if (sscanf(arg, "%29s %29s", l1, l2) < 1) + *l1 = *l2 = *l3 = 0; + if (sscanf(arg, "%29s %29s %29s", l1, l2, l3) < 1) { cmd_negcharset(""); cmd_displaycharset(""); + cmd_marccharset(""); } else { cmd_negcharset(l1); if (*l2) cmd_displaycharset(l2); + if (*l3) + cmd_marccharset(l3); } return 1; }