X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fyaz-illclient.c;h=b00a84a4413da301000cc2e8d53fab4b361e0b73;hb=d65313c102154dc9f28a8b4dbbbee0278c2bd1cc;hp=b65c9e66cdfc9c6f84e5f137a8ec08f34e03ba09;hpb=3576736bac485d8f04b2fc4f6b5cfcef7576d741;p=yaz-moved-to-github.git diff --git a/util/yaz-illclient.c b/util/yaz-illclient.c index b65c9e6..b00a84a 100644 --- a/util/yaz-illclient.c +++ b/util/yaz-illclient.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2006, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * - * $Id: yaz-illclient.c,v 1.9 2007-11-30 11:44:47 adam Exp $ */ /* WARNING - This is work in progress - not at all ready */ @@ -184,7 +182,7 @@ void parseargs( int argc, char * argv[], struct prog_args *args) { int ret; char *arg; char *prog=*argv; - const char *version="$Id: yaz-illclient.c,v 1.9 2007-11-30 11:44:47 adam Exp $"; /* from cvs */ + char version[60]; struct nameval *nv; /* default values */ @@ -224,7 +222,8 @@ void parseargs( int argc, char * argv[], struct prog_args *args) { yaz_log_init_file(arg); break; case 'V': - printf("%s %s",prog, version ); + yaz_version(version, 0); + printf("%s %s\n",prog, version); break; case 'D': nv=parse_nameval(arg); @@ -504,8 +503,17 @@ void sendrequest(ILL_APDU *apdu, ODR odr, COMSTACK stack ) { } if (1) { FILE *F = fopen("req.apdu","w"); - fwrite ( buf_out, 1, len_out, F); - fclose(F); + if (!F) + { + yaz_log(YLOG_FATAL|YLOG_ERRNO, "open req.apdu failed"); + } + else + { + if (fwrite ( buf_out, 1, len_out, F) != len_out) + yaz_log(YLOG_FATAL|YLOG_ERRNO, "write req.apdu failed"); + if (fclose(F)) + yaz_log(YLOG_FATAL|YLOG_ERRNO, "write req.apdu failed"); + } } } /* sendrequest */