X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=15dcd4d67bd8beb3540e897cff8e2053109b8b13;hb=472125ab093c3d31a28bbda92899bf8425679542;hp=a8338359649462701cbd1184b30c973fceecbcf6;hpb=6607d0bd04b26591614a84a9aa9bad7e7b00e7e9;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index a833835..15dcd4d 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.202 2003-07-14 12:59:23 adam Exp $ + * $Id: client.c,v 1.206 2003-07-30 22:33:12 adam Exp $ */ #include @@ -332,18 +332,22 @@ static int process_initResponse(Z_InitResponse *res) printf("Version: %s\n", res->implementationVersion); if (res->userInformationField) { + Z_External *uif = res->userInformationField; printf("UserInformationfield:\n"); - if (!z_External(print, (Z_External**)&res-> userInformationField, - 0, 0)) + if (!z_External(print, (Z_External**)&uif, 0, 0)) { odr_perror(print, "Printing userinfo\n"); odr_reset(print); } - if (res->userInformationField->which == Z_External_octet) + if (uif->which == Z_External_octet) { printf("Guessing visiblestring:\n"); - printf("'%s'\n", res->userInformationField->u. octet_aligned->buf); - } + printf("'%s'\n", uif->u. octet_aligned->buf); + } else if (uif->which == Z_External_single) { + /* Peek at any private Init-diagnostic APDUs */ + Odr_any *sat = uif->u.single_ASN1_type; + printf("### NAUGHTY: External is '%s'\n", sat->buf); + } odr_reset (print); } printf ("Options:"); @@ -400,6 +404,15 @@ static int process_initResponse(Z_InitResponse *res) yaz_get_response_charneg(session_mem, p, &charset, &lang, &selected); + + if (outputCharset && negotiationCharset) { + odr_set_charset (out, charset, outputCharset); + odr_set_charset (in, outputCharset, charset); + } + else { + odr_set_charset (out, 0, 0); + odr_set_charset (in, 0, 0); + } printf("Accepted character set : %s\n", charset); printf("Accepted code language : %s\n", lang ? lang : "none"); @@ -580,14 +593,20 @@ int cmd_authentication(const char *arg) r = sscanf (arg, "%39s %39s %39s", user, group, pass); if (r == 0) { - printf("Auth field set to null\n"); + printf("Authentication set to null\n"); auth = 0; } if (r == 1) { auth = &au; - au.which = Z_IdAuthentication_open; - au.u.open = user; + if (!strcmp(user, "-")) { + au.which = Z_IdAuthentication_anonymous; + printf("Authentication set to Anonymous\n"); + } else { + au.which = Z_IdAuthentication_open; + au.u.open = user; + printf("Authentication set to Open (%s)\n", user); + } } if (r == 2) { @@ -597,6 +616,7 @@ int cmd_authentication(const char *arg) idPass.groupId = NULL; idPass.userId = user; idPass.password = group; + printf("Authentication set to User (%s), Pass (%s)\n", user, group); } if (r == 3) { @@ -606,6 +626,8 @@ int cmd_authentication(const char *arg) idPass.groupId = group; idPass.userId = user; idPass.password = pass; + printf("Authentication set to User (%s), Group (%s), Pass (%s)\n", + user, group, pass); } return 1; } @@ -2749,16 +2771,7 @@ int cmd_charset(const char* arg) else printf ("Output charset conversion disabled\n"); } - if (outputCharset && negotiationCharset) - { - odr_set_charset (out, negotiationCharset, outputCharset); - odr_set_charset (in, outputCharset, negotiationCharset); - } - else - { - odr_set_charset (out, 0, 0); - odr_set_charset (in, 0, 0); - } + return 1; }