X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fyaz-illclient.c;h=cdaf4167399c85ec9a0f1b36c0d6478561da1a32;hb=4320117d5dfc1cca841025c4ceb086c92c206524;hp=791cf5616be72da9ed95ce5ef0391d9a7baa1a25;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0;p=yaz-moved-to-github.git diff --git a/util/yaz-illclient.c b/util/yaz-illclient.c index 791cf56..cdaf416 100644 --- a/util/yaz-illclient.c +++ b/util/yaz-illclient.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2009 Index Data * See the file LICENSE for details. */ @@ -182,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 */ @@ -222,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); @@ -502,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 */ @@ -687,6 +697,7 @@ int main (int argc, char * argv[]) { /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab