X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=602dde830c226def1e01d04b30aa8b08d89835cd;hb=d2fc23a41ae7eb6bd5f6e76a45530ede776bd018;hp=8abd5a282a39801ece38ff6154caab835f09e79c;hpb=92a1c29ad9003d7dad229fd5170ed83269c87658;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index 8abd5a2..602dde8 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.269 2005-01-16 22:12:39 adam Exp $ + * $Id: client.c,v 1.272 2005-01-27 09:05:09 adam Exp $ */ #include @@ -10,6 +10,9 @@ #include #include #include +#if HAVE_SYS_TYPES_H +#include +#endif #if HAVE_LOCALE_H #include #endif @@ -22,6 +25,9 @@ #if HAVE_SYS_STAT_H #include #endif +#if HAVE_SYS_TIME_H +#include +#endif #if HAVE_OPENSSL_SSL_H #include @@ -33,6 +39,7 @@ #endif #ifdef WIN32 +#include #include #include #define S_ISREG(x) (x & _S_IFREG) @@ -379,14 +386,18 @@ static int process_initResponse(Z_InitResponse *res) render_initUserInfo(uif->u.userInfo1); } else { printf("UserInformationfield:\n"); - if (!z_External(print, (Z_External**)&uif, 0, 0)) { + if (!z_External(print, (Z_External**)&uif, 0, 0)) + { odr_perror(print, "Printing userinfo\n"); odr_reset(print); } if (uif->which == Z_External_octet) { printf("Guessing visiblestring:\n"); - printf("'%s'\n", uif->u. octet_aligned->buf); - } else if (uif->which == Z_External_single) { + printf("'%.*s'\n", uif->u.octet_aligned->len, + uif->u.octet_aligned->buf); + } + else if (uif->which == Z_External_single) + { Odr_any *sat = uif->u.single_ASN1_type; oident *oid = oid_getentbyoid(uif->direct_reference); if (oid->value == VAL_OCLCUI) { @@ -404,7 +415,8 @@ static int process_initResponse(Z_InitResponse *res) else { /* Peek at any private Init-diagnostic APDUs */ - printf("### NAUGHTY: External is '%.*s'\n", sat->len, sat->buf); + printf("### NAUGHTY: External is '%.*s'\n", + sat->len, sat->buf); } } odr_reset (print); @@ -458,11 +470,20 @@ static void render_initUserInfo(Z_OtherInformation *ui1) { Z_OtherInformationUnit *unit = ui1->list[i]; printf(" %d: otherInfo unit contains ", i+1); if (unit->which == Z_OtherInfo_externallyDefinedInfo && + unit->information.externallyDefinedInfo && unit->information.externallyDefinedInfo->which == Z_External_diag1) { render_diag(unit->information.externallyDefinedInfo->u.diag1); - } else { - printf("unsupported otherInfo unit type %d\n", unit->which); + } + else if (unit->which != Z_OtherInfo_externallyDefinedInfo) + { + printf("unsupported otherInfo unit->which = %d\n", unit->which); + } + else + { + printf("unsupported otherInfo unit external %d\n", + unit->information.externallyDefinedInfo ? + unit->information.externallyDefinedInfo->which : -2); } } }