Expanded tabs in all source files. Added vim/emacs local variables
authorAdam Dickmeiss <adam@indexdata.dk>
Sat, 25 Jun 2005 15:46:01 +0000 (15:46 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Sat, 25 Jun 2005 15:46:01 +0000 (15:46 +0000)
trailer.

161 files changed:
client/admin.c
client/admin.h
client/bertorture.c
client/client.c
client/tabcomplete.c
client/tabcomplete.h
header.c
include/yaz/backend.h
include/yaz/ccl.h
include/yaz/charneg.h
include/yaz/comstack.h
include/yaz/cql.h
include/yaz/ill.h
include/yaz/log.h
include/yaz/logrpn.h
include/yaz/marcdisp.h
include/yaz/nmem.h
include/yaz/odr.h
include/yaz/oid.h
include/yaz/options.h
include/yaz/otherinfo.h
include/yaz/pquery.h
include/yaz/proto.h
include/yaz/prt-ext.h
include/yaz/readconf.h
include/yaz/soap.h
include/yaz/sortspec.h
include/yaz/srw.h
include/yaz/statserv.h
include/yaz/tcpip.h
include/yaz/tpath.h
include/yaz/unix.h
include/yaz/wrbuf.h
include/yaz/xmalloc.h
include/yaz/yaz-ccl.h
include/yaz/yaz-iconv.h
include/yaz/yaz-util.h
include/yaz/yaz-version.h
include/yaz/yconfig.h
include/yaz/zgdu.h
include/yaz/zoom.h
rfc1006/makensap.c
rfc1006/rfct.c
src/atoin.c
src/ber_any.c
src/ber_bit.c
src/ber_bool.c
src/ber_int.c
src/ber_len.c
src/ber_null.c
src/ber_oct.c
src/ber_oid.c
src/ber_tag.c
src/cclerrms.c
src/cclfind.c
src/cclptree.c
src/cclqfile.c
src/cclqual.c
src/cclstr.c
src/ccltoken.c
src/charneg.c
src/comstack.c
src/cqlstdio.c
src/cqlstrer.c
src/cqlstring.c
src/cqltransform.c
src/cqlutil.c
src/diag-entry.c
src/diag-entry.h
src/dumpber.c
src/eventl.c
src/eventl.h
src/grs1disp.c
src/ill-get.c
src/initopt.c
src/log.c
src/logrpn.c
src/marcdisp.c
src/matchstr.c
src/nmem.c
src/nmemsdup.c
src/odr-priv.h
src/odr.c
src/odr_any.c
src/odr_bit.c
src/odr_bool.c
src/odr_choice.c
src/odr_cons.c
src/odr_enum.c
src/odr_int.c
src/odr_mem.c
src/odr_null.c
src/odr_oct.c
src/odr_oid.c
src/odr_seq.c
src/odr_tag.c
src/odr_use.c
src/odr_util.c
src/oid.c
src/opacdisp.c
src/options.c
src/otherinfo.c
src/pquery.c
src/prt-ext.c
src/readconf.c
src/requestq.c
src/service.c
src/service.h
src/seshigh.c
src/session.h
src/siconv.c
src/soap.c
src/sortspec.c
src/srw.c
src/srwutil.c
src/statserv.c
src/tcpdchk.c
src/tcpip.c
src/tpath.c
src/unix.c
src/version.c
src/waislen.c
src/wrbuf.c
src/xcqlutil.c
src/xmalloc.c
src/yaz-ccl.c
src/z3950oid.c
src/zgdu.c
src/zget.c
src/zoom-c.c
src/zoom-opt.c
src/zoom-p.h
test/tstccl.c
test/tsticonv.c
test/tstlog.c
test/tstmatchstr.c
test/tstnmem.c
test/tstodr.c
test/tstsoap1.c
test/tstsoap2.c
test/tstwrbuf.c
util/benchmark.c
util/cclsh.c
util/cql2pqf.c
util/cql2xcql.c
util/marcdump.c
util/srwtst.c
util/yaziconv.c
win/resource.h
zoom/zoomsh.c
zoom/zoomtst1.c
zoom/zoomtst2.c
zoom/zoomtst3.c
zoom/zoomtst4.c
zoom/zoomtst5.c
zoom/zoomtst6.c
zoom/zoomtst7.c
zoom/zoomtst8.c
ztest/read-grs.c
ztest/read-marc.c
ztest/ztest.c

index 84674be..9dddf0d 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: admin.c,v 1.20 2005-06-24 19:56:52 adam Exp $
+ * $Id: admin.c,v 1.21 2005-06-25 15:46:01 adam Exp $
  */
 
 #include <stdio.h>
@@ -85,44 +85,44 @@ int sendAdminES(int type, char* param1)
     switch ( type )
     {
     case Z_ESAdminOriginPartToKeep_reIndex:
-       toKeep->u.reIndex=odr_nullval();
-       break;
-       
+        toKeep->u.reIndex=odr_nullval();
+        break;
+        
     case Z_ESAdminOriginPartToKeep_truncate:
-       toKeep->u.truncate=odr_nullval();
-       break;
+        toKeep->u.truncate=odr_nullval();
+        break;
     case Z_ESAdminOriginPartToKeep_drop:
-       toKeep->u.drop=odr_nullval();
-       break;
+        toKeep->u.drop=odr_nullval();
+        break;
     case Z_ESAdminOriginPartToKeep_create:
-       toKeep->u.create=odr_nullval();
-       break;
+        toKeep->u.create=odr_nullval();
+        break;
     case Z_ESAdminOriginPartToKeep_import:
-       toKeep->u.import = (Z_ImportParameters*)
+        toKeep->u.import = (Z_ImportParameters*)
             odr_malloc(out, sizeof(*toKeep->u.import));
-       toKeep->u.import->recordType=param1;
-       /* Need to add additional setup of records here */
-       break;
+        toKeep->u.import->recordType=param1;
+        /* Need to add additional setup of records here */
+        break;
     case Z_ESAdminOriginPartToKeep_refresh:
-       toKeep->u.refresh=odr_nullval();
-       break;
+        toKeep->u.refresh=odr_nullval();
+        break;
     case Z_ESAdminOriginPartToKeep_commit:
-       toKeep->u.commit=odr_nullval();
-       break;
+        toKeep->u.commit=odr_nullval();
+        break;
     case Z_ESAdminOriginPartToKeep_shutdown:
-       toKeep->u.commit=odr_nullval();
-       break;
+        toKeep->u.commit=odr_nullval();
+        break;
     case Z_ESAdminOriginPartToKeep_start:
-       toKeep->u.commit=odr_nullval();
-       break;
+        toKeep->u.commit=odr_nullval();
+        break;
     default:
-       /* Unknown admin service */
-       break;
+        /* Unknown admin service */
+        break;
     }
     
     notToKeep = r->u.adminService->u.esRequest->notToKeep =
-       (Z_ESAdminOriginPartNotToKeep *)
-       odr_malloc(out, sizeof(*r->u.adminService->u.esRequest->notToKeep));
+        (Z_ESAdminOriginPartNotToKeep *)
+        odr_malloc(out, sizeof(*r->u.adminService->u.esRequest->notToKeep));
     notToKeep->which=Z_ESAdminOriginPartNotToKeep_recordsWillFollow;
     notToKeep->u.recordsWillFollow=odr_nullval();
     
@@ -147,7 +147,7 @@ int cmd_adm_truncate(const char *arg)
     if ( arg )
     {
         sendAdminES(Z_ESAdminOriginPartToKeep_truncate, NULL);
-       return 2;
+        return 2;
     }
     return 0;
 }
@@ -159,7 +159,7 @@ int cmd_adm_create(const char *arg)
     if ( arg )
     {
         sendAdminES(Z_ESAdminOriginPartToKeep_create, NULL);
-       return 2;
+        return 2;
     }
     return 0;
 }
@@ -171,7 +171,7 @@ int cmd_adm_drop(const char *arg)
     if ( arg )
     {
         sendAdminES(Z_ESAdminOriginPartToKeep_drop, NULL);
-       return 2;
+        return 2;
     }
     return 0;
 }
@@ -195,69 +195,69 @@ int cmd_adm_import(const char *arg)
     ODR out = getODROutputStream();
 
     if (arg && sscanf (arg, "%19s %1023s %1023s", type_str,
-                      dir_str, pattern_str) != 3)
-       return 0;
+                       dir_str, pattern_str) != 3)
+        return 0;
     if (num_databaseNames != 1)
-       return 0;
+        return 0;
     dir = opendir(dir_str);
     if (!dir)
-       return 0;
+        return 0;
     
     sendAdminES(Z_ESAdminOriginPartToKeep_import, type_str);
     
     printf ("sent es request\n");
     if ((cp=strrchr(dir_str, '/')) && cp[1] == 0)
-       sep="";
-       
+        sep="";
+        
     while ((ent = readdir(dir)))
     {
-       if (fnmatch (pattern_str, ent->d_name, 0) == 0)
-       {
-           char fname[1024];
-           struct stat status;
-           FILE *inf;
-               
-           sprintf (fname, "%s%s%s", dir_str, sep, ent->d_name);
-           stat (fname, &status);
+        if (fnmatch (pattern_str, ent->d_name, 0) == 0)
+        {
+            char fname[1024];
+            struct stat status;
+            FILE *inf;
+                
+            sprintf (fname, "%s%s%s", dir_str, sep, ent->d_name);
+            stat (fname, &status);
 
-           if (S_ISREG(status.st_mode) && (inf = fopen(fname, "r")))
-           {
-               Z_NamePlusRecord *rec;
-               Odr_oct *oct = (Odr_oct *) odr_malloc (out, sizeof(*oct));
+            if (S_ISREG(status.st_mode) && (inf = fopen(fname, "r")))
+            {
+                Z_NamePlusRecord *rec;
+                Odr_oct *oct = (Odr_oct *) odr_malloc (out, sizeof(*oct));
 
-               if (!apdu)
-               {
-                   apdu = zget_APDU(out, Z_APDU_segmentRequest);
-                   segment = apdu->u.segmentRequest;
-                   segment->segmentRecords = (Z_NamePlusRecord **)
-                       odr_malloc (out, chunk * sizeof(*segment->segmentRecords));
-               }
-               rec = (Z_NamePlusRecord *) odr_malloc (out, sizeof(*rec));
-               rec->databaseName = 0;
-               rec->which = Z_NamePlusRecord_intermediateFragment;
-               rec->u.intermediateFragment = (Z_FragmentSyntax *)
-                   odr_malloc (out, sizeof(*rec->u.intermediateFragment));
-               rec->u.intermediateFragment->which =
-                   Z_FragmentSyntax_notExternallyTagged;
-               rec->u.intermediateFragment->u.notExternallyTagged = oct;
-               
-               oct->len = oct->size = status.st_size;
-               oct->buf = (unsigned char *) odr_malloc (out, oct->size);
-               fread (oct->buf, 1, oct->size, inf);
-               fclose (inf);
-               
-               segment->segmentRecords[segment->num_segmentRecords++] = rec;
+                if (!apdu)
+                {
+                    apdu = zget_APDU(out, Z_APDU_segmentRequest);
+                    segment = apdu->u.segmentRequest;
+                    segment->segmentRecords = (Z_NamePlusRecord **)
+                        odr_malloc (out, chunk * sizeof(*segment->segmentRecords));
+                }
+                rec = (Z_NamePlusRecord *) odr_malloc (out, sizeof(*rec));
+                rec->databaseName = 0;
+                rec->which = Z_NamePlusRecord_intermediateFragment;
+                rec->u.intermediateFragment = (Z_FragmentSyntax *)
+                    odr_malloc (out, sizeof(*rec->u.intermediateFragment));
+                rec->u.intermediateFragment->which =
+                    Z_FragmentSyntax_notExternallyTagged;
+                rec->u.intermediateFragment->u.notExternallyTagged = oct;
+                
+                oct->len = oct->size = status.st_size;
+                oct->buf = (unsigned char *) odr_malloc (out, oct->size);
+                fread (oct->buf, 1, oct->size, inf);
+                fclose (inf);
+                
+                segment->segmentRecords[segment->num_segmentRecords++] = rec;
 
-               if (segment->num_segmentRecords == chunk)
-               {
-                   send_apdu (apdu);
-                   apdu = 0;
-               }
-           }   
-       }
+                if (segment->num_segmentRecords == chunk)
+                {
+                    send_apdu (apdu);
+                    apdu = 0;
+                }
+            }   
+        }
     }
     if (apdu)
-       send_apdu(apdu);
+        send_apdu(apdu);
     apdu = zget_APDU(out, Z_APDU_segmentRequest);
     send_apdu (apdu);
     closedir(dir);
@@ -279,7 +279,7 @@ int cmd_adm_refresh(const char *arg)
     if ( arg )
     {
         sendAdminES(Z_ESAdminOriginPartToKeep_refresh, NULL);
-       return 2;
+        return 2;
     }
     return 0;
 }
@@ -303,3 +303,11 @@ int cmd_adm_startup(const char *arg)
     sendAdminES(Z_ESAdminOriginPartToKeep_start, NULL);
     return 2;
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index ce862f0..0a87a11 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: admin.h,v 1.8 2005-01-15 19:47:08 adam Exp $
+ * $Id: admin.h,v 1.9 2005-06-25 15:46:01 adam Exp $
  */
 
 int cmd_adm_reindex(const char* arg);
@@ -18,9 +18,9 @@ int cmd_adm_startup(const char* arg);
 int send_apdu(Z_APDU *a);
 /*
  * Local variables:
- * tab-width: 8
  * c-basic-offset: 4
+ * indent-tabs-mode: nil
  * End:
- * vim600: sw=4 ts=8 fdm=marker
- * vim<600: sw=4 ts=8
+ * vim: shiftwidth=4 tabstop=8 expandtab
  */
+
index 79db2d2..d2a4b2f 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: bertorture.c,v 1.3 2005-01-16 21:51:49 adam Exp $
+ * $Id: bertorture.c,v 1.4 2005-06-25 15:46:01 adam Exp $
  */
 
 #include <signal.h>
@@ -221,3 +221,11 @@ int main(int argc, char **argv)
             printf ("%3d %9d\n", i, estat[i]);
     exit(0);
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 14aa737..f85f0e1 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: client.c,v 1.291 2005-06-24 19:56:52 adam Exp $
+ * $Id: client.c,v 1.292 2005-06-25 15:46:01 adam Exp $
  */
 
 #include <stdio.h>
@@ -145,7 +145,7 @@ typedef enum {
 static QueryType queryType = QueryType_Prefix;
 
 static CCL_bibset bibset;               /* CCL bibset handle */
-static cql_transform_t cqltrans;       /* CQL context-set handle */
+static cql_transform_t cqltrans;        /* CQL context-set handle */
 
 #if HAVE_READLINE_COMPLETION_OVER
 
@@ -162,7 +162,7 @@ struct {
     int oidval;
     char* value;
 } extraOtherInfos[maxOtherInfosSupported];
-       
+        
 
 void process_cmd_line(char* line);
 char ** readline_completer(char *text, int start, int end);
@@ -194,31 +194,31 @@ static void do_hex_dump(const char* buf, int len)
 {
     if (hex_dump)
     {
-       int i,x;
-       for( i=0; i<len ; i=i+16 ) 
-       {                       
-           printf(" %4.4d ",i);
-           for(x=0 ; i+x<len && x<16; ++x) 
-           {
-               printf("%2.2X ",(unsigned int)((unsigned char)buf[i+x]));
-           }
-           printf("\n");
-       }
+        int i,x;
+        for( i=0; i<len ; i=i+16 ) 
+        {                       
+            printf(" %4.4d ",i);
+            for(x=0 ; i+x<len && x<16; ++x) 
+            {
+                printf("%2.2X ",(unsigned int)((unsigned char)buf[i+x]));
+            }
+            printf("\n");
+        }
     }
     if (dump_file_prefix)
     {
-       static int no = 0;
-       if (++no < 1000 && strlen(dump_file_prefix) < 500)
-       {
-           char fname[1024];
-           FILE *of;
-           sprintf (fname, "%s.%03d.raw", dump_file_prefix, no);
-           of = fopen(fname, "wb");
-           
-           fwrite (buf, 1, len, of);
-           
-           fclose(of);
-       }
+        static int no = 0;
+        if (++no < 1000 && strlen(dump_file_prefix) < 500)
+        {
+            char fname[1024];
+            FILE *of;
+            sprintf (fname, "%s.%03d.raw", dump_file_prefix, no);
+            of = fopen(fname, "wb");
+            
+            fwrite (buf, 1, len, of);
+            
+            fclose(of);
+        }
     }
 }
 
@@ -226,7 +226,7 @@ void add_otherInfos(Z_APDU *a)
 {
     Z_OtherInformation **oi;
     int i;
-               
+                
     yaz_oi_APDU(a, &oi);
     for(i=0; i<maxOtherInfosSupported; ++i) 
     {
@@ -313,7 +313,7 @@ static void send_initRequest(const char* type_and_host)
 
     ODR_MASK_ZERO(req->protocolVersion);
     for (i = 0; i<z3950_version; i++)
-       ODR_MASK_SET(req->protocolVersion, i);
+        ODR_MASK_SET(req->protocolVersion, i);
 
     *req->maximumRecordSize = 1024*kilobytes;
     *req->preferredMessageSize = 1024*kilobytes;
@@ -327,23 +327,23 @@ static void send_initRequest(const char* type_and_host)
         1, type_and_host);
     
     if (negotiationCharset || yazLang) {
-       Z_OtherInformation **p;
-       Z_OtherInformationUnit *p0;
-       
-       yaz_oi_APDU(apdu, &p);
-       
-       if ((p0=yaz_oi_update(p, out, NULL, 0, 0))) {
-           ODR_MASK_SET(req->options, Z_Options_negotiationModel);
-           
-           p0->which = Z_OtherInfo_externallyDefinedInfo;
-           p0->information.externallyDefinedInfo =
-               yaz_set_proposal_charneg(
-                   out,
-                   (const char**)&negotiationCharset, 
-                   negotiationCharset ? 1 : 0,
-                   (const char**)&yazLang, yazLang ? 1 : 0, 
-                   negotiationCharsetRecords);
-       }
+        Z_OtherInformation **p;
+        Z_OtherInformationUnit *p0;
+        
+        yaz_oi_APDU(apdu, &p);
+        
+        if ((p0=yaz_oi_update(p, out, NULL, 0, 0))) {
+            ODR_MASK_SET(req->options, Z_Options_negotiationModel);
+            
+            p0->which = Z_OtherInfo_externallyDefinedInfo;
+            p0->information.externallyDefinedInfo =
+                yaz_set_proposal_charneg(
+                    out,
+                    (const char**)&negotiationCharset, 
+                    negotiationCharset ? 1 : 0,
+                    (const char**)&yazLang, yazLang ? 1 : 0, 
+                    negotiationCharsetRecords);
+        }
     }
     
     if (send_apdu(apdu))
@@ -383,46 +383,46 @@ static int process_initResponse(Z_InitResponse *res)
         printf("Version: %s\n", res->implementationVersion);
     if (res->userInformationField)
     {
-       Z_External *uif = res->userInformationField;
-       if (uif->which == Z_External_userInfo1) {
-           render_initUserInfo(uif->u.userInfo1);
-       } else {
-           printf("UserInformationfield:\n");
-           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->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) {
-                   Z_OCLC_UserInformation *oclc_ui;
-                   ODR decode = odr_createmem(ODR_DECODE);
-                   odr_setbuf(decode, sat->buf, sat->len, 0);
-                   if (!z_OCLC_UserInformation(decode, &oclc_ui, 0, 0))
-                       printf ("Bad OCLC UserInformation:\n");
-                   else
-                       printf ("OCLC UserInformation:\n");
-                   if (!z_OCLC_UserInformation(print, &oclc_ui, 0, 0))
-                       printf ("Bad OCLC UserInformation spec\n");
-                   odr_destroy(decode);
-               }
-               else
-               {
-                   /* Peek at any private Init-diagnostic APDUs */
-                   printf("### NAUGHTY: External is '%.*s'\n",
-                          sat->len, sat->buf);
-               }
-           }
-           odr_reset (print);
-       }
+        Z_External *uif = res->userInformationField;
+        if (uif->which == Z_External_userInfo1) {
+            render_initUserInfo(uif->u.userInfo1);
+        } else {
+            printf("UserInformationfield:\n");
+            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->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) {
+                    Z_OCLC_UserInformation *oclc_ui;
+                    ODR decode = odr_createmem(ODR_DECODE);
+                    odr_setbuf(decode, sat->buf, sat->len, 0);
+                    if (!z_OCLC_UserInformation(decode, &oclc_ui, 0, 0))
+                        printf ("Bad OCLC UserInformation:\n");
+                    else
+                        printf ("OCLC UserInformation:\n");
+                    if (!z_OCLC_UserInformation(print, &oclc_ui, 0, 0))
+                        printf ("Bad OCLC UserInformation spec\n");
+                    odr_destroy(decode);
+                }
+                else
+                {
+                    /* Peek at any private Init-diagnostic APDUs */
+                    printf("### NAUGHTY: External is '%.*s'\n",
+                           sat->len, sat->buf);
+                }
+            }
+            odr_reset (print);
+        }
     }
     printf ("Options:");
     yaz_init_opt_decode(res->options, pr_opt, 0);
@@ -433,10 +433,10 @@ static int process_initResponse(Z_InitResponse *res)
     
     if (ODR_MASK_GET(res->options, Z_Options_negotiationModel)) {
     
-       Z_CharSetandLanguageNegotiation *p =
-               yaz_get_charneg_record(res->otherInfo);
-       
-       if (p) {
+        Z_CharSetandLanguageNegotiation *p =
+                yaz_get_charneg_record(res->otherInfo);
+        
+        if (p) {
             
             char *charset=NULL, *lang=NULL;
             int selected;
@@ -444,19 +444,19 @@ 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);
-           }
+            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");
             printf("Accepted records in ...: %d\n", selected );
-       }
+        }
     }
     fflush (stdout);
     return 0;
@@ -466,27 +466,27 @@ static int process_initResponse(Z_InitResponse *res)
 static void render_initUserInfo(Z_OtherInformation *ui1) {
     int i;
     printf("Init response contains %d otherInfo unit%s:\n",
-          ui1->num_elements, ui1->num_elements == 1 ? "" : "s");
+           ui1->num_elements, ui1->num_elements == 1 ? "" : "s");
 
     for (i = 0; i < ui1->num_elements; i++) {
-       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 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);
-       }
+        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 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);
+        }
     }
 }
 
@@ -497,30 +497,30 @@ static void render_diag(Z_DiagnosticFormat *diag) {
 
     printf("%d diagnostic%s:\n", diag->num, diag->num == 1 ? "" : "s");
     for (i = 0; i < diag->num; i++) {
-       Z_DiagnosticFormat_s *ds = diag->elements[i];
-       printf("    %d: ", i+1);
-       switch (ds->which) {
-       case Z_DiagnosticFormat_s_defaultDiagRec: {
-           Z_DefaultDiagFormat *dd = ds->u.defaultDiagRec;
-           /* ### should check `dd->diagnosticSetId' */
-           printf("code=%d (%s)", *dd->condition,
-                  diagbib1_str(*dd->condition));
-           /* Both types of addinfo are the same, so use type-pun */
-           if (dd->u.v2Addinfo != 0)
-               printf(",\n\taddinfo='%s'", dd->u.v2Addinfo);
-           break;
-       }
-       case Z_DiagnosticFormat_s_explicitDiagnostic:
-           printf("Explicit diagnostic (not supported)");
-           break;
-       default:
-           printf("Unrecognised diagnostic type %d", ds->which);
-           break;
-       }
-
-       if (ds->message != 0)
-           printf(", message='%s'", ds->message);
-       printf("\n");
+        Z_DiagnosticFormat_s *ds = diag->elements[i];
+        printf("    %d: ", i+1);
+        switch (ds->which) {
+        case Z_DiagnosticFormat_s_defaultDiagRec: {
+            Z_DefaultDiagFormat *dd = ds->u.defaultDiagRec;
+            /* ### should check `dd->diagnosticSetId' */
+            printf("code=%d (%s)", *dd->condition,
+                   diagbib1_str(*dd->condition));
+            /* Both types of addinfo are the same, so use type-pun */
+            if (dd->u.v2Addinfo != 0)
+                printf(",\n\taddinfo='%s'", dd->u.v2Addinfo);
+            break;
+        }
+        case Z_DiagnosticFormat_s_explicitDiagnostic:
+            printf("Explicit diagnostic (not supported)");
+            break;
+        default:
+            printf("Unrecognised diagnostic type %d", ds->which);
+            break;
+        }
+
+        if (ds->message != 0)
+            printf(", message='%s'", ds->message);
+        printf("\n");
     }
 }
 
@@ -562,70 +562,70 @@ static int set_base(const char *arg)
 }
 
 static int parse_cmd_doc(const char **arg, ODR out, char **buf,
-                        int *len, int opt)
+                         int *len, int opt)
 {
     const char *sep;
     while (**arg && strchr(" \t\n\r\f", **arg))
-       (*arg)++;
+        (*arg)++;
     if ((*arg)[0] == '\"' && (sep=strchr(*arg+1, '"')))
     {
-       (*arg)++;
-       *len = sep - *arg;
-       *buf = odr_strdupn(out, *arg, *len);
-       (*arg) = sep+1;
-       return 1;
+        (*arg)++;
+        *len = sep - *arg;
+        *buf = odr_strdupn(out, *arg, *len);
+        (*arg) = sep+1;
+        return 1;
     }
     else if ((*arg)[0] && (*arg)[0] != '\"')
     {
-       long fsize;
-       FILE *inf;
-       const char *fname = *arg;
-       
-       while (**arg != '\0' && **arg != ' ')
-           (*arg)++;
-           
-       inf = fopen(fname, "rb");
-       if (!inf)
-       {
-           printf("Couldn't open %s\n", fname);
-           return 0;
-       }
-       if (fseek(inf, 0L, SEEK_END) == -1)
-       {
-           printf("Couldn't seek in %s\n", fname);
-           fclose(inf);
-           return 0;
-       }
-       fsize = ftell(inf);
-       if (fseek(inf, 0L, SEEK_SET) == -1)
-       {
-           printf("Couldn't seek in %s\n", fname);
-           fclose(inf);
-           return 0;
-       }
-       *len = fsize;
-       *buf = odr_malloc(out, fsize);
-       if (fread(*buf, 1, fsize, inf) != fsize)
-       {
-           printf("Unable to read %s\n", fname);
-           fclose(inf);
-           return 0;
-       }
-       fclose(inf);
-       return 1;
+        long fsize;
+        FILE *inf;
+        const char *fname = *arg;
+        
+        while (**arg != '\0' && **arg != ' ')
+            (*arg)++;
+            
+        inf = fopen(fname, "rb");
+        if (!inf)
+        {
+            printf("Couldn't open %s\n", fname);
+            return 0;
+        }
+        if (fseek(inf, 0L, SEEK_END) == -1)
+        {
+            printf("Couldn't seek in %s\n", fname);
+            fclose(inf);
+            return 0;
+        }
+        fsize = ftell(inf);
+        if (fseek(inf, 0L, SEEK_SET) == -1)
+        {
+            printf("Couldn't seek in %s\n", fname);
+            fclose(inf);
+            return 0;
+        }
+        *len = fsize;
+        *buf = odr_malloc(out, fsize);
+        if (fread(*buf, 1, fsize, inf) != fsize)
+        {
+            printf("Unable to read %s\n", fname);
+            fclose(inf);
+            return 0;
+        }
+        fclose(inf);
+        return 1;
     }
     else if (**arg == '\0')
     {
-       if (opt)
-       {
-           *len = 0;
-           *buf = 0;
-           return 1;
-       }
-       printf("Missing doc argument\n");
+        if (opt)
+        {
+            *len = 0;
+            *buf = 0;
+            return 1;
+        }
+        printf("Missing doc argument\n");
     }
     else
-       printf("Bad doc argument %s\n", *arg);
+        printf("Bad doc argument %s\n", *arg);
     return 0;
 }
 
@@ -663,9 +663,9 @@ int session_connect(const char *arg)
     }   
     if (session_mem)
     {
-       nmem_destroy (session_mem);
-       session_mem = NULL;
-       session_initResponse = 0;
+        nmem_destroy (session_mem);
+        session_mem = NULL;
+        session_initResponse = 0;
     }
     cs_get_host_args(arg, &basep);
 
@@ -685,7 +685,7 @@ int session_connect(const char *arg)
     }
 #if HAVE_XML2
     if (conn->protocol == PROTO_HTTP)
-       queryType = QueryType_CQL;
+        queryType = QueryType_CQL;
 #else
     if (conn->protocol == PROTO_HTTP)
     {
@@ -706,11 +706,11 @@ int session_connect(const char *arg)
     {
         printf ("error = %s\n", cs_strerror(conn));
         if (conn->cerrno == CSYSERR)
-       {
-           char msg[256];
-           yaz_strerror(msg, sizeof(msg));
-           printf ("%s\n", msg);
-       }
+        {
+            char msg[256];
+            yaz_strerror(msg, sizeof(msg));
+            printf ("%s\n", msg);
+        }
         cs_close(conn);
         conn = 0;
         return 0;
@@ -719,25 +719,25 @@ int session_connect(const char *arg)
 #if HAVE_OPENSSL_SSL_H
     if ((ssl = (SSL *) cs_get_ssl(conn)))
     {
-       X509 *server_cert = SSL_get_peer_certificate (ssl);
-
-       if (server_cert)
-       {
-           char *pem_buf;
-           int pem_len;
-           BIO *bio = BIO_new(BIO_s_mem());
+        X509 *server_cert = SSL_get_peer_certificate (ssl);
 
-           /* get PEM buffer in memory */
-           PEM_write_bio_X509(bio, server_cert);
-           pem_len = BIO_get_mem_data(bio, &pem_buf);
-           fwrite(pem_buf, pem_len, 1, stdout);
-       
-           /* print all info on screen .. */
-           X509_print_fp(stdout, server_cert);
-           BIO_free(bio);
+        if (server_cert)
+        {
+            char *pem_buf;
+            int pem_len;
+            BIO *bio = BIO_new(BIO_s_mem());
+
+            /* get PEM buffer in memory */
+            PEM_write_bio_X509(bio, server_cert);
+            pem_len = BIO_get_mem_data(bio, &pem_buf);
+            fwrite(pem_buf, pem_len, 1, stdout);
+        
+            /* print all info on screen .. */
+            X509_print_fp(stdout, server_cert);
+            BIO_free(bio);
 
-           X509_free (server_cert);
-       }
+            X509_free (server_cert);
+        }
     }
 #endif
     if (basep && *basep)
@@ -763,17 +763,17 @@ int cmd_open(const char *arg)
 void try_reconnect() 
 {
     char* open_command;
-       
+        
     if(!( auto_reconnect && last_open_command) ) return ;
 
     open_command = (char *) xmalloc (strlen(last_open_command)+6);
     strcpy (open_command, "open ");
-       
+        
     strcat (open_command, last_open_command);
 
     process_cmd_line(open_command);
-       
-    xfree(open_command);                               
+        
+    xfree(open_command);                                
 }
 
 int cmd_authentication(const char *arg)
@@ -798,14 +798,14 @@ int cmd_authentication(const char *arg)
     if (r == 1)
     {
         auth = &au;
-       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 (!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)
     {
@@ -815,7 +815,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);
+        printf("Authentication set to User (%s), Pass (%s)\n", user, group);
     }
     if (r == 3)
     {
@@ -825,8 +825,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);
+        printf("Authentication set to User (%s), Group (%s), Pass (%s)\n",
+               user, group, pass);
     }
     return 1;
 }
@@ -884,7 +884,7 @@ static void display_record(Z_External *r)
                             r->u.octet_aligned->len);
                 fprintf(stdout, "---------\n");
                 
-               /* note just ignores the error ant print the bytes form the octet_aligned later */
+                /* note just ignores the error ant print the bytes form the octet_aligned later */
             } else {
                 /*
                  * Note: we throw away the original, BER-encoded record here.
@@ -906,9 +906,9 @@ static void display_record(Z_External *r)
     {
         const char *octet_buf = (char*)r->u.octet_aligned->buf;
         if (ent->oclass == CLASS_RECSYN && 
-               (ent->value == VAL_TEXT_XML || 
-                ent->value == VAL_APPLICATION_XML ||
-                ent->value == VAL_HTML))
+                (ent->value == VAL_TEXT_XML || 
+                 ent->value == VAL_APPLICATION_XML ||
+                 ent->value == VAL_HTML))
         {
             print_record((const unsigned char *) octet_buf,
                          r->u.octet_aligned->len);
@@ -953,17 +953,17 @@ static void display_record(Z_External *r)
                         else
                             from = "ISO-8859-1";
                     }
-                   else if (marcCharset)
-                       from = marcCharset;
+                    else if (marcCharset)
+                        from = marcCharset;
                     if (outputCharset && from)
                     {   
                         cd = yaz_iconv_open(outputCharset, from);
                         printf ("convert from %s to %s", from, 
                                 outputCharset);
-                       if (!cd)
-                           printf (" unsupported\n");
-                       else
-                           printf ("\n");
+                        if (!cd)
+                            printf (" unsupported\n");
+                        else
+                            printf ("\n");
                     }
                     if (!cd)
                         fwrite (result, 1, rlen, stdout);
@@ -977,11 +977,11 @@ static void display_record(Z_External *r)
                         {
                             size_t outbytesleft = sizeof(outbuf);
                             char *outp = outbuf;
-                           size_t r;
+                            size_t r;
 
                             r = yaz_iconv (cd, (char**) &inp,
-                                          &inbytesleft, 
-                                          &outp, &outbytesleft);
+                                           &inbytesleft, 
+                                           &outp, &outbytesleft);
                             if (r == (size_t) (-1))
                             {
                                 int e = yaz_iconv_error(cd);
@@ -992,12 +992,12 @@ static void display_record(Z_External *r)
                         }
                     }
                 }
-               else
+                else
                 {
                     printf ("bad MARC. Dumping as it is:\n");
                     print_record((const unsigned char*) octet_buf,
                                   r->u.octet_aligned->len);
-               }       
+                }       
                 yaz_marc_destroy(mt);
                 if (cd)
                     yaz_iconv_close(cd);
@@ -1037,105 +1037,105 @@ static void display_record(Z_External *r)
     }
     else if (ent && ent->value == VAL_OPAC)
     {
-       int i;
-       if (r->u.opac->bibliographicRecord)
-           display_record(r->u.opac->bibliographicRecord);
-       for (i = 0; i<r->u.opac->num_holdingsData; i++)
-       {
-           Z_HoldingsRecord *h = r->u.opac->holdingsData[i];
-           if (h->which == Z_HoldingsRecord_marcHoldingsRecord)
-           {
-               printf ("MARC holdings %d\n", i);
-               display_record(h->u.marcHoldingsRecord);
-           }
-           else if (h->which == Z_HoldingsRecord_holdingsAndCirc)
-           {
-               int j;
-
-               Z_HoldingsAndCircData *data = h->u.holdingsAndCirc;
-
-               printf ("Data holdings %d\n", i);
-               if (data->typeOfRecord)
-                   printf ("typeOfRecord: %s\n", data->typeOfRecord);
-               if (data->encodingLevel)
-                   printf ("encodingLevel: %s\n", data->encodingLevel);
-               if (data->receiptAcqStatus)
-                   printf ("receiptAcqStatus: %s\n", data->receiptAcqStatus);
-               if (data->generalRetention)
-                   printf ("generalRetention: %s\n", data->generalRetention);
-               if (data->completeness)
-                   printf ("completeness: %s\n", data->completeness);
-               if (data->dateOfReport)
-                   printf ("dateOfReport: %s\n", data->dateOfReport);
-               if (data->nucCode)
-                   printf ("nucCode: %s\n", data->nucCode);
-               if (data->localLocation)
-                   printf ("localLocation: %s\n", data->localLocation);
-               if (data->shelvingLocation)
-                   printf ("shelvingLocation: %s\n", data->shelvingLocation);
-               if (data->callNumber)
-                   printf ("callNumber: %s\n", data->callNumber);
-               if (data->shelvingData)
-                   printf ("shelvingData: %s\n", data->shelvingData);
-               if (data->copyNumber)
-                   printf ("copyNumber: %s\n", data->copyNumber);
-               if (data->publicNote)
-                   printf ("publicNote: %s\n", data->publicNote);
-               if (data->reproductionNote)
-                   printf ("reproductionNote: %s\n", data->reproductionNote);
-               if (data->termsUseRepro)
-                   printf ("termsUseRepro: %s\n", data->termsUseRepro);
-               if (data->enumAndChron)
-                   printf ("enumAndChron: %s\n", data->enumAndChron);
-               for (j = 0; j<data->num_volumes; j++)
-               {
-                   printf ("volume %d\n", j);
-                   if (data->volumes[j]->enumeration)
-                       printf (" enumeration: %s\n",
-                               data->volumes[j]->enumeration);
-                   if (data->volumes[j]->chronology)
-                       printf (" chronology: %s\n",
-                               data->volumes[j]->chronology);
-                   if (data->volumes[j]->enumAndChron)
-                       printf (" enumAndChron: %s\n",
-                               data->volumes[j]->enumAndChron);
-               }
-               for (j = 0; j<data->num_circulationData; j++)
-               {
-                   printf ("circulation %d\n", j);
-                   if (data->circulationData[j]->availableNow)
-                       printf (" availableNow: %d\n",
-                               *data->circulationData[j]->availableNow);
-                   if (data->circulationData[j]->availablityDate)
-                       printf (" availabiltyDate: %s\n",
-                               data->circulationData[j]->availablityDate);
-                   if (data->circulationData[j]->availableThru)
-                       printf (" availableThru: %s\n",
-                               data->circulationData[j]->availableThru);
-                   if (data->circulationData[j]->restrictions)
-                       printf (" restrictions: %s\n",
-                               data->circulationData[j]->restrictions);
-                   if (data->circulationData[j]->itemId)
-                       printf (" itemId: %s\n",
-                               data->circulationData[j]->itemId);
-                   if (data->circulationData[j]->renewable)
-                       printf (" renewable: %d\n",
-                               *data->circulationData[j]->renewable);
-                   if (data->circulationData[j]->onHold)
-                       printf (" onHold: %d\n",
-                               *data->circulationData[j]->onHold);
-                   if (data->circulationData[j]->enumAndChron)
-                       printf (" enumAndChron: %s\n",
-                               data->circulationData[j]->enumAndChron);
-                   if (data->circulationData[j]->midspine)
-                       printf (" midspine: %s\n",
-                               data->circulationData[j]->midspine);
-                   if (data->circulationData[j]->temporaryLocation)
-                       printf (" temporaryLocation: %s\n",
-                               data->circulationData[j]->temporaryLocation);
-               }
-           }
-       }
+        int i;
+        if (r->u.opac->bibliographicRecord)
+            display_record(r->u.opac->bibliographicRecord);
+        for (i = 0; i<r->u.opac->num_holdingsData; i++)
+        {
+            Z_HoldingsRecord *h = r->u.opac->holdingsData[i];
+            if (h->which == Z_HoldingsRecord_marcHoldingsRecord)
+            {
+                printf ("MARC holdings %d\n", i);
+                display_record(h->u.marcHoldingsRecord);
+            }
+            else if (h->which == Z_HoldingsRecord_holdingsAndCirc)
+            {
+                int j;
+
+                Z_HoldingsAndCircData *data = h->u.holdingsAndCirc;
+
+                printf ("Data holdings %d\n", i);
+                if (data->typeOfRecord)
+                    printf ("typeOfRecord: %s\n", data->typeOfRecord);
+                if (data->encodingLevel)
+                    printf ("encodingLevel: %s\n", data->encodingLevel);
+                if (data->receiptAcqStatus)
+                    printf ("receiptAcqStatus: %s\n", data->receiptAcqStatus);
+                if (data->generalRetention)
+                    printf ("generalRetention: %s\n", data->generalRetention);
+                if (data->completeness)
+                    printf ("completeness: %s\n", data->completeness);
+                if (data->dateOfReport)
+                    printf ("dateOfReport: %s\n", data->dateOfReport);
+                if (data->nucCode)
+                    printf ("nucCode: %s\n", data->nucCode);
+                if (data->localLocation)
+                    printf ("localLocation: %s\n", data->localLocation);
+                if (data->shelvingLocation)
+                    printf ("shelvingLocation: %s\n", data->shelvingLocation);
+                if (data->callNumber)
+                    printf ("callNumber: %s\n", data->callNumber);
+                if (data->shelvingData)
+                    printf ("shelvingData: %s\n", data->shelvingData);
+                if (data->copyNumber)
+                    printf ("copyNumber: %s\n", data->copyNumber);
+                if (data->publicNote)
+                    printf ("publicNote: %s\n", data->publicNote);
+                if (data->reproductionNote)
+                    printf ("reproductionNote: %s\n", data->reproductionNote);
+                if (data->termsUseRepro)
+                    printf ("termsUseRepro: %s\n", data->termsUseRepro);
+                if (data->enumAndChron)
+                    printf ("enumAndChron: %s\n", data->enumAndChron);
+                for (j = 0; j<data->num_volumes; j++)
+                {
+                    printf ("volume %d\n", j);
+                    if (data->volumes[j]->enumeration)
+                        printf (" enumeration: %s\n",
+                                data->volumes[j]->enumeration);
+                    if (data->volumes[j]->chronology)
+                        printf (" chronology: %s\n",
+                                data->volumes[j]->chronology);
+                    if (data->volumes[j]->enumAndChron)
+                        printf (" enumAndChron: %s\n",
+                                data->volumes[j]->enumAndChron);
+                }
+                for (j = 0; j<data->num_circulationData; j++)
+                {
+                    printf ("circulation %d\n", j);
+                    if (data->circulationData[j]->availableNow)
+                        printf (" availableNow: %d\n",
+                                *data->circulationData[j]->availableNow);
+                    if (data->circulationData[j]->availablityDate)
+                        printf (" availabiltyDate: %s\n",
+                                data->circulationData[j]->availablityDate);
+                    if (data->circulationData[j]->availableThru)
+                        printf (" availableThru: %s\n",
+                                data->circulationData[j]->availableThru);
+                    if (data->circulationData[j]->restrictions)
+                        printf (" restrictions: %s\n",
+                                data->circulationData[j]->restrictions);
+                    if (data->circulationData[j]->itemId)
+                        printf (" itemId: %s\n",
+                                data->circulationData[j]->itemId);
+                    if (data->circulationData[j]->renewable)
+                        printf (" renewable: %d\n",
+                                *data->circulationData[j]->renewable);
+                    if (data->circulationData[j]->onHold)
+                        printf (" onHold: %d\n",
+                                *data->circulationData[j]->onHold);
+                    if (data->circulationData[j]->enumAndChron)
+                        printf (" enumAndChron: %s\n",
+                                data->circulationData[j]->enumAndChron);
+                    if (data->circulationData[j]->midspine)
+                        printf (" midspine: %s\n",
+                                data->circulationData[j]->midspine);
+                    if (data->circulationData[j]->temporaryLocation)
+                        printf (" temporaryLocation: %s\n",
+                                data->circulationData[j]->temporaryLocation);
+                }
+            }
+        }
     }
     else 
     {
@@ -1326,17 +1326,17 @@ static int send_srw(Z_SRW_PDU *sr)
         char *buf_out;
         int len_out;
         int r;
-       if (apdu_file)
-       {
-           if (!z_GDU(print, &gdu, 0, 0))
-               printf ("Failed to print outgoing APDU\n");
-           odr_reset(print);
-       }
+        if (apdu_file)
+        {
+            if (!z_GDU(print, &gdu, 0, 0))
+                printf ("Failed to print outgoing APDU\n");
+            odr_reset(print);
+        }
         buf_out = odr_getbuf(out, &len_out, 0);
         
         /* we don't odr_reset(out), since we may need the buffer again */
 
-       do_hex_dump(buf_out, len_out);
+        do_hex_dump(buf_out, len_out);
 
         r = cs_put(conn, buf_out, len_out);
 
@@ -1357,21 +1357,21 @@ static char *encode_SRW_term(ODR o, const char *q)
     yaz_iconv_t cd;
     char *res;
     if (outputCharset)
-       in_charset = outputCharset;
+        in_charset = outputCharset;
     cd = yaz_iconv_open("UTF-8", in_charset);
     if (!cd)
     {
-       wrbuf_free(w, 1);
-       return odr_strdup(o, q);
+        wrbuf_free(w, 1);
+        return odr_strdup(o, q);
     }
     wrbuf_iconv_write(w, cd, q, strlen(q));
     if (wrbuf_len(w))
     {
-       int len = wrbuf_len(w);
-       res = odr_strdupn(o, wrbuf_buf(w), len);
+        int len = wrbuf_len(w);
+        res = odr_strdupn(o, wrbuf_buf(w), len);
     }
     else
-       res = odr_strdup(o, q);    
+        res = odr_strdup(o, q);    
     yaz_iconv_close(cd);
     wrbuf_free(w, 1);
     return res;
@@ -1388,16 +1388,16 @@ static int send_SRW_scanRequest(const char *arg, int pos, int num)
     switch(queryType)
     {
     case QueryType_CQL:
-       sr->u.scan_request->query_type = Z_SRW_query_type_cql;
-       sr->u.scan_request->scanClause.cql = encode_SRW_term(out, arg);
-       break;
+        sr->u.scan_request->query_type = Z_SRW_query_type_cql;
+        sr->u.scan_request->scanClause.cql = encode_SRW_term(out, arg);
+        break;
     case QueryType_Prefix:
-       sr->u.scan_request->query_type = Z_SRW_query_type_pqf;
-       sr->u.scan_request->scanClause.pqf = encode_SRW_term(out, arg);
-       break;
+        sr->u.scan_request->query_type = Z_SRW_query_type_pqf;
+        sr->u.scan_request->scanClause.pqf = encode_SRW_term(out, arg);
+        break;
     default:
-       printf ("Only CQL and PQF supported in SRW\n");
-       return 0;
+        printf ("Only CQL and PQF supported in SRW\n");
+        return 0;
     }
     sr->u.scan_request->responsePosition = odr_intdup(out, pos);
     sr->u.scan_request->maximumTerms = odr_intdup(out, num);
@@ -1426,22 +1426,22 @@ static int send_SRW_searchRequest(const char *arg)
     switch(queryType)
     {
     case QueryType_CQL:
-       srw_sr->u.request->query_type = Z_SRW_query_type_cql;
-       srw_sr->u.request->query.cql = encode_SRW_term(srw_sr_odr_out, arg);
+        srw_sr->u.request->query_type = Z_SRW_query_type_cql;
+        srw_sr->u.request->query.cql = encode_SRW_term(srw_sr_odr_out, arg);
 
-       sr->u.request->query_type = Z_SRW_query_type_cql;
-       sr->u.request->query.cql = encode_SRW_term(srw_sr_odr_out, arg);
-       break;
+        sr->u.request->query_type = Z_SRW_query_type_cql;
+        sr->u.request->query.cql = encode_SRW_term(srw_sr_odr_out, arg);
+        break;
     case QueryType_Prefix:
-       srw_sr->u.request->query_type = Z_SRW_query_type_pqf;
-       srw_sr->u.request->query.pqf = encode_SRW_term(srw_sr_odr_out, arg);
+        srw_sr->u.request->query_type = Z_SRW_query_type_pqf;
+        srw_sr->u.request->query.pqf = encode_SRW_term(srw_sr_odr_out, arg);
 
-       sr->u.request->query_type = Z_SRW_query_type_pqf;
-       sr->u.request->query.pqf = encode_SRW_term(srw_sr_odr_out, arg);
-       break;
+        sr->u.request->query_type = Z_SRW_query_type_pqf;
+        sr->u.request->query.pqf = encode_SRW_term(srw_sr_odr_out, arg);
+        break;
     default:
-       printf ("Only CQL and PQF supported in SRW\n");
-       return 0;
+        printf ("Only CQL and PQF supported in SRW\n");
+        return 0;
     }
     sr->u.request->maximumRecords = odr_intdup(out, 0);
 
@@ -1477,29 +1477,29 @@ static int send_searchRequest(const char *arg)
             return 0;
         }
     } else if (myQueryType == QueryType_CQL2RPN) {
-       /* ### All this code should be wrapped in a utility function */
-       CQL_parser parser;
-       struct cql_node *node;
-       const char *addinfo;
-       if (cqltrans == 0) {
+        /* ### All this code should be wrapped in a utility function */
+        CQL_parser parser;
+        struct cql_node *node;
+        const char *addinfo;
+        if (cqltrans == 0) {
             printf("Can't use CQL: no translation file.  Try set_cqlfile\n");
-           return 0;
-       }
-       parser = cql_parser_create();
-       if ((error = cql_parser_string(parser, arg)) != 0) {
+            return 0;
+        }
+        parser = cql_parser_create();
+        if ((error = cql_parser_string(parser, arg)) != 0) {
             printf("Can't parse CQL: must be a syntax error\n");
             return 0;
-       }
-       node = cql_parser_result(parser);
-       if ((error = cql_transform_buf(cqltrans, node, pqfbuf,
-                                      sizeof pqfbuf)) != 0) {
-           error = cql_transform_error(cqltrans, &addinfo);
-           printf ("Can't convert CQL to PQF: %s (addinfo=%s)\n",
-                   cql_strerror(error), addinfo);
+        }
+        node = cql_parser_result(parser);
+        if ((error = cql_transform_buf(cqltrans, node, pqfbuf,
+                                       sizeof pqfbuf)) != 0) {
+            error = cql_transform_error(cqltrans, &addinfo);
+            printf ("Can't convert CQL to PQF: %s (addinfo=%s)\n",
+                    cql_strerror(error), addinfo);
             return 0;
         }
-       arg = pqfbuf;
-       myQueryType = QueryType_Prefix;
+        arg = pqfbuf;
+        myQueryType = QueryType_Prefix;
     }
 
     req->referenceId = set_refid (out);
@@ -1912,8 +1912,8 @@ void process_ESResponse(Z_ExtendedServicesResponse *res)
     }
     if (res->taskPackage && res->taskPackage->which == Z_External_octet)
     {
-       Odr_oct *doc = res->taskPackage->u.octet_aligned;
-       printf("%.*s\n", doc->len, doc->buf);
+        Odr_oct *doc = res->taskPackage->u.octet_aligned;
+        printf("%.*s\n", doc->len, doc->buf);
     }
 }
 
@@ -2032,8 +2032,8 @@ static Z_External *create_external_ILL_APDU(int which)
         r->u.single_ASN1_type->size = ill_request_size;
         memcpy (r->u.single_ASN1_type->buf, ill_request_buf, ill_request_size);
 /*         printf ("len = %d\n", ill_request_size); */
-/*             do_hex_dump(ill_request_buf,ill_request_size); */
-/*             printf("--- end of extenal\n"); */
+/*              do_hex_dump(ill_request_buf,ill_request_size); */
+/*              printf("--- end of extenal\n"); */
 
     }
     return r;
@@ -2134,8 +2134,8 @@ static int only_z3950()
 {
     if (protocol == PROTO_HTTP)
     {
-       printf ("Not supported by SRW\n");
-       return 1;
+        printf ("Not supported by SRW\n");
+        return 1;
     }
     return 0;
 }
@@ -2165,16 +2165,16 @@ static int cmd_update_common(const char *arg, int version)
     Z_External *record_this = 0;
 
     if (only_z3950())
-       return 0;
+        return 0;
     *action = 0;
     *recid = 0;
     sscanf (arg, "%19s %19s%n", action, recid, &noread);
     if (noread == 0)
     {
-       printf("Update must be followed by action and recid\n");
-       printf(" where action is one of insert,replace,delete.update\n");
-       printf(" recid is some record ID (any string)\n");
-       return 0;
+        printf("Update must be followed by action and recid\n");
+        printf(" where action is one of insert,replace,delete.update\n");
+        printf(" recid is some record ID (any string)\n");
+        return 0;
     }
 
     if (!strcmp (action, "insert"))
@@ -2194,10 +2194,10 @@ static int cmd_update_common(const char *arg, int version)
 
     arg += noread;
     if (parse_cmd_doc(&arg, out, &rec_buf, &rec_len, 1) == 0)
-       return 0;
+        return 0;
 
     if (rec_buf)
-       record_this = z_ext_record (out, VAL_TEXT_XML, rec_buf, rec_len);
+        record_this = z_ext_record (out, VAL_TEXT_XML, rec_buf, rec_len);
     else
     {
         if (!record_last)
@@ -2209,8 +2209,8 @@ static int cmd_update_common(const char *arg, int version)
     }
 
     req->packageType =
-       yaz_oidval_to_z3950oid(out, CLASS_EXTSERV,
-                              version == 0 ? VAL_DBUPDATE0 : VAL_DBUPDATE);
+        yaz_oidval_to_z3950oid(out, CLASS_EXTSERV,
+                               version == 0 ? VAL_DBUPDATE0 : VAL_DBUPDATE);
 
     req->packageName = esPackageName;
     
@@ -2223,87 +2223,87 @@ static int cmd_update_common(const char *arg, int version)
     r->descriptor = 0;
     if (version == 0)
     {
-       Z_IU0OriginPartToKeep *toKeep;
-       Z_IU0SuppliedRecords *notToKeep;
-
-       r->which = Z_External_update0;
-       r->u.update0 = (Z_IU0Update *) odr_malloc(out, sizeof(*r->u.update0));
-       r->u.update0->which = Z_IUUpdate_esRequest;
-       r->u.update0->u.esRequest = (Z_IU0UpdateEsRequest *)
-           odr_malloc(out, sizeof(*r->u.update0->u.esRequest));
-       toKeep = r->u.update0->u.esRequest->toKeep = (Z_IU0OriginPartToKeep *)
-           odr_malloc(out, sizeof(*r->u.update0->u.esRequest->toKeep));
-       
-       toKeep->databaseName = databaseNames[0];
-       toKeep->schema = 0;
-       toKeep->elementSetName = 0;
-
-       toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
-       *toKeep->action = action_no;
-       
-       notToKeep = r->u.update0->u.esRequest->notToKeep = (Z_IU0SuppliedRecords *)
-           odr_malloc(out, sizeof(*r->u.update0->u.esRequest->notToKeep));
-       notToKeep->num = 1;
-       notToKeep->elements = (Z_IU0SuppliedRecords_elem **)
-           odr_malloc(out, sizeof(*notToKeep->elements));
-       notToKeep->elements[0] = (Z_IU0SuppliedRecords_elem *)
-           odr_malloc(out, sizeof(**notToKeep->elements));
-       notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
-       if (*recid)
-       {
-           notToKeep->elements[0]->u.opaque = (Odr_oct *)
-               odr_malloc (out, sizeof(Odr_oct));
-           notToKeep->elements[0]->u.opaque->buf = (unsigned char *) recid;
-           notToKeep->elements[0]->u.opaque->size = strlen(recid);
-           notToKeep->elements[0]->u.opaque->len = strlen(recid);
-       }
-       else
-           notToKeep->elements[0]->u.opaque = 0;
-       notToKeep->elements[0]->supplementalId = 0;
-       notToKeep->elements[0]->correlationInfo = 0;
-       notToKeep->elements[0]->record = record_this;
+        Z_IU0OriginPartToKeep *toKeep;
+        Z_IU0SuppliedRecords *notToKeep;
+
+        r->which = Z_External_update0;
+        r->u.update0 = (Z_IU0Update *) odr_malloc(out, sizeof(*r->u.update0));
+        r->u.update0->which = Z_IUUpdate_esRequest;
+        r->u.update0->u.esRequest = (Z_IU0UpdateEsRequest *)
+            odr_malloc(out, sizeof(*r->u.update0->u.esRequest));
+        toKeep = r->u.update0->u.esRequest->toKeep = (Z_IU0OriginPartToKeep *)
+            odr_malloc(out, sizeof(*r->u.update0->u.esRequest->toKeep));
+        
+        toKeep->databaseName = databaseNames[0];
+        toKeep->schema = 0;
+        toKeep->elementSetName = 0;
+
+        toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
+        *toKeep->action = action_no;
+        
+        notToKeep = r->u.update0->u.esRequest->notToKeep = (Z_IU0SuppliedRecords *)
+            odr_malloc(out, sizeof(*r->u.update0->u.esRequest->notToKeep));
+        notToKeep->num = 1;
+        notToKeep->elements = (Z_IU0SuppliedRecords_elem **)
+            odr_malloc(out, sizeof(*notToKeep->elements));
+        notToKeep->elements[0] = (Z_IU0SuppliedRecords_elem *)
+            odr_malloc(out, sizeof(**notToKeep->elements));
+        notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
+        if (*recid)
+        {
+            notToKeep->elements[0]->u.opaque = (Odr_oct *)
+                odr_malloc (out, sizeof(Odr_oct));
+            notToKeep->elements[0]->u.opaque->buf = (unsigned char *) recid;
+            notToKeep->elements[0]->u.opaque->size = strlen(recid);
+            notToKeep->elements[0]->u.opaque->len = strlen(recid);
+        }
+        else
+            notToKeep->elements[0]->u.opaque = 0;
+        notToKeep->elements[0]->supplementalId = 0;
+        notToKeep->elements[0]->correlationInfo = 0;
+        notToKeep->elements[0]->record = record_this;
     }
     else
     {
-       Z_IUOriginPartToKeep *toKeep;
-       Z_IUSuppliedRecords *notToKeep;
-
-       r->which = Z_External_update;
-       r->u.update = (Z_IUUpdate *) odr_malloc(out, sizeof(*r->u.update));
-       r->u.update->which = Z_IUUpdate_esRequest;
-       r->u.update->u.esRequest = (Z_IUUpdateEsRequest *)
-           odr_malloc(out, sizeof(*r->u.update->u.esRequest));
-       toKeep = r->u.update->u.esRequest->toKeep = (Z_IUOriginPartToKeep *)
-           odr_malloc(out, sizeof(*r->u.update->u.esRequest->toKeep));
-       
-       toKeep->databaseName = databaseNames[0];
-       toKeep->schema = 0;
-       toKeep->elementSetName = 0;
-       toKeep->actionQualifier = 0;
-       toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
-       *toKeep->action = action_no;
-
-       notToKeep = r->u.update->u.esRequest->notToKeep = (Z_IUSuppliedRecords *)
-           odr_malloc(out, sizeof(*r->u.update->u.esRequest->notToKeep));
-       notToKeep->num = 1;
-       notToKeep->elements = (Z_IUSuppliedRecords_elem **)
-           odr_malloc(out, sizeof(*notToKeep->elements));
-       notToKeep->elements[0] = (Z_IUSuppliedRecords_elem *)
-           odr_malloc(out, sizeof(**notToKeep->elements));
-       notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
-       if (*recid)
-       {
-           notToKeep->elements[0]->u.opaque = (Odr_oct *)
-               odr_malloc (out, sizeof(Odr_oct));
-           notToKeep->elements[0]->u.opaque->buf = (unsigned char *) recid;
-           notToKeep->elements[0]->u.opaque->size = strlen(recid);
-           notToKeep->elements[0]->u.opaque->len = strlen(recid);
-       }
-       else
-           notToKeep->elements[0]->u.opaque = 0;
-       notToKeep->elements[0]->supplementalId = 0;
-       notToKeep->elements[0]->correlationInfo = 0;
-       notToKeep->elements[0]->record = record_this;
+        Z_IUOriginPartToKeep *toKeep;
+        Z_IUSuppliedRecords *notToKeep;
+
+        r->which = Z_External_update;
+        r->u.update = (Z_IUUpdate *) odr_malloc(out, sizeof(*r->u.update));
+        r->u.update->which = Z_IUUpdate_esRequest;
+        r->u.update->u.esRequest = (Z_IUUpdateEsRequest *)
+            odr_malloc(out, sizeof(*r->u.update->u.esRequest));
+        toKeep = r->u.update->u.esRequest->toKeep = (Z_IUOriginPartToKeep *)
+            odr_malloc(out, sizeof(*r->u.update->u.esRequest->toKeep));
+        
+        toKeep->databaseName = databaseNames[0];
+        toKeep->schema = 0;
+        toKeep->elementSetName = 0;
+        toKeep->actionQualifier = 0;
+        toKeep->action = (int *) odr_malloc(out, sizeof(*toKeep->action));
+        *toKeep->action = action_no;
+
+        notToKeep = r->u.update->u.esRequest->notToKeep = (Z_IUSuppliedRecords *)
+            odr_malloc(out, sizeof(*r->u.update->u.esRequest->notToKeep));
+        notToKeep->num = 1;
+        notToKeep->elements = (Z_IUSuppliedRecords_elem **)
+            odr_malloc(out, sizeof(*notToKeep->elements));
+        notToKeep->elements[0] = (Z_IUSuppliedRecords_elem *)
+            odr_malloc(out, sizeof(**notToKeep->elements));
+        notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
+        if (*recid)
+        {
+            notToKeep->elements[0]->u.opaque = (Odr_oct *)
+                odr_malloc (out, sizeof(Odr_oct));
+            notToKeep->elements[0]->u.opaque->buf = (unsigned char *) recid;
+            notToKeep->elements[0]->u.opaque->size = strlen(recid);
+            notToKeep->elements[0]->u.opaque->len = strlen(recid);
+        }
+        else
+            notToKeep->elements[0]->u.opaque = 0;
+        notToKeep->elements[0]->supplementalId = 0;
+        notToKeep->elements[0]->correlationInfo = 0;
+        notToKeep->elements[0]->record = record_this;
     }
     
     send_apdu(apdu);
@@ -2328,25 +2328,25 @@ static int cmd_xmles(const char *arg)
     sscanf(arg, "%50s%n", oid_str, &noread);
     if (noread == 0)
     {
-       printf("Missing OID for xmles\n");
-       return 0;
+        printf("Missing OID for xmles\n");
+        return 0;
     }
     arg += noread;
     oid_value_xmles  = oid_getvalbyname(oid_str);
     if (oid_value_xmles == VAL_NONE)
     {
-       printf("Bad OID: %s\n", oid_str);
-       return 0;
+        printf("Bad OID: %s\n", oid_str);
+        return 0;
     }
 
     if (parse_cmd_doc(&arg, out, (char **) &ext->u.single_ASN1_type->buf,
-                     &ext->u.single_ASN1_type->len, 0) == 0)
-       return 0;
+                      &ext->u.single_ASN1_type->len, 0) == 0)
+        return 0;
     req->packageType = yaz_oidval_to_z3950oid(out, CLASS_EXTSERV,
-                                             oid_value_xmles);
+                                              oid_value_xmles);
 
     ext->direct_reference = yaz_oidval_to_z3950oid(out, CLASS_EXTSERV,
-                                                  oid_value_xmles);
+                                                   oid_value_xmles);
     send_apdu(apdu);
 
     return 2;
@@ -2358,7 +2358,7 @@ static int cmd_itemorder(const char *arg)
     int itemno;
    
     if (only_z3950())
-       return 0;
+        return 0;
     if (sscanf (arg, "%10s %d", type, &itemno) != 2)
         return 0;
 
@@ -2376,9 +2376,9 @@ static void show_opt(const char *arg, void *clientData)
 static int cmd_zversion(const char *arg)
 {
     if (*arg && arg)
-       z3950_version = atoi(arg);
+        z3950_version = atoi(arg);
     else
-       printf ("version is %d\n", z3950_version);
+        printf ("version is %d\n", z3950_version);
     return 0;
 }
 
@@ -2386,16 +2386,16 @@ static int cmd_options(const char *arg)
 {
     if (*arg)
     {
-       int r;
-       int pos;
-       r = yaz_init_opt_encode(&z3950_options, arg, &pos);
-       if (r == -1)
-           printf("Unknown option(s) near %s\n", arg+pos);
+        int r;
+        int pos;
+        r = yaz_init_opt_encode(&z3950_options, arg, &pos);
+        if (r == -1)
+            printf("Unknown option(s) near %s\n", arg+pos);
     }
     else
     {
-       yaz_init_opt_decode(&z3950_options, show_opt, 0);
-       printf ("\n");
+        yaz_init_opt_decode(&z3950_options, show_opt, 0);
+        printf ("\n");
     }
     return 0;
 }
@@ -2403,22 +2403,22 @@ static int cmd_options(const char *arg)
 static int cmd_explain(const char *arg)
 {
     if (protocol != PROTO_HTTP)
-       return 0;
+        return 0;
 #if HAVE_XML2
     if (!conn)
-       cmd_open(0);
+        cmd_open(0);
     if (conn)
     {
-       Z_SRW_PDU *sr = 0;
-       
-       setno = 1;
-       
-       /* save this for later .. when fetching individual records */
-       sr = yaz_srw_get(out, Z_SRW_explain_request);
-       if (recordsyntax == VAL_TEXT_XML)
+        Z_SRW_PDU *sr = 0;
+        
+        setno = 1;
+        
+        /* save this for later .. when fetching individual records */
+        sr = yaz_srw_get(out, Z_SRW_explain_request);
+        if (recordsyntax == VAL_TEXT_XML)
             sr->u.explain_request->recordPacking = "xml";
-       send_srw(sr);
-       return 2;
+        send_srw(sr);
+        return 2;
     }
 #endif
     return 0;
@@ -2449,8 +2449,8 @@ static int cmd_find(const char *arg)
 #if HAVE_XML2
         if (!conn)
             cmd_open(0);
-       if (!conn)
-           return 0;
+        if (!conn)
+            return 0;
         if (!send_SRW_searchRequest(arg))
             return 0;
 #else
@@ -2463,7 +2463,7 @@ static int cmd_find(const char *arg)
         {
             try_reconnect(); 
             
-            if (!conn) {                                       
+            if (!conn) {                                        
                 printf("Not connected yet\n");
                 return 0;
             }
@@ -2482,7 +2482,7 @@ static int cmd_delete(const char *arg)
         return 0;
     }
     if (only_z3950())
-       return 0;
+        return 0;
     if (!send_deleteResultSetRequest(arg))
         return 0;
     return 2;
@@ -2498,7 +2498,7 @@ static int cmd_ssub(const char *arg)
 static int cmd_lslb(const char *arg)
 {
     if (only_z3950())
-       return 0;
+        return 0;
     if (!(largeSetLowerBound = atoi(arg)))
         return 0;
     return 1;
@@ -2507,7 +2507,7 @@ static int cmd_lslb(const char *arg)
 static int cmd_mspn(const char *arg)
 {
     if (only_z3950())
-       return 0;
+        return 0;
     if (!(mediumSetPresentNumber = atoi(arg)))
         return 0;
     return 1;
@@ -2600,13 +2600,13 @@ static int send_presentRequest(const char *arg)
         compo.u.complex->generic->which = Z_Schema_oid;
 
         compo.u.complex->generic->schema.oid =
-           yaz_str_to_z3950oid(out, CLASS_SCHEMA, record_schema);
+            yaz_str_to_z3950oid(out, CLASS_SCHEMA, record_schema);
 
         if (!compo.u.complex->generic->schema.oid)
         {
             /* OID wasn't a schema! Try record syntax instead. */
             compo.u.complex->generic->schema.oid = (Odr_oid *)
-               yaz_str_to_z3950oid(out, CLASS_RECSYN, record_schema);
+                yaz_str_to_z3950oid(out, CLASS_RECSYN, record_schema);
         }
         if (!elementSetNames)
             compo.u.complex->generic->elementSpec = 0;
@@ -2705,8 +2705,8 @@ static int cmd_show(const char *arg)
 #if HAVE_XML2
         if (!conn)
             cmd_open(0);
-       if (!conn)
-           return 0;
+        if (!conn)
+            return 0;
         if (!send_SRW_presentRequest(arg))
             return 0;
 #else
@@ -2747,10 +2747,10 @@ int cmd_cancel(const char *arg)
         return 0;
     }
     if (only_z3950())
-       return 0;
+        return 0;
     if (session_initResponse &&
-       !ODR_MASK_GET(session_initResponse->options,
-                     Z_Options_triggerResourceCtrl))
+        !ODR_MASK_GET(session_initResponse->options,
+                      Z_Options_triggerResourceCtrl))
     {
         printf("Target doesn't support cancel (trigger resource ctrl)\n");
         return 0;
@@ -2769,7 +2769,7 @@ int cmd_cancel_find(const char *arg) {
     int fres;
     fres=cmd_find(arg);
     if( fres > 0 ) {
-       return cmd_cancel("");
+        return cmd_cancel("");
     };
     return fres;
 }
@@ -2780,7 +2780,7 @@ int send_scanrequest(const char *query, int pp, int num, const char *term)
     Z_ScanRequest *req = apdu->u.scanRequest;
     
     if (only_z3950())
-       return 0;
+        return 0;
     if (queryType == QueryType_CCL2RPN)
     {
         int error, pos;
@@ -2793,7 +2793,7 @@ int send_scanrequest(const char *query, int pp, int num, const char *term)
             return -1;
         }
         req->attributeSet =
-           yaz_oidval_to_z3950oid(out, CLASS_ATTSET, VAL_BIB1);
+            yaz_oidval_to_z3950oid(out, CLASS_ATTSET, VAL_BIB1);
         if (!(req->termListAndStartPoint = ccl_scan_query (out, rpn)))
         {
             printf("Couldn't convert CCL to Scan term\n");
@@ -2850,7 +2850,7 @@ int send_sortrequest(const char *arg, int newset)
     char setstring[32];
 
     if (only_z3950())
-       return 0;
+        return 0;
     if (setnumber >= 0)
         sprintf (setstring, "%d", setnumber);
     else
@@ -2974,9 +2974,9 @@ int cmd_sort_generic(const char *arg, int newset)
         return 0;
     }
     if (only_z3950())
-       return 0;
+        return 0;
     if (session_initResponse && 
-       !ODR_MASK_GET(session_initResponse->options, Z_Options_sort))
+        !ODR_MASK_GET(session_initResponse->options, Z_Options_sort))
     {
         printf("Target doesn't support sort\n");
         return 0;
@@ -3029,52 +3029,52 @@ int cmd_scan(const char *arg)
 #if HAVE_XML2
         if (!conn)
             cmd_open(0);
-       if (!conn)
-           return 0;
-       if (*arg)
-       {
-           if (send_SRW_scanRequest(arg, scan_position, scan_size) < 0)
-               return 0;
-       }
-       else
-       {
-           if (send_SRW_scanRequest(last_scan_line, 1, scan_size) < 0)
-               return 0;
-       }
-       return 2;
+        if (!conn)
+            return 0;
+        if (*arg)
+        {
+            if (send_SRW_scanRequest(arg, scan_position, scan_size) < 0)
+                return 0;
+        }
+        else
+        {
+            if (send_SRW_scanRequest(last_scan_line, 1, scan_size) < 0)
+                return 0;
+        }
+        return 2;
 #else
         return 0;
 #endif
     }
     else
     {
-       if (!conn)
-       {
-           try_reconnect();
-           
-           if (!conn) {                                                                
-               printf("Session not initialized yet\n");
-               return 0;
-           }
-       }
-       if (session_initResponse && 
-           !ODR_MASK_GET(session_initResponse->options, Z_Options_scan))
-       {
-           printf("Target doesn't support scan\n");
-           return 0;
-       }
-       if (*arg)
-       {
-           strcpy (last_scan_query, arg);
-           if (send_scanrequest(arg, scan_position, scan_size, 0) < 0)
-               return 0;
-       }
-       else
-       {
-           if (send_scanrequest(last_scan_query, 1, scan_size, last_scan_line) < 0)
-               return 0;
-       }
-       return 2;
+        if (!conn)
+        {
+            try_reconnect();
+            
+            if (!conn) {                                                                
+                printf("Session not initialized yet\n");
+                return 0;
+            }
+        }
+        if (session_initResponse && 
+            !ODR_MASK_GET(session_initResponse->options, Z_Options_scan))
+        {
+            printf("Target doesn't support scan\n");
+            return 0;
+        }
+        if (*arg)
+        {
+            strcpy (last_scan_query, arg);
+            if (send_scanrequest(arg, scan_position, scan_size, 0) < 0)
+                return 0;
+        }
+        else
+        {
+            if (send_scanrequest(last_scan_query, 1, scan_size, last_scan_line) < 0)
+                return 0;
+        }
+        return 2;
     }
 }
 
@@ -3181,7 +3181,7 @@ int cmd_close(const char *arg)
     if (!conn)
         return 0;
     if (only_z3950())
-       return 0;
+        return 0;
 
     apdu = zget_APDU(out, Z_APDU_close);
     req = apdu->u.close;
@@ -3217,7 +3217,7 @@ int cmd_marccharset(const char *arg)
     *l1 = 0;
     if (sscanf(arg, "%29s", l1) < 1)
     {
-       printf("MARC character set is `%s'\n", 
+        printf("MARC character set is `%s'\n", 
                marcCharset ? marcCharset: "none");
         return 1;
     }
@@ -3235,7 +3235,7 @@ int cmd_displaycharset(const char *arg)
     *l1 = 0;
     if (sscanf(arg, "%29s", l1) < 1)
     {
-       printf("Display character set is `%s'\n", 
+        printf("Display character set is `%s'\n", 
                outputCharset ? outputCharset: "none");
     }
     else
@@ -3264,23 +3264,23 @@ int cmd_negcharset(const char *arg)
 
     *l1 = 0;
     if (sscanf(arg, "%29s %d %d", l1, &negotiationCharsetRecords,
-              &negotiationCharsetVersion) < 1)
+               &negotiationCharsetVersion) < 1)
     {
-       printf("Current negotiation character set is `%s'\n", 
+        printf("Current negotiation character set is `%s'\n", 
                negotiationCharset ? negotiationCharset: "none");  
-       printf("Records in charset %s\n", negotiationCharsetRecords ? 
-              "yes" : "no");
-       printf("Charneg version %d\n", negotiationCharsetVersion);
+        printf("Records in charset %s\n", negotiationCharsetRecords ? 
+               "yes" : "no");
+        printf("Charneg version %d\n", negotiationCharsetVersion);
     }
     else
     {
-       xfree (negotiationCharset);
-       negotiationCharset = NULL;
-       if (*l1 && strcmp(l1, "-") && strcmp(l1, "none"))
-       {
-           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);
+        }
     }
     return 1;
 }
@@ -3292,17 +3292,17 @@ int cmd_charset(const char* arg)
     *l1 = *l2 = *l3 = 0;
     if (sscanf(arg, "%29s %29s %29s", l1, l2, l3) < 1)
     {
-       cmd_negcharset("");
-       cmd_displaycharset("");
-       cmd_marccharset("");
+        cmd_negcharset("");
+        cmd_displaycharset("");
+        cmd_marccharset("");
     }
     else
     {
-       cmd_negcharset(l1);
-       if (*l2)
-           cmd_displaycharset(l2);
-       if (*l3)
-           cmd_marccharset(l3);
+        cmd_negcharset(l1);
+        if (*l2)
+            cmd_displaycharset(l2);
+        if (*l3)
+            cmd_marccharset(l3);
     }
     return 1;
 }
@@ -3310,8 +3310,8 @@ int cmd_charset(const char* arg)
 int cmd_lang(const char* arg)
 {
     if (*arg == '\0') {
-       printf("Current language is `%s'\n", (yazLang)?yazLang:NULL);
-       return 1;
+        printf("Current language is `%s'\n", (yazLang)?yazLang:NULL);
+        return 1;
     }
     xfree (yazLang);
     yazLang = NULL;
@@ -3347,10 +3347,10 @@ int cmd_source(const char* arg, int echo )
         
         if ((cp = strrchr (line, '\n')))
             *cp = '\0';
-       
-       if( echo ) {
-           printf( "processing line: %s\n",line );
-       };
+        
+        if( echo ) {
+            printf( "processing line: %s\n",line );
+        };
         process_cmd_line(line);
     }
     
@@ -3440,10 +3440,10 @@ int cmd_set_cqlfile(const char* arg)
 
     if ((newcqltrans = cql_transform_open_fname(arg)) == 0) {
         perror("unable to open CQL file");
-       return 0;
+        return 0;
     }
     if (cqltrans != 0)
-       cql_transform_close(cqltrans);
+        cql_transform_close(cqltrans);
 
     cqltrans = newcqltrans;
     strcpy(cql_fields, arg);
@@ -3457,7 +3457,7 @@ int cmd_set_auto_reconnect(const char* arg)
     } else if(strcmp(arg,"on")==0) {
         auto_reconnect = 1;
     } else if(strcmp(arg,"off")==0) {
-        auto_reconnect = 0;            
+        auto_reconnect = 0;             
     } else {
         printf("Error use on or off\n");
         return 1;
@@ -3479,7 +3479,7 @@ int cmd_set_auto_wait(const char* arg)
     } else if(strcmp(arg,"on")==0) {
         auto_wait = 1;
     } else if(strcmp(arg,"off")==0) {
-        auto_wait = 0;         
+        auto_wait = 0;          
     } else {
         printf("Error use on or off\n");
         return 1;
@@ -3583,7 +3583,7 @@ int cmd_register_oid(const char* args) {
     oid[i+1] = -1;
     
     new_oident = oid_addent (oid, PROTO_GENERAL, oidclass, oname_str,
-                            VAL_DYNAMIC);  
+                             VAL_DYNAMIC);  
     if(strcmp(new_oident->desc,oname_str))
     {
         fprintf(stderr,"oid is already named as %s, registration failed\n",
@@ -3611,13 +3611,13 @@ void source_rcfile()
     char* homedir=getenv("HOME");
 
     if( homedir ) {
-       
-       sprintf(buffer,"%s/.yazclientrc",homedir);
+        
+        sprintf(buffer,"%s/.yazclientrc",homedir);
 
-       if(stat(buffer,&statbuf)==0) {
-           cmd_source(buffer, 0 );
-       }
-       
+        if(stat(buffer,&statbuf)==0) {
+            cmd_source(buffer, 0 );
+        }
+        
     };
     
     if(stat(".yazclientrc",&statbuf)==0) {
@@ -3677,20 +3677,20 @@ static void handle_srw_record(Z_SRW_record *rec)
 {
     if (rec->recordPosition)
     {
-       printf ("pos=%d", *rec->recordPosition);
-       setno = *rec->recordPosition + 1;
+        printf ("pos=%d", *rec->recordPosition);
+        setno = *rec->recordPosition + 1;
     }
     if (rec->recordSchema)
-       printf (" schema=%s", rec->recordSchema);
+        printf (" schema=%s", rec->recordSchema);
     printf ("\n");
     if (rec->recordData_buf && rec->recordData_len)
     {
-       fwrite(rec->recordData_buf, 1, rec->recordData_len, stdout);
-       if (marc_file)
-           fwrite (rec->recordData_buf, 1, rec->recordData_len, marc_file);
+        fwrite(rec->recordData_buf, 1, rec->recordData_len, stdout);
+        if (marc_file)
+            fwrite (rec->recordData_buf, 1, rec->recordData_len, marc_file);
     }
     else
-       printf ("No data!");
+        printf ("No data!");
     printf("\n");
 }
 
@@ -3707,36 +3707,36 @@ static void handle_srw_response(Z_SRW_searchRetrieveResponse *res)
     
     for (i = 0; i<res->num_diagnostics; i++)
     {
-       if (res->diagnostics[i].uri)
-           printf ("SRW diagnostic %s\n",
-                   res->diagnostics[i].uri);
-       else
-           printf ("SRW diagnostic missing or could not be decoded\n");
-       if (res->diagnostics[i].message)
+        if (res->diagnostics[i].uri)
+            printf ("SRW diagnostic %s\n",
+                    res->diagnostics[i].uri);
+        else
+            printf ("SRW diagnostic missing or could not be decoded\n");
+        if (res->diagnostics[i].message)
             printf ("Message: %s\n", res->diagnostics[i].message);
-       if (res->diagnostics[i].details)
+        if (res->diagnostics[i].details)
             printf ("Details: %s\n", res->diagnostics[i].details);
     }
     if (res->numberOfRecords)
         printf ("Number of hits: %d\n", *res->numberOfRecords);
     for (i = 0; i<res->num_records; i++)
-       handle_srw_record(res->records + i);
+        handle_srw_record(res->records + i);
 }
 
 static void handle_srw_scan_term(Z_SRW_scanTerm *term)
 {
     if (term->displayTerm)
-       printf("%s:", term->displayTerm);
+        printf("%s:", term->displayTerm);
     else if (term->value)
-       printf("%s:", term->value);
+        printf("%s:", term->value);
     else
-       printf("No value:");
+        printf("No value:");
     if (term->numberOfRecords)
-       printf(" %d", *term->numberOfRecords);
+        printf(" %d", *term->numberOfRecords);
     if (term->whereInList)
-       printf(" %s", term->whereInList);
+        printf(" %s", term->whereInList);
     if (term->value && term->displayTerm)
-       printf(" %s", term->value);
+        printf(" %s", term->value);
 
     strcpy(last_scan_line, term->value);
     printf("\n");
@@ -3750,19 +3750,19 @@ static void handle_srw_scan_response(Z_SRW_scanResponse *res)
     
     for (i = 0; i<res->num_diagnostics; i++)
     {
-       if (res->diagnostics[i].uri)
-           printf ("SRW diagnostic %s\n",
-                   res->diagnostics[i].uri);
-       else
-           printf ("SRW diagnostic missing or could not be decoded\n");
-       if (res->diagnostics[i].message)
+        if (res->diagnostics[i].uri)
+            printf ("SRW diagnostic %s\n",
+                    res->diagnostics[i].uri);
+        else
+            printf ("SRW diagnostic missing or could not be decoded\n");
+        if (res->diagnostics[i].message)
             printf ("Message: %s\n", res->diagnostics[i].message);
-       if (res->diagnostics[i].details)
+        if (res->diagnostics[i].details)
             printf ("Details: %s\n", res->diagnostics[i].details);
     }
     if (res->terms)
-       for (i = 0; i<res->num_terms; i++)
-           handle_srw_scan_term(res->terms + i);
+        for (i = 0; i<res->num_terms; i++)
+            handle_srw_scan_term(res->terms + i);
 }
 
 static void http_response(Z_HTTP_Response *hres)
@@ -3805,9 +3805,9 @@ static void http_response(Z_HTTP_Response *hres)
                     soap_package->u.fault->fault_code);
             printf ("SOAP Fault string %s\n", 
                     soap_package->u.fault->fault_string);
-           if (soap_package->u.fault->details)
-               printf ("SOAP Details %s\n", 
-                       soap_package->u.fault->details);
+            if (soap_package->u.fault->details)
+                printf ("SOAP Details %s\n", 
+                        soap_package->u.fault->details);
         }
         else
             ret = -1;
@@ -3817,7 +3817,7 @@ static void http_response(Z_HTTP_Response *hres)
     {
         if (hres->code != 200)
         {
-           printf ("HTTP Error Status=%d\n", hres->code);
+            printf ("HTTP Error Status=%d\n", hres->code);
         }
         else
         {
@@ -3827,18 +3827,18 @@ static void http_response(Z_HTTP_Response *hres)
     }
     else
     {
-       if (!strcmp(hres->version, "1.0"))
-       {
-           /* HTTP 1.0: only if Keep-Alive we stay alive.. */
-           if (!connection_head || strcmp(connection_head, "Keep-Alive"))
-               close_session();
-       }
-       else 
-       {
-           /* HTTP 1.1: only if no close we stay alive .. */
-           if (connection_head && !strcmp(connection_head, "close"))
-               close_session();
-       }
+        if (!strcmp(hres->version, "1.0"))
+        {
+            /* HTTP 1.0: only if Keep-Alive we stay alive.. */
+            if (!connection_head || strcmp(connection_head, "Keep-Alive"))
+                close_session();
+        }
+        else 
+        {
+            /* HTTP 1.1: only if no close we stay alive .. */
+            if (connection_head && !strcmp(connection_head, "close"))
+                close_session();
+        }
     }
 }
 #endif
@@ -3871,7 +3871,7 @@ void wait_and_handle_response(int one_response_only)
                 
                 buf_out = odr_getbuf(out, &len_out, 0);
                 
-               do_hex_dump(buf_out, len_out);
+                do_hex_dump(buf_out, len_out);
 
                 cs_put(conn, buf_out, len_out);
                 
@@ -3886,9 +3886,9 @@ void wait_and_handle_response(int one_response_only)
             break;
         }
 #if HAVE_GETTIMEOFDAY
-       if (got_tv_end == 0)
-           gettimeofday (&tv_end, 0); /* count first one only */
-       got_tv_end++;
+        if (got_tv_end == 0)
+            gettimeofday (&tv_end, 0); /* count first one only */
+        got_tv_end++;
 #endif
         odr_reset(out);
         odr_reset(in); /* release APDU from last round */
@@ -3905,13 +3905,13 @@ void wait_and_handle_response(int one_response_only)
             odr_dumpBER(f, netbuffer, res);
             fprintf(f, "---------\n");
             if (apdu_file)
-           {
+            {
                 z_GDU(print, &gdu, 0, 0);
-               odr_reset(print);
-           }
+                odr_reset(print);
+            }
             if (conn && cs_more(conn))
                 continue;
-           break;
+            break;
         }
         if (ber_file)
             odr_dumpBER(ber_file, netbuffer, res);
@@ -3977,8 +3977,8 @@ void wait_and_handle_response(int one_response_only)
             http_response(gdu->u.HTTP_Response);
         }
 #endif
-       if (one_response_only)
-           break;
+        if (one_response_only)
+            break;
         if (conn && !cs_more(conn))
             break;
     }
@@ -4016,7 +4016,7 @@ int cmd_cclparse(const char* arg)
     else
     {
         if (rpn)
-        {      
+        {       
             ccl_pr_tree(rpn, stdout); 
         }
     }
@@ -4041,11 +4041,11 @@ int cmd_set_otherinfo(const char* args)
         /* reset this otherinfo */
         if(otherinfoNo>=maxOtherInfosSupported) {
             printf("Error otherinfo index to large (%d>%d)\n",
-                  otherinfoNo,maxOtherInfosSupported);
+                   otherinfoNo,maxOtherInfosSupported);
         }
         extraOtherInfos[otherinfoNo].oidval = -1;
         if (extraOtherInfos[otherinfoNo].value)
-           free(extraOtherInfos[otherinfoNo].value);                   
+            free(extraOtherInfos[otherinfoNo].value);                   
         return 0;
     }
     if (sscan_res<3) {
@@ -4055,7 +4055,7 @@ int cmd_set_otherinfo(const char* args)
     
     if (otherinfoNo>=maxOtherInfosSupported) {
         printf("Error otherinfo index to large (%d>%d)\n",
-              otherinfoNo,maxOtherInfosSupported);
+               otherinfoNo,maxOtherInfosSupported);
     }
     
     oidval = oid_getvalbyname (oidstr);
@@ -4075,18 +4075,18 @@ int cmd_sleep(const char* args )
     int sec=atoi(args);
     if( sec > 0 ) {
 #ifdef WIN32
-       Sleep(sec*1000);
+        Sleep(sec*1000);
 #else
-       sleep(sec);
+        sleep(sec);
 #endif
-       printf("Done sleeping %d seconds\n", sec);      
+        printf("Done sleeping %d seconds\n", sec);      
     }
     return 1;    
 }
 
 int cmd_list_otherinfo(const char* args)
 {
-    int i;        
+    int i;         
     
     if(strlen(args)>0) {
         i = atoi(args);
@@ -4103,7 +4103,7 @@ int cmd_list_otherinfo(const char* args)
                        CLASS_RECSYN),
                    extraOtherInfos[i].value);
         
-    } else {           
+    } else {            
         for(i=0; i<maxOtherInfosSupported; ++i) {
             if(extraOtherInfos[i].oidval != -1) 
                 printf("  otherinfo %d %s %s\n",
@@ -4132,7 +4132,7 @@ int cmd_list_all(const char* args) {
             printf("Not connected        : \n");
         
     }
-    if(yazProxy) printf("using proxy          : %s\n",yazProxy);               
+    if(yazProxy) printf("using proxy          : %s\n",yazProxy);                
     
     printf("auto_reconnect       : %s\n",auto_reconnect?"on":"off");
     printf("auto_wait            : %s\n",auto_wait?"on":"off");
@@ -4148,8 +4148,8 @@ int cmd_list_all(const char* args) {
             printf("    Password         : %s\n",auth->u.idPass->password?auth->u.idPass->password:"");
             break;
         case Z_IdAuthentication_open:
-            printf("Authentication       : psOpen\n");                 
-            printf("    Open string      : %s\n",auth->u.open);        
+            printf("Authentication       : psOpen\n");                  
+            printf("    Open string      : %s\n",auth->u.open); 
             break;
         default:
             printf("Authentication       : Unknown\n");
@@ -4199,16 +4199,16 @@ int cmd_clear_otherinfo(const char* args)
             return 0;
         }
         
-        if(extraOtherInfos[otherinfoNo].oidval != -1) {                        
+        if(extraOtherInfos[otherinfoNo].oidval != -1) {                 
             /* only clear if set. */
             extraOtherInfos[otherinfoNo].oidval=-1;
             free(extraOtherInfos[otherinfoNo].value);
         }
     } else {
         int i;
-       
+        
         for(i=0; i<maxOtherInfosSupported; ++i) {
-            if (extraOtherInfos[i].oidval!=-1 ) {                              
+            if (extraOtherInfos[i].oidval!=-1 ) {                               
                 extraOtherInfos[i].oidval=-1;
                 free(extraOtherInfos[i].value);
             }
@@ -4222,11 +4222,11 @@ int cmd_wait_response(const char *arg)
     int wait_for = atoi(arg);
     int i=0;
     if( wait_for < 1 ) {
-       wait_for = 1;
+        wait_for = 1;
     };
     
     for( i=0 ; i < wait_for ; ++i ) {
-       wait_and_handle_response(1);
+        wait_and_handle_response(1);
     };
     return 0;
 }
@@ -4239,7 +4239,7 @@ static struct {
     char *cmd;
     int (*fun)(const char *arg);
     char *ad;
-       completerFunctionType rl_completerfunction;
+        completerFunctionType rl_completerfunction;
     int complete_filenames;
     char **local_tabcompletes;
 } cmd_array[] = {
@@ -4340,7 +4340,7 @@ static int cmd_help (const char *line)
         printf(" @or opl opr                   Or\n");
         printf(" @not opl opr                  And-Not\n");
         printf(" @set set                      Result set\n");
-       printf(" @prox exl dist ord rel uc ut  Proximity. Use help prox\n");
+        printf(" @prox exl dist ord rel uc ut  Proximity. Use help prox\n");
         printf("\n");
         printf("Bib-1 attribute types\n");
         printf("1=Use:         ");
@@ -4358,27 +4358,27 @@ static int cmd_help (const char *line)
     }
     if (!strcmp(topic, "prox"))
     {
-       printf("Proximity:\n");
-       printf(" @prox exl dist ord rel uc ut\n");
-       printf(" exl:  exclude flag . 0=include, 1=exclude.\n");
-       printf(" dist: distance integer.\n");
-       printf(" ord:  order flag. 0=unordered, 1=ordered.\n");
-       printf(" rel:  relation integer. 1<  2<=  3= 4>=  5>  6!= .\n");
-       printf(" uc:   unit class. k=known, p=private.\n");
-       printf(" ut:   unit type. 1=character, 2=word, 3=sentence,\n");
-       printf("        4=paragraph, 5=section, 6=chapter, 7=document,\n");
-       printf("        8=element, 9=subelement, 10=elementType, 11=byte.\n");
-       printf("\nExamples:\n");
-       printf(" Search for a and b in-order at most 3 words apart:\n");
-       printf("  @prox 0 3 1 2 k 2 a b\n");
-       printf(" Search for any order of a and b next to each other:\n");
-       printf("  @prox 0 1 0 3 k 2 a b\n");
+        printf("Proximity:\n");
+        printf(" @prox exl dist ord rel uc ut\n");
+        printf(" exl:  exclude flag . 0=include, 1=exclude.\n");
+        printf(" dist: distance integer.\n");
+        printf(" ord:  order flag. 0=unordered, 1=ordered.\n");
+        printf(" rel:  relation integer. 1<  2<=  3= 4>=  5>  6!= .\n");
+        printf(" uc:   unit class. k=known, p=private.\n");
+        printf(" ut:   unit type. 1=character, 2=word, 3=sentence,\n");
+        printf("        4=paragraph, 5=section, 6=chapter, 7=document,\n");
+        printf("        8=element, 9=subelement, 10=elementType, 11=byte.\n");
+        printf("\nExamples:\n");
+        printf(" Search for a and b in-order at most 3 words apart:\n");
+        printf("  @prox 0 3 1 2 k 2 a b\n");
+        printf(" Search for any order of a and b next to each other:\n");
+        printf("  @prox 0 1 0 3 k 2 a b\n");
     }
     return 1;
 }
 
 int cmd_register_tab(const char* arg) {
-       
+        
     char command[101], tabargument[101];
     int i;
     int num_of_tabs;
@@ -4404,7 +4404,7 @@ int cmd_register_tab(const char* arg) {
     if(!cmd_array[i].local_tabcompletes)
         cmd_array[i].local_tabcompletes = (char **) calloc(1,sizeof(char**));
     
-    num_of_tabs=0;             
+    num_of_tabs=0;              
     
     tabslist = cmd_array[i].local_tabcompletes;
     for(;tabslist && *tabslist;tabslist++) {
@@ -4500,8 +4500,8 @@ char *command_generator(const char *text, int state)
 char ** readline_completer(char *text, int start, int end) {
 #if HAVE_READLINE_READLINE_H
 
-       completerFunctionType completerToUse;
-       
+        completerFunctionType completerToUse;
+        
     if(start == 0) {
 #if HAVE_READLINE_RL_COMPLETION_MATCHES
         char** res=rl_completion_matches(text,
@@ -4607,7 +4607,7 @@ static void show_version(void)
     yaz_version(vstr, 0);
     printf ("YAZ version: %s\n", YAZ_VERSION);
     if (strcmp(vstr, YAZ_VERSION))
-       printf ("YAZ DLL/SO: %s\n", vstr);
+        printf ("YAZ DLL/SO: %s\n", vstr);
     exit(0);
 }
 
@@ -4629,7 +4629,7 @@ int main(int argc, char **argv)
 #endif
 #endif
     if (codeset)
-       outputCharset = xstrdup(codeset);
+        outputCharset = xstrdup(codeset);
     
     ODR_MASK_SET(&z3950_options, Z_Options_search);
     ODR_MASK_SET(&z3950_options, Z_Options_present);
@@ -4651,16 +4651,16 @@ int main(int argc, char **argv)
                 strcpy (open_command, "open ");
                 strcat (open_command, arg);
             }
-           else
-           {
-               fprintf(stderr, "%s: Specify at most one server address\n",
-                       prog);
-               exit(1);
-           }
+            else
+            {
+                fprintf(stderr, "%s: Specify at most one server address\n",
+                        prog);
+                exit(1);
+            }
+            break;
+        case 'd':
+            dump_file_prefix = arg;
             break;
-       case 'd':
-           dump_file_prefix = arg;
-           break;
         case 'k':
             kilobytes = atoi(arg);
             break;
@@ -4694,9 +4694,9 @@ int main(int argc, char **argv)
             else
                 apdu_file=fopen(arg, "a");
             break;
-       case 'x':
-           hex_dump = 1;
-           break;
+        case 'x':
+            hex_dump = 1;
+            break;
         case 'p':
             yazProxy=strdup(arg);
             break;
@@ -4712,21 +4712,21 @@ int main(int argc, char **argv)
             yaz_log_init(yaz_log_mask_str(arg), "", 0);
             break;
         case 'V':
-           show_version();
+            show_version();
             break;
         default:
             fprintf (stderr, "Usage: %s "
-                    " [-a <apdulog>]"
+                     " [-a <apdulog>]"
                      " [-b berdump]"
-                    " [-d dump]\n"
-                    " [-c cclfields]"
+                     " [-d dump]\n"
+                     " [-c cclfields]"
                      " [-k size]"
-                    " [-m <marclog>]\n" 
-                    " [-p <proxy-addr>]"
-                    " [-q cqlfields]"
-                    " [-u <auth>]"
-                    " [-V]"
-                    " [<server-addr>]\n",
+                     " [-m <marclog>]\n" 
+                     " [-p <proxy-addr>]"
+                     " [-q cqlfields]"
+                     " [-u <auth>]"
+                     " [-V]"
+                     " [<server-addr>]\n",
                      prog);
             exit (1);
         }      
@@ -4757,3 +4757,11 @@ int main(int argc, char **argv)
     client ();
     exit (0);
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 01bb0e0..b748c10 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tabcomplete.c,v 1.11 2005-06-24 19:56:52 adam Exp $
+ * $Id: tabcomplete.c,v 1.12 2005-06-25 15:46:01 adam Exp $
  */
 
 #include <string.h>
@@ -21,7 +21,7 @@ extern char** curret_global_list;
  * ***************************************************************************/
 
 char* complete_from_list(char* completions[], const char *text, int state)
-{      
+{       
     static int idx;
     
     if(!completions) return NULL;
@@ -34,7 +34,7 @@ char* complete_from_list(char* completions[], const char *text, int state)
            _strnicmp
 #else
            strncasecmp
-#endif             
+#endif              
            (completions[idx],text,strlen(text))) {
             ++idx; /* skip this entry on the next run */ 
             return (char*)strdup(completions[idx-1]);
@@ -70,16 +70,16 @@ void oid_loader(struct oident* oid, void* data_)
     
     if((oid->oclass == CLASS_GENERAL) || (oid->oclass == data->oclass)) {
         if(data->index==data->max) {
-                       data->values=(char**)realloc(data->values,((data->max+1)*2)*sizeof(char*));
-                       data->max=(data->max+1)*2 - 1;
+                        data->values=(char**)realloc(data->values,((data->max+1)*2)*sizeof(char*));
+                        data->max=(data->max+1)*2 - 1;
         };
         data->values[data->index]=oid->desc;
-        ++data->index;         
+        ++data->index;          
     }
 }
 
-char** build_list_for_oclass(oid_class oclass) {       
-    oid_callback_t data;       
+char** build_list_for_oclass(oid_class oclass) {        
+    oid_callback_t data;        
     data.values = (char **) calloc(10,sizeof(char*));
     data.index = 0;
     data.max = 9;
@@ -88,7 +88,7 @@ char** build_list_for_oclass(oid_class oclass) {
     oid_trav(oid_loader, &data);
     
     data.values[data.index]=0;
-    return data.values;           
+    return data.values;    
 }
 
 /* ***************************************************************************
@@ -115,7 +115,7 @@ char* complete_format(const char* text, int state)
     char** list=build_list_for_oclass(CLASS_RECSYN);
     char* res=complete_from_list(list,text,state);  
     
-    free(list);        
+    free(list); 
     return res;
 }
 
@@ -124,7 +124,7 @@ char* complete_schema(const char* text, int state)
     char** list=build_list_for_oclass(CLASS_SCHEMA);
     char* res=complete_from_list(list,text,state);  
     
-    free(list);        
+    free(list); 
     return res;
 }
 
@@ -134,7 +134,7 @@ char* complete_attributeset(const char* text, int state)
     char** list=build_list_for_oclass(CLASS_ATTSET);
     char* res=complete_from_list(list,text,state);  
     
-    free(list);        
+    free(list); 
     return res;
 }
 
@@ -144,3 +144,11 @@ char* default_completer(const char* text, int state)
     return complete_from_list(curret_global_list,text,state);
 }
 
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index e8e4841..aff7707 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tabcomplete.h,v 1.5 2005-01-15 19:47:08 adam Exp $
+ * $Id: tabcomplete.h,v 1.6 2005-06-25 15:46:01 adam Exp $
  */
 
 /* 
@@ -15,10 +15,11 @@ char* complete_schema(const char* text, int state);
 char* complete_attributeset(const char* text, int state);
 char* default_completer(const char* text, int state);
 char* complete_auto_reconnect(const char *text, int state);
 /*
  * Local variables:
- * tab-width: 4
  * c-basic-offset: 4
+ * indent-tabs-mode: nil
  * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
  */
+
index c417ad1..b506bc0 100644 (file)
--- a/header.c
+++ b/header.c
@@ -2,7 +2,15 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: header.c,v 1.9 2005-01-15 19:47:08 adam Exp $
+ * $Id: header.c,v 1.10 2005-06-25 15:46:01 adam Exp $
  *
  */
 
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 1d56e06..ef78d7a 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: backend.h,v 1.31 2005-05-20 19:29:18 adam Exp $
+ * $Id: backend.h,v 1.32 2005-06-25 15:46:01 adam Exp $
  */
 
 /** 
@@ -241,7 +241,7 @@ typedef struct bend_initresult
 } bend_initresult;
 
 YAZ_EXPORT void bend_request_send (bend_association a, bend_request req,
-                                  Z_APDU *res);
+                                   Z_APDU *res);
 
 YAZ_EXPORT bend_request bend_request_mk (bend_association a);
 
@@ -305,3 +305,11 @@ YAZ_EXPORT int check_ip_tcpd(void *cd, const char *addr, int len, int type);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index d0a2b09..6296864 100644 (file)
@@ -49,7 +49,7 @@
 /*
  * CCL - header file
  *
- * $Id: ccl.h,v 1.22 2005-04-15 21:47:55 adam Exp $
+ * $Id: ccl.h,v 1.23 2005-06-25 15:46:01 adam Exp $
  *
  * Old Europagate Log:
  *
@@ -124,10 +124,10 @@ struct ccl_rpn_attr {
 #define CCL_RPN_ATTR_NUMERIC 1
 #define CCL_RPN_ATTR_STRING 2
     union {
-       /** numeric attribute value */
-       int numeric;
-       /** string attribute value */
-       char *str;
+        /** numeric attribute value */
+        int numeric;
+        /** string attribute value */
+        char *str;
     } value;
 };
 
@@ -143,15 +143,15 @@ struct ccl_rpn_node {
     /** RPN tree node type */
     int kind;
     union {
-       /** Boolean including proximity 0=left, 2=right, 3=prox parms */
-       struct ccl_rpn_node *p[3];
-       /** Attributes + Term */
-       struct {
-           char *term;
-           struct ccl_rpn_attr *attr_list;
-       } t;
-       /** Result set */
-       char *setname;
+        /** Boolean including proximity 0=left, 2=right, 3=prox parms */
+        struct ccl_rpn_node *p[3];
+        /** Attributes + Term */
+        struct {
+            char *term;
+            struct ccl_rpn_attr *attr_list;
+        } t;
+        /** Result set */
+        char *setname;
     } u;
 };
 
@@ -298,7 +298,7 @@ struct ccl_token *ccl_token_add (struct ccl_token *at);
  */
 YAZ_EXPORT
 struct ccl_rpn_node *ccl_find_str (CCL_bibset bibset,
-                                  const char *str, int *error, int *pos);
+                                   const char *str, int *error, int *pos);
 
 /**
  * Parses CCL Find command from a list of CCL tokens. Otherwise similar to
@@ -354,7 +354,7 @@ void ccl_qual_add (CCL_bibset b, const char *name, int no, int *attr);
 /** Add qualifier and supply attributes pairs+attribute set for it */
 YAZ_EXPORT
 void ccl_qual_add_set (CCL_bibset b, const char *name, int no,
-                      int *type, int *value, char **svalue, char **attsets);
+                       int *type, int *value, char **svalue, char **attsets);
 
 /** Add special qualifier */
 YAZ_EXPORT
@@ -383,7 +383,7 @@ void ccl_qual_line(CCL_bibset bibset, char *line);
 /* Add CCL qualifier by using qual_name + value pair */
 YAZ_EXPORT
 void ccl_qual_fitem (CCL_bibset bibset, const char *value,
-                    const char *qual_name);
+                     const char *qual_name);
 
 /** Make CCL qualifier set */
 YAZ_EXPORT
@@ -407,7 +407,7 @@ int ccl_memicmp (const char *s1, const char *s2, size_t n);
 /** Search for qualifier 'name' in set 'b'. */
 YAZ_EXPORT
 struct ccl_rpn_attr *ccl_qual_search (CCL_parser cclp, const char *name,
-                                     size_t len, int seq);
+                                      size_t len, int seq);
 
 /** Create CCL parser */
 YAZ_EXPORT
@@ -424,7 +424,7 @@ char *ccl_strdup (const char *str);
 /** Search for special qualifier */
 YAZ_EXPORT
 const char *ccl_qual_search_special (CCL_bibset b,
-                                               const char *name);
+                                                const char *name);
 /** Pretty-print CCL RPN node tree to WRBUF */
 YAZ_EXPORT
 void ccl_pquery (WRBUF w, struct ccl_rpn_node *p);
@@ -437,3 +437,11 @@ YAZ_END_CDECL
 
 #endif
 
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index f8815af..8b21d33 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: charneg.h,v 1.6 2005-05-18 12:38:40 adam Exp $
+ * $Id: charneg.h,v 1.7 2005-06-25 15:46:01 adam Exp $
  */
 /** 
  * \file charneg.h
@@ -64,15 +64,15 @@ int yaz_del_charneg_record(Z_OtherInformation **p);
  */
 YAZ_EXPORT
 Z_External *yaz_set_proposal_charneg(ODR odr,
-                                    const char **charsets, int num_charsets,
-                                    const char **langs,
-                                    int num_langs, int selected);
+                                     const char **charsets, int num_charsets,
+                                     const char **langs,
+                                     int num_langs, int selected);
 
 YAZ_EXPORT
 void yaz_get_response_charneg(NMEM mem,
-                             Z_CharSetandLanguageNegotiation *p,
-                             char **charset, char **lang,
-                             int *selected);
+                              Z_CharSetandLanguageNegotiation *p,
+                              char **charset, char **lang,
+                              int *selected);
 
 /*
  * Server's part
@@ -80,16 +80,24 @@ void yaz_get_response_charneg(NMEM mem,
  
 YAZ_EXPORT
 Z_External *yaz_set_response_charneg(ODR odr,
-                                    const char *charset, const char *lang,
-                                    int selected);
+                                     const char *charset, const char *lang,
+                                     int selected);
 
 
 YAZ_EXPORT
 void yaz_get_proposal_charneg(NMEM mem,
-                             Z_CharSetandLanguageNegotiation *p,
-                             char ***charsets, int *num_charsets,
-                             char ***langs, int *num_langs,
-                             int *selected);
+                              Z_CharSetandLanguageNegotiation *p,
+                              char ***charsets, int *num_charsets,
+                              char ***langs, int *num_langs,
+                              int *selected);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index e830c39..b335c86 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: comstack.h,v 1.20 2005-02-01 14:37:47 adam Exp $
+ * $Id: comstack.h,v 1.21 2005-06-25 15:46:01 adam Exp $
  */
 
 /** 
@@ -82,8 +82,8 @@ struct comstack
 #define CS_CLIENT 0
 #define CS_SERVER 1
     int (*f_listen)(COMSTACK h, char *raddr, int *addrlen,
-                  int (*check_ip)(void *cd, const char *a, int len, int type),
-                  void *cd);
+                   int (*check_ip)(void *cd, const char *a, int len, int type),
+                   void *cd);
     COMSTACK (*f_accept)(COMSTACK handle);
     int (*f_close)(COMSTACK handle);
     char *(*f_addrstr)(COMSTACK handle);
@@ -104,7 +104,7 @@ struct comstack
 #define cs_close(handle) ((*(handle)->f_close)(handle))
 #define cs_create(type, blocking, proto) ((*type)(-1, blocking, proto, 0))
 #define cs_createbysocket(sock, type, blocking, proto) \
-       ((*type)(sock, blocking, proto, 0))
+        ((*type)(sock, blocking, proto, 0))
 #define cs_type(handle) ((handle)->type)
 #define cs_fileno(handle) ((handle)->iofile)
 #define cs_stackerr(handle) ((handle)->stackerr)
@@ -116,7 +116,7 @@ struct comstack
 #define cs_want_read(handle) ((handle)->io_pending & CS_WANT_READ)
 #define cs_want_write(handle) ((handle)->io_pending & CS_WANT_WRITE)
 #define cs_set_blocking(handle,blocking) ((handle)->f_set_blocking(handle, blocking))
-                                         
+                                          
 #define CS_WANT_READ 1
 #define CS_WANT_WRITE 2
 
@@ -135,7 +135,7 @@ YAZ_EXPORT int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len);
 /*
  * error management.
  */
-                                         
+                                          
 #define CSNONE     0
 #define CSYSERR    1
 #define CSOUTSTATE 2
@@ -143,7 +143,7 @@ YAZ_EXPORT int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len);
 #define CSWRONGBUF 4
 #define CSDENY     5
 #define CSERRORSSL 6
-#define CSLASTERROR CSERRORSSL /* must be the value of last CS error */
+#define CSLASTERROR CSERRORSSL  /* must be the value of last CS error */
 
 /* backwards compatibility */
 #define CS_SR     PROTO_SR
@@ -152,3 +152,11 @@ YAZ_EXPORT int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 33c7295..3a6215a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: cql.h,v 1.11 2005-01-15 19:47:09 adam Exp $
+/* $Id: cql.h,v 1.12 2005-06-25 15:46:02 adam Exp $
    Copyright (C) 1995-2005, Index Data ApS
    Index Data Aps
 
@@ -81,30 +81,30 @@ struct cql_node {
     /** node type */
     int which;
     union {
-       /** which == CQL_NODE_ST */
+        /** which == CQL_NODE_ST */
         struct {
-           /** CQL index */
+            /** CQL index */
             char *index;
-           /** CQL index URI or NULL if no URI */
-           char *index_uri;
-           /** Search term */
+            /** CQL index URI or NULL if no URI */
+            char *index_uri;
+            /** Search term */
             char *term;
-           /** relation */
+            /** relation */
             char *relation;
-           /** relation URL or NULL if no relation URI) */
-           char *relation_uri;
-           /** relation modifiers */
+            /** relation URL or NULL if no relation URI) */
+            char *relation_uri;
+            /** relation modifiers */
             struct cql_node *modifiers;
         } st;
-       /** which == CQL_NODE_BOOL */
+        /** which == CQL_NODE_BOOL */
         struct {
             /** operator name "and", "or", ... */
             char *value;
-           /** left operand */
+            /** left operand */
             struct cql_node *left;
-           /** right operand */ 
+            /** right operand */ 
             struct cql_node *right;
-           /** modifiers (NULL for no list) */
+            /** modifiers (NULL for no list) */
             struct cql_node *modifiers;
         } boolean;
     } u;
@@ -153,7 +153,7 @@ struct cql_node *cql_node_mk_sc(NMEM nmem, const char *index,
  */
 YAZ_EXPORT
 struct cql_node *cql_apply_prefix(NMEM nmem, struct cql_node *cn,
-                                 const char *prefix, const char *uri);
+                                  const char *prefix, const char *uri);
 
 /**
  * This function creates a boolean node.
@@ -285,3 +285,11 @@ YAZ_END_CDECL
 
 #endif
 /* CQL_H_INCLUDED */
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 7c0b62b..a2577b5 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ill.h,v 1.7 2005-01-15 19:47:09 adam Exp $
+ * $Id: ill.h,v 1.8 2005-06-25 15:46:02 adam Exp $
  */
 #ifndef ILL_H
 #define ILL_H
@@ -33,3 +33,11 @@ YAZ_EXPORT ILL_APDU *ill_get_APDU (
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index afd68e2..418aef3 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: log.h,v 1.33 2005-05-18 12:30:00 adam Exp $
+ * $Id: log.h,v 1.34 2005-06-25 15:46:02 adam Exp $
  */
 
 /**
@@ -104,9 +104,9 @@ YAZ_EXPORT void yaz_log_init_max_size(int mx);
  * yaz_log_init_level, optionally defined via yaz_log_mask_str. */
 YAZ_EXPORT void yaz_log(int level, const char *fmt, ...)
 #ifdef __GNUC__
-       __attribute__ ((format (printf, 2, 3)))
+        __attribute__ ((format (printf, 2, 3)))
 #endif
-       ;
+        ;
 
 /** 
  * yaz_log_mask_str converts a comma-separated list of log levels to a bit 
@@ -132,9 +132,9 @@ YAZ_EXPORT int yaz_log_module_level(const char *name);
 YAZ_EXPORT FILE *yaz_log_file(void);
 
 YAZ_EXPORT void log_event_start(void (*func)(int level, const char *msg, void *info),
-       void *info);
+        void *info);
 YAZ_EXPORT void log_event_end(void (*func)(int level, const char *msg, void *info),
-       void *info);
+        void *info);
 
 YAZ_EXPORT void yaz_log_reopen(void);
 
@@ -174,3 +174,11 @@ YAZ_EXPORT void yaz_log_reopen(void);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 0d80685..7b1ea55 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: logrpn.h,v 1.7 2005-01-15 19:47:09 adam Exp $
+ * $Id: logrpn.h,v 1.8 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -37,3 +37,11 @@ YAZ_EXPORT void wrbuf_diags(WRBUF b, int num_diagnostics,Z_DiagRec **diags);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index f027be3..4c425f3 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: marcdisp.h,v 1.13 2005-02-08 13:51:30 adam Exp $
+ * $Id: marcdisp.h,v 1.14 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -78,7 +78,7 @@ YAZ_EXPORT int marc_display_ex (const char *buf, FILE *outf, int debug);
 YAZ_EXPORT int marc_display_exl (const char *buf, FILE *outf, int debug,
                                  int length);
 YAZ_EXPORT int marc_display_wrbuf (const char *buf, WRBUF wr, int debug,
-                                  int bsize);
+                                   int bsize);
 YAZ_EXPORT int yaz_marc_decode(const char *buf, WRBUF wr,
                                int debug, int bsize, int xml);
 
@@ -96,3 +96,11 @@ YAZ_EXPORT int atoi_n (const char *buf, int len);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index b424be0..bd4ff09 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: nmem.h,v 1.16 2005-06-03 20:30:30 adam Exp $
+ * $Id: nmem.h,v 1.17 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -64,10 +64,10 @@ YAZ_EXPORT int nmem_total(NMEM n);
 YAZ_EXPORT char *nmem_strdup (NMEM mem, const char *src);
 YAZ_EXPORT char *nmem_strdupn (NMEM mem, const char *src, size_t n);
 YAZ_EXPORT void nmem_strsplit_blank(NMEM nmem, const char *dstr,
-                                   char ***darray, int *num);
+                                    char ***darray, int *num);
 YAZ_EXPORT void nmem_strsplit(NMEM nmem, const char *delim,
-                             const char *dstr,
-                             char ***darray, int *num);
+                              const char *dstr,
+                              char ***darray, int *num);
 
 YAZ_EXPORT int *nmem_intdup (NMEM mem, int v);
 YAZ_EXPORT void nmem_transfer (NMEM dst, NMEM src);
@@ -106,3 +106,11 @@ YAZ_EXPORT void yaz_strerror(char *buf, int max);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 43f352c..421f44a 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: odr.h,v 1.20 2005-05-26 21:47:16 adam Exp $
+ * $Id: odr.h,v 1.21 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -230,10 +230,10 @@ YAZ_EXPORT Odr_null *odr_nullval(void);
 
 YAZ_EXPORT int ber_boolean(ODR o, int *val);
 YAZ_EXPORT int ber_tag(ODR o, void *p, int zclass, int tag,
-                      int *constructed, int opt, const char *name);
+                       int *constructed, int opt, const char *name);
 YAZ_EXPORT int ber_enctag(ODR o, int zclass, int tag, int constructed);
 YAZ_EXPORT int ber_dectag(const unsigned char *buf, int *zclass,
-                         int *tag, int *constructed, int max);
+                          int *tag, int *constructed, int max);
 YAZ_EXPORT int odr_bool(ODR o, int **p, int opt, const char *name);
 YAZ_EXPORT int odr_integer(ODR o, int **p, int opt, const char *name);
 YAZ_EXPORT int odr_enum(ODR o, int **p, int opt, const char *name);
@@ -245,7 +245,7 @@ YAZ_EXPORT int ber_null(ODR o);
 YAZ_EXPORT int odr_null(ODR o, Odr_null **p, int opt, const char *name);
 YAZ_EXPORT int ber_integer(ODR o, int *val);
 YAZ_EXPORT int odr_constructed_begin(ODR o, void *p, int zclass, int tag,
-                                    const char *name);
+                                     const char *name);
 YAZ_EXPORT int odr_constructed_end(ODR o);
 YAZ_EXPORT int odr_sequence_begin(ODR o, void *p, int size, const char *name);
 YAZ_EXPORT int odr_set_begin(ODR o, void *p, int size, const char *name);
@@ -256,19 +256,19 @@ YAZ_EXPORT int odr_octetstring(ODR o, Odr_oct **p, int opt, const char *name);
 YAZ_EXPORT int odp_more_chunks(ODR o, const unsigned char *base, int len);
 YAZ_EXPORT int odr_constructed_more(ODR o);
 YAZ_EXPORT int odr_bitstring(ODR o, Odr_bitmask **p, int opt,
-                            const char *name);
+                             const char *name);
 YAZ_EXPORT int ber_bitstring(ODR o, Odr_bitmask *p, int cons);
 YAZ_EXPORT int odr_generalstring(ODR o, char **p, int opt, const char *name);
 YAZ_EXPORT int ber_oidc(ODR o, Odr_oid *p, int max_oid_size);
 YAZ_EXPORT int odr_oid(ODR o, Odr_oid **p, int opt, const char *name);
 YAZ_EXPORT int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp,
-                         const char *name);
+                          const char *name);
 YAZ_EXPORT int odr_cstring(ODR o, char **p, int opt, const char *name);
 YAZ_EXPORT int odr_iconv_string(ODR o, char **p, int opt, const char *name);
 YAZ_EXPORT int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num,
-                              const char *name);
+                               const char *name);
 YAZ_EXPORT int odr_set_of(ODR o, Odr_fun type, void *p, int *num,
-                         const char *name);
+                          const char *name);
 YAZ_EXPORT int odr_any(ODR o, Odr_any **p, int opt, const char *name);
 YAZ_EXPORT int ber_any(ODR o, Odr_any **p);
 YAZ_EXPORT int completeBER(const unsigned char *buf, int len);
@@ -304,30 +304,30 @@ typedef struct Odr_external
 #define ODR_EXTERNAL_arbitrary 2
     union
     {
-       Odr_any  *single_ASN1_type;
-       Odr_oct  *octet_aligned; 
-       Odr_bitmask *arbitrary;      /* we aren't really equipped for this*/
+        Odr_any  *single_ASN1_type;
+        Odr_oct  *octet_aligned; 
+        Odr_bitmask *arbitrary;      /* we aren't really equipped for this*/
     } u;
 } Odr_external;
 
 YAZ_EXPORT int odr_external(ODR o, Odr_external **p, int opt,
-                           const char *name);
+                            const char *name);
 YAZ_EXPORT int odr_visiblestring(ODR o, char **p, int opt,
-                                const char *name);
+                                 const char *name);
 YAZ_EXPORT int odr_graphicstring(ODR o, char **p, int opt,
-                                const char *name);
+                                 const char *name);
 YAZ_EXPORT int odr_generalizedtime(ODR o, char **p, int opt,
-                                  const char *name);
+                                   const char *name);
 
 YAZ_EXPORT int odr_set_charset(ODR o, const char *to, const char *from);
 
 YAZ_EXPORT void odr_set_stream(ODR o,  void *handle,
-                              void (*stream_write)(ODR o, 
-                                                   void *handle,
-                                                   int type,
-                                                   const char *buf,
-                                                   int len),
-                              void (*stream_close)(void *handle));
+                               void (*stream_write)(ODR o, 
+                                                    void *handle,
+                                                    int type,
+                                                    const char *buf,
+                                                    int len),
+                               void (*stream_close)(void *handle));
 
 YAZ_EXPORT void odr_printf(ODR o, const char *fmt, ...);
 
@@ -338,3 +338,11 @@ YAZ_END_CDECL
 #include <yaz/xmalloc.h>
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 19fb305..05849fe 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: oid.h,v 1.26 2005-06-21 07:33:08 adam Exp $
+ * $Id: oid.h,v 1.27 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -256,8 +256,8 @@ YAZ_EXPORT int oid_oidlen(int *o);
 YAZ_EXPORT oid_value oid_getvalbyname(const char *name);
 YAZ_EXPORT void oid_setprivateoids(oident *list);
 YAZ_EXPORT struct oident *oid_addent (int *oid, enum oid_proto proto,
-                                     enum oid_class oclass,
-                                     const char *desc, int value);
+                                      enum oid_class oclass,
+                                      const char *desc, int value);
 
 YAZ_EXPORT void oid_trav (void (*func)(struct oident *oidinfo, void *vp),
                           void *vp);
@@ -267,8 +267,16 @@ YAZ_EXPORT void oid_exit(void);
 YAZ_EXPORT int *oid_name_to_oid(oid_class oclass, const char *name, int *oid);
 YAZ_EXPORT char *oid_to_dotstring(const int *oid, char *oidbuf);
 YAZ_EXPORT char *oid_name_to_dotstring(oid_class oclass, const char *name,
-                                      char *oidbuf);
+                                       char *oidbuf);
 
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index a285f2b..2a71410 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: options.h,v 1.5 2005-01-15 19:47:09 adam Exp $
+ * $Id: options.h,v 1.6 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -42,4 +42,12 @@ YAZ_EXPORT int options (const char *desc, char **argv, int argc, char **arg);
 YAZ_END_CDECL
 
 #endif
-       
+        
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index af86a17..cb429cb 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: otherinfo.h,v 1.4 2005-01-15 19:47:09 adam Exp $
+ * $Id: otherinfo.h,v 1.5 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file otherinfo.h
@@ -37,3 +37,11 @@ YAZ_EXPORT char *yaz_oi_get_string_oidval(
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index e50c913..183201e 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: pquery.h,v 1.6 2005-01-15 19:47:09 adam Exp $
+ * $Id: pquery.h,v 1.7 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file pquery.h
@@ -81,3 +81,11 @@ YAZ_EXPORT int yaz_pqf_error (YAZ_PQF_Parser p, const char **msg, size_t *off);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 2ba1770..1d796ba 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: proto.h,v 1.20 2005-02-25 17:05:09 adam Exp $
+ * $Id: proto.h,v 1.21 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file proto.h
@@ -109,9 +109,9 @@ typedef struct Z_IOItemOrder Z_ItemOrder;
 YAZ_EXPORT Z_APDU *zget_APDU(ODR o, int which);
 YAZ_EXPORT Z_Close *zget_Close (ODR o);
 YAZ_EXPORT Odr_oid *yaz_oidval_to_z3950oid (ODR o, int oid_class,
-                                           int oid_value);
+                                            int oid_value);
 YAZ_EXPORT Odr_oid *yaz_str_to_z3950oid (ODR o, int oid_class,
-                                        const char *str);
+                                         const char *str);
 YAZ_EXPORT const char *yaz_z3950oid_to_str (Odr_oid *oid, int *oid_class);
 
 YAZ_EXPORT const char* yaz_z3950_oid_value_to_str(oid_value ov, oid_class oc);
@@ -127,22 +127,22 @@ void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf);
 
 /** \brief Encodes Z39.50 Init OPtions based on string mnemonics */
 YAZ_EXPORT int yaz_init_opt_encode(Z_Options *opt, const char *opt_str,
-                                  int *error_pos);
+                                   int *error_pos);
 
 /** \brief Decodes Z39.50 Init Options - for printing */
 YAZ_EXPORT void yaz_init_opt_decode(Z_Options *opt,
-                                   void (*pr)(const char *name,
-                                              void *clientData),
-                                   void *clientData);
+                                    void (*pr)(const char *name,
+                                               void *clientData),
+                                    void *clientData);
 /** \brief Creates Default Diag Format Diagnostic */
 YAZ_EXPORT
 Z_DefaultDiagFormat *zget_DefaultDiagFormat(ODR o, int error,
-                                           const char *addinfo);
+                                            const char *addinfo);
 
 /** \brief Creates Surrogate Diagnostic Records */
 YAZ_EXPORT
 Z_NamePlusRecord *zget_surrogateDiagRec(ODR o, const char *dbname,
-                                       int error, const char *addinfo);
+                                        int error, const char *addinfo);
 
 /** \brief Creates Initialize Response diagnostics */
 YAZ_EXPORT
@@ -165,3 +165,11 @@ YAZ_END_CDECL
 #include <yaz/prt-ext.h>
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 659a9e3..ed29603 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: prt-ext.h,v 1.12 2005-01-27 09:08:42 adam Exp $
+ * $Id: prt-ext.h,v 1.13 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -95,34 +95,34 @@ struct Z_External
 #define Z_External_OCLCUserInfo 28
     union
     {
-       /* Generic types */
-       Odr_any *single_ASN1_type;
-       Odr_oct *octet_aligned;
-       Odr_bitmask *arbitrary;
-
-       /* Specific types */
-       Z_SUTRS *sutrs;
-       Z_ExplainRecord *explainRecord;
-
-       Z_ResourceReport1 *resourceReport1;
-       Z_ResourceReport2 *resourceReport2;
-       Z_PromptObject1 *promptObject1;
-       Z_GenericRecord *grs1;
-       Z_TaskPackage *extendedService;
-
-       Z_ItemOrder *itemOrder;
-       Z_DiagnosticFormat *diag1;
-       Z_Espec1 *espec1;
-       Z_BriefBib *summary;
+        /* Generic types */
+        Odr_any *single_ASN1_type;
+        Odr_oct *octet_aligned;
+        Odr_bitmask *arbitrary;
+
+        /* Specific types */
+        Z_SUTRS *sutrs;
+        Z_ExplainRecord *explainRecord;
+
+        Z_ResourceReport1 *resourceReport1;
+        Z_ResourceReport2 *resourceReport2;
+        Z_PromptObject1 *promptObject1;
+        Z_GenericRecord *grs1;
+        Z_TaskPackage *extendedService;
+
+        Z_ItemOrder *itemOrder;
+        Z_DiagnosticFormat *diag1;
+        Z_Espec1 *espec1;
+        Z_BriefBib *summary;
         Z_OPACRecord *opac;
 
-       Z_SearchInfoReport *searchResult1;
-       Z_IUUpdate *update;
-       Z_DateTime *dateTime;
+        Z_SearchInfoReport *searchResult1;
+        Z_IUUpdate *update;
+        Z_DateTime *dateTime;
         Z_UniverseReport *universeReport;
         Z_Admin *adminService;
 
-       Z_IU0Update *update0;
+        Z_IU0Update *update0;
         Z_OtherInformation *userInfo1;
         Z_CharSetandLanguageNegotiation *charNeg3;
         Z_PromptObject1 *acfPrompt1;
@@ -131,7 +131,7 @@ struct Z_External
         Z_KRBObject *acfKrb1;
         Z_MultipleSearchTerms_2 *multipleSearchTerms_2;
         Z_InternationalString *cql;
-       Z_OCLC_UserInformation *oclc;
+        Z_OCLC_UserInformation *oclc;
     } u;
 };
 
@@ -142,8 +142,16 @@ YAZ_EXPORT int z_External(ODR o, Z_External **p, int opt, const char *name);
 YAZ_EXPORT Z_ext_typeent *z_ext_getentbyref(oid_value val);
 /** \brief encodes EXTERNAL record based on OID (NULL if knot known) */
 YAZ_EXPORT Z_External *z_ext_record(ODR o, int format, const char *buf,
-                                   int len);
+                                    int len);
 
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 7eeaf07..522cdd7 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: readconf.h,v 1.4 2005-01-15 19:47:10 adam Exp $
+ * $Id: readconf.h,v 1.5 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file readconf.h
@@ -40,11 +40,19 @@ YAZ_BEGIN_CDECL
     
 YAZ_EXPORT int readconf(char *name, void *rprivate,
                         int (*fun)(char *name, void *rprivate,
-                                  int argc, char *argv[]));
+                                   int argc, char *argv[]));
 
 YAZ_EXPORT int readconf_line(FILE *f, int *lineno,
-                            char *line, int len, char *argv[], int num);
+                             char *line, int len, char *argv[], int num);
     
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 2211c4b..c920874 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: soap.h,v 1.9 2005-01-15 19:47:10 adam Exp $
+ * $Id: soap.h,v 1.10 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file soap.h
@@ -42,7 +42,7 @@ typedef struct {
 } Z_SOAP;
 
 typedef int (*Z_SOAP_fun)(ODR o, void * ptr, void **handler_data,
-                        void *client_data, const char *ns);
+                         void *client_data, const char *ns);
 typedef struct {
     char *ns;
     void *client_data;
@@ -53,14 +53,14 @@ YAZ_EXPORT int z_soap_codec(ODR o, Z_SOAP **pp,
                             char **content_buf, int *content_len,
                             Z_SOAP_Handler *handlers);
 YAZ_EXPORT int z_soap_codec_enc(ODR o, Z_SOAP **pp, 
-                               char **content_buf, int *content_len,
-                               Z_SOAP_Handler *handlers,
-                               const char *encoding);
+                                char **content_buf, int *content_len,
+                                Z_SOAP_Handler *handlers,
+                                const char *encoding);
 YAZ_EXPORT int z_soap_codec_enc_xsl(ODR o, Z_SOAP **pp, 
-                                   char **content_buf, int *content_len,
-                                   Z_SOAP_Handler *handlers,
-                                   const char *encoding,
-                                   const char *stylesheet);
+                                    char **content_buf, int *content_len,
+                                    Z_SOAP_Handler *handlers,
+                                    const char *encoding,
+                                    const char *stylesheet);
 
 YAZ_EXPORT int z_soap_error(ODR o, Z_SOAP *p,
                             const char *fault_code, const char *fault_string,
@@ -68,3 +68,11 @@ YAZ_EXPORT int z_soap_error(ODR o, Z_SOAP *p,
 
 YAZ_END_CDECL
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index de395aa..a01cb62 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: sortspec.h,v 1.3 2005-01-15 19:47:10 adam Exp $
+ * $Id: sortspec.h,v 1.4 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file sortspec.h
@@ -43,3 +43,11 @@ YAZ_END_CDECL
 
 #endif
 
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 2f6b505..24fd5d6 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: srw.h,v 1.21 2005-04-22 08:27:57 adam Exp $
+ * $Id: srw.h,v 1.22 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file srw.h
@@ -148,20 +148,28 @@ YAZ_EXPORT int yaz_diag_srw_to_bib1(int srw_code);
 
 YAZ_EXPORT char *yaz_uri_val(const char *path, const char *name, ODR o);
 YAZ_EXPORT void yaz_uri_val_int(const char *path, const char *name,
-                               ODR o, int **intp);
+                                ODR o, int **intp);
 YAZ_EXPORT int yaz_srw_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu,
-                             Z_SOAP **soap_package, ODR decode, char **charset);
+                              Z_SOAP **soap_package, ODR decode, char **charset);
 YAZ_EXPORT int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu,
-                             Z_SOAP **soap_package, ODR decode, 
-                             char **charset,
-                             Z_SRW_diagnostic **, int *num_diagnostic);
+                              Z_SOAP **soap_package, ODR decode, 
+                              char **charset,
+                              Z_SRW_diagnostic **, int *num_diagnostic);
 
 YAZ_EXPORT void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d,
-                                      int *num, int code,
-                                      const char *addinfo);
+                                       int *num, int code,
+                                       const char *addinfo);
     
 YAZ_EXPORT void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d, 
-                                     int code, const char *details);
+                                      int code, const char *details);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 0b99731..8e19f0a 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: statserv.h,v 1.8 2005-01-15 19:47:10 adam Exp $
+ * $Id: statserv.h,v 1.9 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
 #include <yaz/backend.h>
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 43d4618..16aaf99 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: tcpip.h,v 1.6 2005-01-15 19:47:10 adam Exp $
+ * $Id: tcpip.h,v 1.7 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file tcpip.h
@@ -46,3 +46,11 @@ YAZ_EXPORT COMSTACK ssl_type(int s, int blocking, int protocol, void *vp);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index b660e7e..726f3eb 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: tpath.h,v 1.7 2005-01-15 19:47:10 adam Exp $
+ * $Id: tpath.h,v 1.8 2005-06-25 15:46:03 adam Exp $
  *
  */
 /**
@@ -50,3 +50,11 @@ YAZ_EXPORT int yaz_is_abspath (const char *p);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index c66625c..fc6da6e 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: unix.h,v 1.4 2005-01-15 19:47:10 adam Exp $
+ * $Id: unix.h,v 1.5 2005-06-25 15:46:03 adam Exp $
  * UNIX socket COMSTACK. By Morten B√łgeskov.
  */
 /**
@@ -50,3 +50,11 @@ YAZ_END_CDECL
 #endif
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 2b76be9..8241d1d 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: wrbuf.h,v 1.14 2005-01-15 19:47:10 adam Exp $
+ * $Id: wrbuf.h,v 1.15 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file wrbuf.h
@@ -55,9 +55,9 @@ YAZ_EXPORT int wrbuf_puts(WRBUF b, const char *buf);
 YAZ_EXPORT int wrbuf_xmlputs(WRBUF b, const char *cp);
 YAZ_EXPORT void wrbuf_printf(WRBUF b, const char *fmt, ...);
 YAZ_EXPORT int wrbuf_iconv_write(WRBUF b, yaz_iconv_t cd, const char *buf,
-                                int size);
+                                 int size);
 YAZ_EXPORT int wrbuf_iconv_write_cdata(WRBUF b, yaz_iconv_t cd,
-                                      const char *buf, int size);
+                                       const char *buf, int size);
 
 #define wrbuf_len(b) ((b)->pos)
 #define wrbuf_buf(b) ((b)->buf)
@@ -69,3 +69,11 @@ YAZ_EXPORT int wrbuf_iconv_write_cdata(WRBUF b, yaz_iconv_t cd,
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 7a8bd6e..60ef839 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: xmalloc.h,v 1.6 2005-01-16 21:51:49 adam Exp $
+ * $Id: xmalloc.h,v 1.7 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file xmalloc.h
@@ -49,7 +49,7 @@ YAZ_BEGIN_CDECL
 YAZ_EXPORT void *xrealloc_f (void *o, size_t size, const char *file, int line);
 YAZ_EXPORT void *xmalloc_f (size_t size, const char *file, int line);
 YAZ_EXPORT void *xcalloc_f (size_t nmemb, size_t size,
-                           const char *file, int line);
+                            const char *file, int line);
 YAZ_EXPORT char *xstrdup_f (const char *p, const char *file, int line);
 YAZ_EXPORT void xfree_f (void *p, const char *file, int line);
 YAZ_EXPORT void xmalloc_trav_f(const char *s, const char *file, int line);
@@ -57,3 +57,11 @@ YAZ_EXPORT void xmalloc_trav_f(const char *s, const char *file, int line);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 68cfc99..5f510f2 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: yaz-ccl.h,v 1.8 2005-01-15 19:47:10 adam Exp $
+ * $Id: yaz-ccl.h,v 1.9 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file yaz-ccl.h
@@ -45,3 +45,11 @@ YAZ_EXPORT Z_AttributesPlusTerm *ccl_scan_query (ODR o, struct ccl_rpn_node *p);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 5eacbd7..4e62904 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: yaz-iconv.h,v 1.7 2005-01-15 19:47:10 adam Exp $
+ * $Id: yaz-iconv.h,v 1.8 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file yaz-iconv.h
@@ -61,3 +61,11 @@ YAZ_EXPORT int yaz_strcmp_del(const char *a, const char *b, const char *b_del);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index e5261e4..16b25fb 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: yaz-util.h,v 1.15 2005-01-15 19:47:10 adam Exp $
+ * $Id: yaz-util.h,v 1.16 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file yaz-util.h
 #include <yaz/yaz-iconv.h>
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index fa9839c..401f4a8 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: yaz-version.h,v 1.71 2005-06-08 09:11:17 adam Exp $
+ * $Id: yaz-version.h,v 1.72 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -34,3 +34,11 @@ YAZ_END_CDECL
 
 #endif
 
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index a615eb2..939203a 100644 (file)
@@ -23,7 +23,7 @@
  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  *
- * $Id: yconfig.h,v 1.8 2005-01-15 19:47:10 adam Exp $
+ * $Id: yconfig.h,v 1.9 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file yconfig.h
 #endif
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 4579e00..e7a97c0 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: zgdu.h,v 1.4 2005-01-15 19:47:10 adam Exp $
+ * $Id: zgdu.h,v 1.5 2005-06-25 15:46:03 adam Exp $
  */
 
 /**
@@ -66,3 +66,11 @@ YAZ_EXPORT Z_GDU *z_get_HTTP_Request(ODR o);
 YAZ_END_CDECL
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 748b82d..09383a8 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: zoom.h,v 1.25 2005-01-15 19:47:10 adam Exp $
+ * $Id: zoom.h,v 1.26 2005-06-25 15:46:03 adam Exp $
  */
 /**
  * \file zoom.h
@@ -29,7 +29,7 @@ ZOOM_BEGIN_CDECL
 typedef struct ZOOM_options_p *ZOOM_options;
 typedef struct ZOOM_query_p *ZOOM_query;
 typedef struct ZOOM_connection_p *ZOOM_connection;
-typedef        struct ZOOM_resultset_p *ZOOM_resultset;
+typedef struct ZOOM_resultset_p *ZOOM_resultset;
 typedef struct ZOOM_task_p *ZOOM_task;
 typedef struct ZOOM_record_p *ZOOM_record;
 typedef struct ZOOM_scanset_p *ZOOM_scanset;
@@ -52,7 +52,7 @@ ZOOM_connection_create (ZOOM_options options);
 /* connect given existing connection */
 ZOOM_API(void)
 ZOOM_connection_connect(ZOOM_connection c, const char *host,
-                             int portnum);
+                              int portnum);
 
 /* destroy connection (close connection also) */
 ZOOM_API(void)
@@ -68,14 +68,14 @@ ZOOM_connection_option_set (ZOOM_connection c, const char *key,
 
 ZOOM_API(void)
 ZOOM_connection_option_setl (ZOOM_connection c, const char *key,
-                            const char *val, int len);
+                             const char *val, int len);
 
 /* return error code (0 == success, failure otherwise). cp
    holds error string on failure, addinfo holds addititional info (if any)
 */
 ZOOM_API(int)
 ZOOM_connection_error (ZOOM_connection c, const char **cp,
-                           const char **addinfo);
+                            const char **addinfo);
 
 ZOOM_API(int)
 ZOOM_connection_error_x (ZOOM_connection c, const char **cp,
@@ -207,7 +207,7 @@ ZOOM_scanset_term(ZOOM_scanset scan, size_t pos,
 
 ZOOM_API(const char *)
 ZOOM_scanset_display_term(ZOOM_scanset scan, size_t pos,
-                         int *occ, int *len);
+                          int *occ, int *len);
 
 ZOOM_API(size_t)
 ZOOM_scanset_size(ZOOM_scanset scan);
@@ -244,7 +244,7 @@ ZOOM_API(void)
 /* Sort */
 ZOOM_API(void)
     ZOOM_resultset_sort(ZOOM_resultset r,
-                       const char *sort_type, const char *sort_spec);
+                        const char *sort_type, const char *sort_spec);
 
 /* ----------------------------------------------------------- */
 /* options */
@@ -295,3 +295,11 @@ ZOOM_API(int)
 ZOOM_event (int no, ZOOM_connection *cs);
 
 ZOOM_END_CDECL
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index d802c42..ca1bd7d 100644 (file)
@@ -26,8 +26,8 @@ int makensap(char *text, unsigned char *binary)
     fprintf(stderr, "Mapping textform NSAP '%s'\n", text);
     if (!(addr = tcpip_strtoaddr(text)))
     {
-       fprintf(stderr, "Failed to resolve '%s'\n", text);
-       return -1;
+        fprintf(stderr, "Failed to resolve '%s'\n", text);
+        return -1;
     }
     memcpy(binary, addr, sizeof(struct sockaddr_in));
     return sizeof(struct sockaddr_in);
@@ -48,15 +48,23 @@ static struct sockaddr_in *tcpip_strtoaddr(const char *str)
     strcpy(buf, str);
     if ((p = strchr(buf, ':')))
     {
-       *p = 0;
-       port = atoi(p + 1);
+        *p = 0;
+        port = atoi(p + 1);
     }
     add.sin_port = htons(port);
     if ((hp = gethostbyname(buf)))
-       memcpy(&add.sin_addr.s_addr, *hp->h_addr_list, sizeof(struct in_addr));
+        memcpy(&add.sin_addr.s_addr, *hp->h_addr_list, sizeof(struct in_addr));
     else if ((tmpadd = inet_addr(buf)) != 0)
-       memcpy(&add.sin_addr.s_addr, &tmpadd, sizeof(struct in_addr));
+        memcpy(&add.sin_addr.s_addr, &tmpadd, sizeof(struct in_addr));
     else
-       return 0;
+        return 0;
     return &add;
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index b79e6a2..1fd469d 100644 (file)
@@ -4,7 +4,11 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rfct.c,v $
- * Revision 1.9  1996-02-23 10:01:00  quinn
+ * Revision 1.10  2005-06-25 15:46:03  adam
+ * Expanded tabs in all source files. Added vim/emacs local variables
+ * trailer.
+ *
+ * Revision 1.9  1996/02/23 10:01:00  quinn
  * Smallish
  *
  * Revision 1.8  1995/11/01  13:54:52  quinn
@@ -220,7 +224,7 @@ static void init_rfc(void)
     int i;
 
     for (i = 0; i < NOFILE; i++)
-       control[i] = 0;
+        control[i] = 0;
     rfc_running = 1;
 }
 
@@ -233,24 +237,24 @@ int t_open(char *name, int oflag, struct t_info *info)
     TRC(fprintf(stderr, "T_OPEN\n"));
 
     if (!rfc_running)
-       init_rfc();
+        init_rfc();
 
     if (!(proto = getprotobyname("tcp")))
-       return 0;
+        return 0;
     if ((s = socket(AF_INET, SOCK_STREAM, proto->p_proto)) < 0)
-       return 0;
+        return 0;
 #ifdef NONBLOCKING_OSI
     if ((oflag & O_NONBLOCK) && fcntl(s, F_SETFL, O_NONBLOCK) < 0)
     {
-       t_errno = TSYSERR;
-       return -1;
+        t_errno = TSYSERR;
+        return -1;
     }
 #endif
     if (!(cnt = control[s] = malloc(sizeof(struct rfct_control))))
     {
-       TRC(perror("malloc()"));
-       t_errno = TSYSERR;
-       return -1;
+        TRC(perror("malloc()"));
+        t_errno = TSYSERR;
+        return -1;
     }
 
     cnt->togo = 0;
@@ -263,7 +267,7 @@ int t_open(char *name, int oflag, struct t_info *info)
     cnt->tmpfd = -1;
     cnt->ltsel_len = 0;
     for (i = 0; i < MAX_QLEN; i++)
-       cnt->oci[i] = -1;
+        cnt->oci[i] = -1;
 
     /*
      * RFC1006 sets a higher than standard (TP) default max TPDU size, but the
@@ -275,14 +279,14 @@ int t_open(char *name, int oflag, struct t_info *info)
 
     if (info)
     {
-       info->addr = TSEL_MAXLEN + sizeof(struct sockaddr_in) + 1;
-       info->options = 1024;
-       info->tsdu = -1; /* is this right? */
-       info->etsdu = 0;
-       info->connect = -2;
-       info->discon = -2;
-       info->servtype = T_COTS_ORD;  /* lets hope our user doesn't
-                                       try something funny. */
+        info->addr = TSEL_MAXLEN + sizeof(struct sockaddr_in) + 1;
+        info->options = 1024;
+        info->tsdu = -1; /* is this right? */
+        info->etsdu = 0;
+        info->connect = -2;
+        info->discon = -2;
+        info->servtype = T_COTS_ORD;  /* lets hope our user doesn't
+                                        try something funny. */
     }
     return s;
 }
@@ -301,33 +305,33 @@ int t_connect(int fd, struct t_call *sndcall, struct t_call *rcvcall)
     TRC(fprintf(stderr, "T_CONNECT\n"));
     if (!cnt || cnt->state != T_IDLE)
     {
-       TRC(fprintf(stderr, "TOUTSTATE\n"));
-       t_errno = TOUTSTATE;
-       return -1;
+        TRC(fprintf(stderr, "TOUTSTATE\n"));
+        t_errno = TOUTSTATE;
+        return -1;
     }
     /* take the address apart */
     p = sndcall->addr.buf;
     if (*p) /* transport selector */
     {
-       TRC(fprintf(stderr, "Tsel length is %d.\n", *p));
-       pbuf[0] = TPDU_PARM_CLDID;
-       pbuf[1] = *p;
-       memcpy(pbuf + 2, p + 1, *p);
-       plen = *p + 2;
+        TRC(fprintf(stderr, "Tsel length is %d.\n", *p));
+        pbuf[0] = TPDU_PARM_CLDID;
+        pbuf[1] = *p;
+        memcpy(pbuf + 2, p + 1, *p);
+        plen = *p + 2;
     }
     p += *p + 1; /* skip tsel */
     if (*p != sizeof(addr))
     {
-       TRC(fprintf(stderr, "Expected  sockaddr here.\n"));
-       t_errno = TBADADDR;
-       return -1;
+        TRC(fprintf(stderr, "Expected  sockaddr here.\n"));
+        t_errno = TBADADDR;
+        return -1;
     }
     p++;
     memcpy(&addr, p, sizeof(addr));
     if (connect(fd, (struct sockaddr*) &addr, sizeof(addr)) < 0)
     {
-       t_errno = TSYSERR;
-       return -1;
+        t_errno = TSYSERR;
+        return -1;
     }
 
     /*
@@ -340,9 +344,9 @@ int t_connect(int fd, struct t_call *sndcall, struct t_call *rcvcall)
      */
     if (cnt->tsize <= 2048)
     {
-       pbuf[plen++] = TPDU_PARM_TSIZE;
-       pbuf[plen++] = 1;
-       pbuf[plen++] = 0x0b; /* request max PDU size (2048 octets) */
+        pbuf[plen++] = TPDU_PARM_TSIZE;
+        pbuf[plen++] = 1;
+        pbuf[plen++] = 0x0b; /* request max PDU size (2048 octets) */
     }
 
     rfc.version = RFC_VERSION;
@@ -368,9 +372,9 @@ int t_connect(int fd, struct t_call *sndcall, struct t_call *rcvcall)
      */
     if (writev(fd, vec, 3) < 4 + 7 + plen)
     {
-       TRC(fprintf(stderr, "writev came up short. Aborting connect\n"));
-       t_errno = TSYSERR;
-       return -1;
+        TRC(fprintf(stderr, "writev came up short. Aborting connect\n"));
+        t_errno = TSYSERR;
+        return -1;
     }
     cnt->state = T_OUTCON;
     cnt->event = 0;
@@ -387,26 +391,26 @@ static int read_n(int fd, char *buf, int toget)
 
     do
     {
-       if ((res = read(fd, buf, toget - got)) < 0)
-       {
-           if (errno == EAGAIN)
-               t_errno = TNODATA;
-           else
-           {
-               TRC(fprintf(stderr, "Error on read.\n"));
-               t_errno = TSYSERR;
-           }
-           return -1;
-       }
-       if (!res) /* peer closed network connection */
-       {
-           t_errno = TLOOK;
-           cnt->event = T_DISCONNECT;  /* is this correct ? ## */
-           cnt->hlen = cnt->pending = 0;
-           cnt->state = T_IDLE; /* this can't be correct ## */
-           return 0;
-       }
-       buf += res;
+        if ((res = read(fd, buf, toget - got)) < 0)
+        {
+            if (errno == EAGAIN)
+                t_errno = TNODATA;
+            else
+            {
+                TRC(fprintf(stderr, "Error on read.\n"));
+                t_errno = TSYSERR;
+            }
+            return -1;
+        }
+        if (!res) /* peer closed network connection */
+        {
+            t_errno = TLOOK;
+            cnt->event = T_DISCONNECT;  /* is this correct ? ## */
+            cnt->hlen = cnt->pending = 0;
+            cnt->state = T_IDLE; /* this can't be correct ## */
+            return 0;
+        }
+        buf += res;
     }
     while ((got += res) < toget);
     return toget;
@@ -423,75 +427,75 @@ int t_rcvconnect(int fd, struct t_call *call)
     TRC(fprintf(stderr, "T_RCVCONNECT\n"));
     if (!cnt || cnt->state != T_OUTCON)
     {
-       TRC(fprintf(stderr, "TOUTSTATE\n"));
-       t_errno = TOUTSTATE;
-       return -1;
+        TRC(fprintf(stderr, "TOUTSTATE\n"));
+        t_errno = TOUTSTATE;
+        return -1;
     }
     if (!cnt->event)
-       if (t_look_wait(fd, 1) <= 0)
-           return -1;
+        if (t_look_wait(fd, 1) <= 0)
+            return -1;
     if (cnt->event != T_CONNECT)
     {
-       t_errno = TLOOK;
-       return -1;
+        t_errno = TLOOK;
+        return -1;
     }
     /* read the rest of the CC TPDU */
     if (read_n(fd, buf, cnt->hlen) <= 0)
-       return -1;
+        return -1;
     memcpy(&chead, buf, 5);
     if (chead.class != 0)
     {
-       TRC(fprintf(stderr, "Expected TP0, got %d\n", (int)chead.class));
-       t_errno = TSYSERR;
-       return -1;
+        TRC(fprintf(stderr, "Expected TP0, got %d\n", (int)chead.class));
+        t_errno = TSYSERR;
+        return -1;
     }
     if (call)
-       *(addrp = call->addr.buf) = 0;
+        *(addrp = call->addr.buf) = 0;
     cnt->hlen -= 5;
     for (p = buf + 5; cnt->hlen > 0;)
     {
-       switch ((unsigned char)*p)
-       {
-           case TPDU_PARM_TSIZE:
-               cnt->tsize = 1 << *(p + 2);
-               break;
-           case TPDU_PARM_CLDID:
-               if (call)
-               {
-                   if (*(p + 1) > TSEL_MAXLEN)
-                   {
-                       TRC(fprintf(stderr, "Called TSEL too long.\n"));
-                       t_errno = TSYSERR; /* Wrong.. ## */
-                       return -1;
-                   }
-                   *addrp = *(p + 1); /* length */
-                   memcpy(addrp + 1, p + 2, *(p + 1)); /* remote TSEL */
-                   addrp += *(p + 1); /* move past TSEL */
-               }
-               break;
-           case TPDU_PARM_CLGID: break; /* ignoring this for now */
-           default:
-               TRC(fprintf(stderr, "Inoring CR parameter: %d\n",
-                   (unsigned char)*p));
-           /* we silently ignore anything else */
-       }
-       p++;
-       cnt->hlen -= (unsigned char) *p + 2;
-       p += (unsigned char) *p + 1;
+        switch ((unsigned char)*p)
+        {
+            case TPDU_PARM_TSIZE:
+                cnt->tsize = 1 << *(p + 2);
+                break;
+            case TPDU_PARM_CLDID:
+                if (call)
+                {
+                    if (*(p + 1) > TSEL_MAXLEN)
+                    {
+                        TRC(fprintf(stderr, "Called TSEL too long.\n"));
+                        t_errno = TSYSERR; /* Wrong.. ## */
+                        return -1;
+                    }
+                    *addrp = *(p + 1); /* length */
+                    memcpy(addrp + 1, p + 2, *(p + 1)); /* remote TSEL */
+                    addrp += *(p + 1); /* move past TSEL */
+                }
+                break;
+            case TPDU_PARM_CLGID: break; /* ignoring this for now */
+            default:
+                TRC(fprintf(stderr, "Inoring CR parameter: %d\n",
+                    (unsigned char)*p));
+            /* we silently ignore anything else */
+        }
+        p++;
+        cnt->hlen -= (unsigned char) *p + 2;
+        p += (unsigned char) *p + 1;
     }
     addrp++; /* skip to end of addr + 1 */
     if (call)
     {
-       if (getpeername(fd, (struct sockaddr*) &peer, &len) < 0)
-       {
-           TRC(perror("getpeername()"));
-           t_errno = TSYSERR;
-           return -1;
-       }
-       *(addrp++) = sizeof(struct sockaddr_in);
-       memcpy(addrp, &peer, sizeof(struct sockaddr_in));
-       addrp += sizeof(struct sockaddr_in);
-       call->addr.len = addrp - call->addr.buf + 1;
+        if (getpeername(fd, (struct sockaddr*) &peer, &len) < 0)
+        {
+            TRC(perror("getpeername()"));
+            t_errno = TSYSERR;
+            return -1;
+        }
+        *(addrp++) = sizeof(struct sockaddr_in);
+        memcpy(addrp, &peer, sizeof(struct sockaddr_in));
+        addrp += sizeof(struct sockaddr_in);
+        call->addr.len = addrp - call->addr.buf + 1;
     }
     cnt->state = T_DATAXFER;
     cnt->event = 0;
@@ -509,107 +513,107 @@ int t_snd(int fd, char *buf, unsigned nbytes, int flags)
     TRC(fprintf(stderr, "T_SND [%d bytes, flags %d]\n", nbytes, flags));
     if (!cnt || cnt->state != T_DATAXFER)
     {
-       TRC(fprintf(stderr, "Trying to write in the wrong state on fd %d.\n",
-           fd));
-       t_errno = TOUTSTATE;
-       return -1;
+        TRC(fprintf(stderr, "Trying to write in the wrong state on fd %d.\n",
+            fd));
+        t_errno = TOUTSTATE;
+        return -1;
     }
     if (!nbytes)
     {
-       t_errno = TBADDATA;
-       return -1;
+        t_errno = TBADDATA;
+        return -1;
     }
     do /* write the TSDU (segment) in chunks depending on the TPDU max size */
     {
-       if (cnt->togo > 0) /* we have a partial TPDU on the wire */
-       {
-           TRC(fprintf(stderr, "  writing continuation block (%d)\n",
-               cnt->togo));
-           if ((res = write(fd, buf, cnt->togo)) < 0)
-           {
-               if (errno == EAGAIN)
-               {
-                   t_errno = TFLOW;
-                   return -1;
-               }
-               cnt->togo -= res;
-               return res;
-           }
-           writ += res;
-           cnt->togo = 0;
-           TRC(fprintf(stderr, "  wrote %d, total %d\n", res, writ));
-       }
-       else /* prepare and send (possibly partial) header */
-       {
-           towrite = nbytes - writ;
-           if (towrite + 3 + 4 > cnt->tsize)
-               towrite = cnt->tsize - (3 + 4); /* space for DATA header */
-           rfc.version = RFC_VERSION;
-           rfc.reserved = 0;
-           rfc.len = htons(towrite + 4 + 3); /* RFC1006 length */
-           rfc.hlen = 2;
-           rfc.code = TPDU_CODE_DATA;
-           if (flags & T_MORE || towrite + writ < nbytes)
-               eot = 0;
-           else
-               eot = 1;
-           rfc.suffix[0] = eot << 7; /* DATA EOT marker */
-           if (cnt->togo < 0)
-               head_offset = 7 + cnt->togo;
-           else
-               head_offset = 0;
-           vec[0].iov_base = (caddr_t) (char*)&rfc + head_offset;
-           vec[0].iov_len = 7 - head_offset;
-           vec[1].iov_base = (caddr_t) buf + writ;
-           vec[1].iov_len = towrite;
-           TRC(fprintf(stderr, "  sending beg of block (%d+%d)\n",
-               7 - head_offset, towrite));
-           if ((res = writev(fd, vec, 2)) < 0)
-           {
-               TRC(fprintf(stderr, "  write returned -1\n"));
-               /* thwarted by flow control */
-               if (errno == EAGAIN)
-               {
-                   if (writ)
-                       return writ;
-                   else
-                   {
-                       t_errno = TFLOW;
-                       return -1;
-                   }
-               }
-               else
-                   t_errno = TSYSERR;
-               return -1;
-           }
-           /* somewhat thwarted */
-           else if (res < towrite + 7 - head_offset)
-           {
-               /*
-                * Write came up short. We assume that this is a flow-
-                * control thing, and return immediately. Maybe it'd
-                * be better to take another loop, and generate an
-                * actual EAGAIN from write?
-                */
-               TRC(fprintf(stderr, "  write returned %d\n", res));
-               if (res < 7 - head_offset) /* we didn't send a full header */
-               {
-                   cnt->togo = -(7 - head_offset - res);
-                   t_errno = TFLOW;
-                   return -1;
-               }
-               else if ((res -= 7 - head_offset) < towrite) /* not all data */
-               {
-                   cnt->togo = towrite - res;
-                   return nbytes - (writ + res);
-               }
-           }
-           else /* whew... nonblocking I/O is hard work */
-           {
-               cnt->togo = 0;
-               writ += res - (7 - head_offset);
-           }
-       }
+        if (cnt->togo > 0) /* we have a partial TPDU on the wire */
+        {
+            TRC(fprintf(stderr, "  writing continuation block (%d)\n",
+                cnt->togo));
+            if ((res = write(fd, buf, cnt->togo)) < 0)
+            {
+                if (errno == EAGAIN)
+                {
+                    t_errno = TFLOW;
+                    return -1;
+                }
+                cnt->togo -= res;
+                return res;
+            }
+            writ += res;
+            cnt->togo = 0;
+            TRC(fprintf(stderr, "  wrote %d, total %d\n", res, writ));
+        }
+        else /* prepare and send (possibly partial) header */
+        {
+            towrite = nbytes - writ;
+            if (towrite + 3 + 4 > cnt->tsize)
+                towrite = cnt->tsize - (3 + 4); /* space for DATA header */
+            rfc.version = RFC_VERSION;
+            rfc.reserved = 0;
+            rfc.len = htons(towrite + 4 + 3); /* RFC1006 length */
+            rfc.hlen = 2;
+            rfc.code = TPDU_CODE_DATA;
+            if (flags & T_MORE || towrite + writ < nbytes)
+                eot = 0;
+            else
+                eot = 1;
+            rfc.suffix[0] = eot << 7; /* DATA EOT marker */
+            if (cnt->togo < 0)
+                head_offset = 7 + cnt->togo;
+            else
+                head_offset = 0;
+            vec[0].iov_base = (caddr_t) (char*)&rfc + head_offset;
+            vec[0].iov_len = 7 - head_offset;
+            vec[1].iov_base = (caddr_t) buf + writ;
+            vec[1].iov_len = towrite;
+            TRC(fprintf(stderr, "  sending beg of block (%d+%d)\n",
+                7 - head_offset, towrite));
+            if ((res = writev(fd, vec, 2)) < 0)
+            {
+                TRC(fprintf(stderr, "  write returned -1\n"));
+                /* thwarted by flow control */
+                if (errno == EAGAIN)
+                {
+                    if (writ)
+                        return writ;
+                    else
+                    {
+                        t_errno = TFLOW;
+                        return -1;
+                    }
+                }
+                else
+                    t_errno = TSYSERR;
+                return -1;
+            }
+            /* somewhat thwarted */
+            else if (res < towrite + 7 - head_offset)
+            {
+                /*
+                 * Write came up short. We assume that this is a flow-
+                 * control thing, and return immediately. Maybe it'd
+                 * be better to take another loop, and generate an
+                 * actual EAGAIN from write?
+                 */
+                TRC(fprintf(stderr, "  write returned %d\n", res));
+                if (res < 7 - head_offset) /* we didn't send a full header */
+                {
+                    cnt->togo = -(7 - head_offset - res);
+                    t_errno = TFLOW;
+                    return -1;
+                }
+                else if ((res -= 7 - head_offset) < towrite) /* not all data */
+                {
+                    cnt->togo = towrite - res;
+                    return nbytes - (writ + res);
+                }
+            }
+            else /* whew... nonblocking I/O is hard work */
+            {
+                cnt->togo = 0;
+                writ += res - (7 - head_offset);
+            }
+        }
     }
     while (writ < nbytes);
     TRC(fprintf(stderr, "  finishing with %d written\n", nbytes));
@@ -627,104 +631,104 @@ int _t_rcv(int fd, char *buf, unsigned nbytes, int *flags)
     TRC(fprintf(stderr, "T_RCV [nbytes=%d, flags=0x%x]\n", nbytes, *flags));
     if (!cnt || cnt->state != T_DATAXFER)
     {
-       t_errno = TOUTSTATE;
-       return -1;
+        t_errno = TOUTSTATE;
+        return -1;
     }
     *flags = 0;
     do /* loop until we have a full TSDU or an error */
     {
-       if (!cnt->event)
-           if (t_look_wait(fd, 0) <= 0)
-               return -1;
-       if (cnt->event != T_DATA)
-       {
-           t_errno = TLOOK;
-           return -1;
-       }
-       if (cnt->hlen)  /* beginning of block */
-       {
-           TRC(fprintf(stderr, "  Beginning of TPDU\n"));
-           if (cnt->hlen > 2)
-           {
-               TRC(fprintf(stderr, "We can't handle parameters to DATA\n"));
-               t_errno = TSYSERR;
-               return -1;
-           }
-           toget = cnt->pending;
-           if (toget > nbytes - got)
-               toget = nbytes - got;
-           TRC(fprintf(stderr, "  toget=%d\n", toget));
-           vec[0].iov_base = (caddr_t) &dhead;
-           vec[0].iov_len = 1;
-           vec[1].iov_base = (caddr_t) buf + got;
-           vec[1].iov_len = toget;
-           if ((res = readv(fd, vec, 2)) < 0)
-           {
-               TRC(perror("readv()"));
-               if (errno == EAGAIN)
-               {
-                   if (got)  /* we got some data in previous cycle */
-                       break;
-                   t_errno = TNODATA; /* no data */
-                   return -1;
-               }
-               t_errno = TSYSERR;
-               return -1;
-           }
-           TRC(fprintf(stderr, "  readv() returned %d\n", res));
-           if (res == 0)
-           {
-               t_errno = TLOOK;
-               cnt->event = T_DISCONNECT;
-               return -1;
-           }
-           got += res - 1;
-           cnt->eot_flag = (dhead.nr & DATA_EOT) >> 7;
-           cnt->hlen = 0;
-           cnt->pending -= got;
-           TRC(fprintf(stderr, "  Got total of %d octets, %d pending\n",
-               got, cnt->pending));
-       }
-       else /* continuation */
-       {
-           TRC(fprintf(stderr, "  Reading middle of TPDU\n"));
-           toget = cnt->pending;
-           if (toget > nbytes - got)
-               toget = nbytes - got;
-           TRC(fprintf(stderr, "  toget=%d\n", toget));
-           if ((res = read(fd, buf + got, toget)) < 0)
-           {
-               TRC(perror("read()"));
-               if (errno == EAGAIN)
-               {
-                   if (got)  /* we got some data in previous cycle */
-                       break;
-                   t_errno = TNODATA; /* no data */
-                   return -1;
-               }
-               t_errno = TSYSERR;
-               return -1;
-           }
-           TRC(fprintf(stderr, "  read() returned %d\n", res));
-           if (res == 0)
-           {
-               t_errno = TLOOK;
-               cnt->event = T_DISCONNECT;
-               return -1;
-           }
-           got += res;
-           cnt->pending -= res;
-           TRC(fprintf(stderr, "  Got total of %d octets, %d pending\n",
-               got, cnt->pending));
-       }
-       TRC(fprintf(stderr, "  bottom of loop: pending=%d, got=%d\n",
-           cnt->pending, got));
+        if (!cnt->event)
+            if (t_look_wait(fd, 0) <= 0)
+                return -1;
+        if (cnt->event != T_DATA)
+        {
+            t_errno = TLOOK;
+            return -1;
+        }
+        if (cnt->hlen)  /* beginning of block */
+        {
+            TRC(fprintf(stderr, "  Beginning of TPDU\n"));
+            if (cnt->hlen > 2)
+            {
+                TRC(fprintf(stderr, "We can't handle parameters to DATA\n"));
+                t_errno = TSYSERR;
+                return -1;
+            }
+            toget = cnt->pending;
+            if (toget > nbytes - got)
+                toget = nbytes - got;
+            TRC(fprintf(stderr, "  toget=%d\n", toget));
+            vec[0].iov_base = (caddr_t) &dhead;
+            vec[0].iov_len = 1;
+            vec[1].iov_base = (caddr_t) buf + got;
+            vec[1].iov_len = toget;
+            if ((res = readv(fd, vec, 2)) < 0)
+            {
+                TRC(perror("readv()"));
+                if (errno == EAGAIN)
+                {
+                    if (got)  /* we got some data in previous cycle */
+                        break;
+                    t_errno = TNODATA; /* no data */
+                    return -1;
+                }
+                t_errno = TSYSERR;
+                return -1;
+            }
+            TRC(fprintf(stderr, "  readv() returned %d\n", res));
+            if (res == 0)
+            {
+                t_errno = TLOOK;
+                cnt->event = T_DISCONNECT;
+                return -1;
+            }
+            got += res - 1;
+            cnt->eot_flag = (dhead.nr & DATA_EOT) >> 7;
+            cnt->hlen = 0;
+            cnt->pending -= got;
+            TRC(fprintf(stderr, "  Got total of %d octets, %d pending\n",
+                got, cnt->pending));
+        }
+        else /* continuation */
+        {
+            TRC(fprintf(stderr, "  Reading middle of TPDU\n"));
+            toget = cnt->pending;
+            if (toget > nbytes - got)
+                toget = nbytes - got;
+            TRC(fprintf(stderr, "  toget=%d\n", toget));
+            if ((res = read(fd, buf + got, toget)) < 0)
+            {
+                TRC(perror("read()"));
+                if (errno == EAGAIN)
+                {
+                    if (got)  /* we got some data in previous cycle */
+                        break;
+                    t_errno = TNODATA; /* no data */
+                    return -1;
+                }
+                t_errno = TSYSERR;
+                return -1;
+            }
+            TRC(fprintf(stderr, "  read() returned %d\n", res));
+            if (res == 0)
+            {
+                t_errno = TLOOK;
+                cnt->event = T_DISCONNECT;
+                return -1;
+            }
+            got += res;
+            cnt->pending -= res;
+            TRC(fprintf(stderr, "  Got total of %d octets, %d pending\n",
+                got, cnt->pending));
+        }
+        TRC(fprintf(stderr, "  bottom of loop: pending=%d, got=%d\n",
+            cnt->pending, got));
     }
     while (cnt->pending && got < nbytes);
     *flags = cnt->pending || !cnt->eot_flag ? T_MORE : 0;
     TRC(fprintf(stderr, "  flags=0x%x\n", *flags));
     if (!cnt->pending)
-       cnt->event = 0;
+        cnt->event = 0;
     TRC(fprintf(stderr, "  Return value: %d\n", got));
     memset(buf + got, 0, 10);
     return got;
@@ -739,11 +743,11 @@ int t_rcv(int fd, char *buf, unsigned nbytes, int *flags)
 
     do
     {
-       if ((res = _t_rcv(fd, buf, nbytes, flags)) <= 0)
-           return res;
-       buf += res;
-       nbytes -= res;
-       total += res;
+        if ((res = _t_rcv(fd, buf, nbytes, flags)) <= 0)
+            return res;
+        buf += res;
+        nbytes -= res;
+        total += res;
     }
     while (*flags & T_MORE && nbytes > 0);
     return total;
@@ -758,9 +762,9 @@ int t_close(int fd)
     TRC(fprintf(stderr, "T_CLOSE\n"));
     if (!cnt || cnt->state == T_UNINIT)
     {
-       TRC(fprintf(stderr, "Trying to close a bad fd.\n"));
-       t_errno = TBADF;
-       return -1;
+        TRC(fprintf(stderr, "Trying to close a bad fd.\n"));
+        t_errno = TBADF;
+        return -1;
     }
     free(cnt);
     return close(fd);
@@ -789,43 +793,43 @@ static int t_look_wait(int fd, int wait)
     TRC(fprintf(stderr, "T_LOOK\n"));
     if (!cnt || cnt->state == T_UNINIT)
     {
-       t_errno = TBADF;
-       return -1;
+        t_errno = TBADF;
+        return -1;
     }
     if (cnt->event)
-       return cnt->event;
+        return cnt->event;
     if (cnt->state == T_IDLE && cnt->tmpfd < 0)
-       return T_LISTEN; /* the only possible type of event */
+        return T_LISTEN; /* the only possible type of event */
     if ((res = read_n(fd, (char*) &head, 6)) < 0)
-       return -1;
+        return -1;
     if (res == 0)
     {
-       TRC(fprintf(stderr, "Network disconnect\n"));
-       return cnt->event = T_DISCONNECT;
+        TRC(fprintf(stderr, "Network disconnect\n"));
+        return cnt->event = T_DISCONNECT;
     }
     TRC(fprintf(stderr, "t_look got %d bytes\n", res));
     if (head.version != RFC_VERSION)
     {
-       TRC(fprintf(stderr, "Got bad RFC1006 version in t_look: %d.\n",
-           head.version));
-       t_errno = TSYSERR; /* should signal protocol error, somehow ## */
-       return -1;
+        TRC(fprintf(stderr, "Got bad RFC1006 version in t_look: %d.\n",
+            head.version));
+        t_errno = TSYSERR; /* should signal protocol error, somehow ## */
+        return -1;
     }
     cnt->curcode = head.code;
     cnt->hlen = head.hlen - 1; /* length of header suffix */
     cnt->pending = ntohs(head.len) - 6 - cnt->hlen;
     TRC(fprintf(stderr, "t_look: len=%d, code=0x%2.2x, hlen=%d.\n",
-       cnt->pending + 6, cnt->curcode, cnt->hlen));
+        cnt->pending + 6, cnt->curcode, cnt->hlen));
     switch (cnt->curcode)
     {
-       case TPDU_CODE_CREQ: cnt->event = T_LISTEN; break;
-       case TPDU_CODE_CCON: cnt->event = T_CONNECT; break;
-       case TPDU_CODE_DATA: cnt->event = T_DATA; break;
-       case TPDU_CODE_DREQ: cnt->event = T_DISCONNECT; break; 
-       default:
-           TRC(fprintf(stderr, "t_look: Bad package: 0x%2.2x.\n", cnt->curcode));
-           t_errno = TSYSERR;  /* protocol error */
-           return -1;
+        case TPDU_CODE_CREQ: cnt->event = T_LISTEN; break;
+        case TPDU_CODE_CCON: cnt->event = T_CONNECT; break;
+        case TPDU_CODE_DATA: cnt->event = T_DATA; break;
+        case TPDU_CODE_DREQ: cnt->event = T_DISCONNECT; break; 
+        default:
+            TRC(fprintf(stderr, "t_look: Bad package: 0x%2.2x.\n", cnt->curcode));
+            t_errno = TSYSERR;  /* protocol error */
+            return -1;
     }
     return cnt->event;
 }    
@@ -850,86 +854,86 @@ int t_bind(int fd, struct t_bind *req, struct t_bind *ret)
     TRC(fprintf(stderr, "T_BIND\n"));
     if (!cnt || cnt->state != T_UNBND)
     {
-       TRC(fprintf(stderr, "Bad state\n"));
-       t_errno = TOUTSTATE;
-       return -1;
+        TRC(fprintf(stderr, "Bad state\n"));
+        t_errno = TOUTSTATE;
+        return -1;
     }
     cnt->ltsel_len = 0;
     if (req)
     {
-       cnt->qlen = req->qlen < MAX_QLEN ? req->qlen : MAX_QLEN;
-       if (req->addr.len)
-       {
-           p = req->addr.buf;
-           if (*p > TSEL_MAXLEN)
-           {
-               TRC(fprintf(stderr, "Tsel too large.\n"));
-               t_errno = TBADADDR;
-               return -1;
-           }
-           cnt->ltsel_len = *p;
-           if (cnt->ltsel_len)
-               memcpy(cnt->ltsel, p + 1, cnt->ltsel_len);
-           p += cnt->ltsel_len + 1;
-           if (*p < sizeof(addr))
-           {
-               TRC(fprintf(stderr, "W: No NSAP provided for local bind\n"));
-           }
-           else
-           {
-               memcpy(&addr, p + 1, sizeof(addr));
-               got_addr = 1;
-           }
-       }
+        cnt->qlen = req->qlen < MAX_QLEN ? req->qlen : MAX_QLEN;
+        if (req->addr.len)
+        {
+            p = req->addr.buf;
+            if (*p > TSEL_MAXLEN)
+            {
+                TRC(fprintf(stderr, "Tsel too large.\n"));
+                t_errno = TBADADDR;
+                return -1;
+            }
+            cnt->ltsel_len = *p;
+            if (cnt->ltsel_len)
+                memcpy(cnt->ltsel, p + 1, cnt->ltsel_len);
+            p += cnt->ltsel_len + 1;
+            if (*p < sizeof(addr))
+            {
+                TRC(fprintf(stderr, "W: No NSAP provided for local bind\n"));
+            }
+            else
+            {
+                memcpy(&addr, p + 1, sizeof(addr));
+                got_addr = 1;
+            }
+        }
     }
     else
-       cnt->qlen = 0;
+        cnt->qlen = 0;
     if (!got_addr) /* user didn't give an address - local bind */
     {
-       addr.sin_family = AF_INET;
-       addr.sin_addr.s_addr = INADDR_ANY;
-       if (cnt->qlen)
-           addr.sin_port = htons(RFC_DEFAULT_PORT);
-       else /* we'll leave binding to connect - just set dummy */
-           addr.sin_port = 0; /* dummy for ret */
+        addr.sin_family = AF_INET;
+        addr.sin_addr.s_addr = INADDR_ANY;
+        if (cnt->qlen)
+            addr.sin_port = htons(RFC_DEFAULT_PORT);
+        else /* we'll leave binding to connect - just set dummy */
+            addr.sin_port = 0; /* dummy for ret */
     }
     if (cnt->qlen && bind(fd, (struct sockaddr *) &addr,
-        sizeof(addr)) < 0 )
+         sizeof(addr)) < 0 )
     {
-       TRC(perror("bind()"));
-       t_errno = TSYSERR; /* this should be refined */
-       return -1;
+        TRC(perror("bind()"));
+        t_errno = TSYSERR; /* this should be refined */
+        return -1;
     }
     if (cnt->qlen)
     {
-       if (listen(fd, cnt->qlen) < 0)
-       {
-           t_errno = TSYSERR;
-           return -1;
-       }
-       cnt->listen = 1;
-       TRC(fprintf(stderr, "  listen OK\n"));
+        if (listen(fd, cnt->qlen) < 0)
+        {
+            t_errno = TSYSERR;
+            return -1;
+        }
+        cnt->listen = 1;
+        TRC(fprintf(stderr, "  listen OK\n"));
     }
     cnt->state = T_IDLE;
     /* All right! Now let's give something back, if our user wants it */
     if (ret)
     {
-       ret->qlen = cnt->qlen;
-       if (ret->addr.maxlen < (ret->addr.len = cnt->ltsel_len + 2 +
-           sizeof(addr)))
-       {
-           /* No space - but we're still bound */
-           t_errno = TBUFOVFLW;
-           ret->addr.len = 0;
-           return -1;
-       }
-       p = ret->addr.buf;
-       *(p++) = cnt->ltsel_len;
-       if (cnt->ltsel_len)
-           memcpy(p, cnt->ltsel, cnt->ltsel_len);
-       p += cnt->ltsel_len;
-       *(p++) = sizeof(addr);
-       memcpy(p, &addr, sizeof(addr));
+        ret->qlen = cnt->qlen;
+        if (ret->addr.maxlen < (ret->addr.len = cnt->ltsel_len + 2 +
+            sizeof(addr)))
+        {
+            /* No space - but we're still bound */
+            t_errno = TBUFOVFLW;
+            ret->addr.len = 0;
+            return -1;
+        }
+        p = ret->addr.buf;
+        *(p++) = cnt->ltsel_len;
+        if (cnt->ltsel_len)
+            memcpy(p, cnt->ltsel, cnt->ltsel_len);
+        p += cnt->ltsel_len;
+        *(p++) = sizeof(addr);
+        memcpy(p, &addr, sizeof(addr));
     }
     return 0;
 }    
@@ -952,64 +956,64 @@ int t_rcvdis(int fd, struct t_discon *discon)
     TRC(fprintf(stderr, "T_RCVDIS\n"));
     if (!cnt) 
     {
-       TRC(fprintf(stderr, "TOUTSTATE\n"));
-       t_errno = TOUTSTATE;
-       return -1;
+        TRC(fprintf(stderr, "TOUTSTATE\n"));
+        t_errno = TOUTSTATE;
+        return -1;
     }
     if (!cnt->event)
-       if (t_look_wait(fd, 1) <= 0)
-           return -1;
+        if (t_look_wait(fd, 1) <= 0)
+            return -1;
     if (cnt->event != T_DISCONNECT)
     {
-       t_errno = TLOOK;
-       return -1;
+        t_errno = TLOOK;
+        return -1;
     }
     /* read the rest of the DR TPDU */
     if (read_n(fd, buf, cnt->hlen) <= 0)
-       return -1;
+        return -1;
     memcpy(&chead, buf, 5);
     cnt->hlen -= 5;
     for (p = buf + 5; cnt->hlen > 0;)
     {
-       switch ((unsigned char)*p)
-       {
-           default:
-               TRC(fprintf(stderr, "Inoring RD parameter: %d\n",
-                   (unsigned char)*p));
-           /* we silently ignore anything else */
-       }
-       p++;
-       cnt->hlen -= (unsigned char) *p + 2;
-       p += (unsigned char) *p + 1;
+        switch ((unsigned char)*p)
+        {
+            default:
+                TRC(fprintf(stderr, "Inoring RD parameter: %d\n",
+                    (unsigned char)*p));
+            /* we silently ignore anything else */
+        }
+        p++;
+        cnt->hlen -= (unsigned char) *p + 2;
+        p += (unsigned char) *p + 1;
     }
     if (cnt->pending)
     {
-       if (read_n(fd, udata, cnt->pending) < cnt->pending)
-       {
-           TRC(fprintf(stderr, "Unable to read user data\n"));
-           t_errno = TSYSERR;
-           return -1;
-       }
+        if (read_n(fd, udata, cnt->pending) < cnt->pending)
+        {
+            TRC(fprintf(stderr, "Unable to read user data\n"));
+            t_errno = TSYSERR;
+            return -1;
+        }
     }
     cnt->state = T_IDLE;  /* should we close transport? */
     cnt->event = 0;
     if (discon)
     {
-       discon->sequence = -1; /* TOFIX */
-       discon->reason = chead.reason;
-       TRC(fprintf(stderr, "Diconnect reason %d\n", chead.reason));
-       if (cnt->pending > discon->udata.maxlen)
-       {
-           t_errno = TBUFOVFLW;
-           return -1;
-       }
-       if (cnt->pending)
-       {
-           memcpy(discon->udata.buf, udata, cnt->pending);
-           udata[cnt->pending] = '\0';
-           TRC(fprintf(stderr, "Discon udata: '%s'\n", udata));
-       }
-       discon->udata.len = cnt->pending;
+        discon->sequence = -1; /* TOFIX */
+        discon->reason = chead.reason;
+        TRC(fprintf(stderr, "Diconnect reason %d\n", chead.reason));
+        if (cnt->pending > discon->udata.maxlen)
+        {
+            t_errno = TBUFOVFLW;
+            return -1;
+        }
+        if (cnt->pending)
+        {
+            memcpy(discon->udata.buf, udata, cnt->pending);
+            udata[cnt->pending] = '\0';
+            TRC(fprintf(stderr, "Discon udata: '%s'\n", udata));
+        }
+        discon->udata.len = cnt->pending;
     }
     return 0;
 }    
@@ -1028,7 +1032,7 @@ char *t_alloc(int fd, int struct_type, int fields)
 {
     char *r = malloc(1024);
     if (!r)
-       return 0;
+        return 0;
     TRC(fprintf(stderr, "T_ALLOC\n"));
     memset(r, 0, 1024);
     return r;
@@ -1045,10 +1049,10 @@ static int switch_fds(int fd1, int fd2)
     
     TRC(fprintf(stderr, "Switching fds %d <--> %d\n", fd1, fd2));
     if ((tmp = dup(fd1)) < 0 ||
-       dup2(fd2, fd1) < 0 ||
-       dup2(tmp, fd2) < 0 ||
-       close(tmp) < 0)
-           return -1;
+        dup2(fd2, fd1) < 0 ||
+        dup2(tmp, fd2) < 0 ||
+        close(tmp) < 0)
+            return -1;
     tmpc = control[fd1];
     control[fd1] = control[fd2];
     control[fd2] = tmpc;
@@ -1069,70 +1073,70 @@ static int rcvconreq(int fd, struct t_call *call)
     TRC(fprintf(stderr, "RCVCONRES\n"));
     if (!call)
     {
-       t_errno = TSYSERR;
-       return -1;
+        t_errno = TSYSERR;
+        return -1;
     }
     for (qslot = 0; qslot < cnt->qlen; qslot++)
-       if (cnt->oci[qslot] < 0)
-           break;
+        if (cnt->oci[qslot] < 0)
+            break;
     if (qslot == cnt->qlen) /* no free slots - shouldn't happen here */
     {
-       t_errno = TBADF;
-       return -1;
+        t_errno = TBADF;
+        return -1;
     }
     /* read the rest of the CREQ TPDU */
     if (read_n(cnt->tmpfd, buf, new->hlen) <= 0)
-       return -1;
+        return -1;
     memcpy(&chead, buf, 5);
     if (chead.class != 0)
     {
-       TRC(fprintf(stderr, "Expected TP0, got %d\n", (int)chead.class));
-       t_errno = TSYSERR;
-       return -1;
+        TRC(fprintf(stderr, "Expected TP0, got %d\n", (int)chead.class));
+        t_errno = TSYSERR;
+        return -1;
     }
     memcpy(new->rref, chead.src_ref, 2); /* we'll echo this back at her */
     new->hlen -= 5;
     if (call && call->addr.maxlen)
-       *(addrp = call->addr.buf) = 0;
+        *(addrp = call->addr.buf) = 0;
     for (p = buf + 5; new->hlen > 0;)
     {
-       switch ((unsigned char)*p)
-       {
-           case TPDU_PARM_TSIZE:
-               new->tsize = 1 << *(p + 2); /* we go with their max */
-               break;
-           case TPDU_PARM_CLDID: break; /* ignore */
-           case TPDU_PARM_CLGID:
-               if (addrp)
-               {
-                   if (*(p + 1) > TSEL_MAXLEN)
-                   {
-                       TRC(fprintf(stderr, "Called TSEL too long.\n"));
-                       t_errno = TSYSERR; /* Wrong.. ## */
-                       return -1;
-                   }
-                   *addrp = *(p + 1); /* length */
-                   memcpy(addrp + 1, p + 2, *(p + 1)); /* remote TSEL */
-                   addrp += *(p + 1); /* move past TSEL */
-               }
-               break;
-           /* we silently ignore preferred TPDU size and others */
-       }
-       p++;
-       new->hlen -= (unsigned char) *p + 2;
-       p += (unsigned char) *p + 1;
+        switch ((unsigned char)*p)
+        {
+            case TPDU_PARM_TSIZE:
+                new->tsize = 1 << *(p + 2); /* we go with their max */
+                break;
+            case TPDU_PARM_CLDID: break; /* ignore */
+            case TPDU_PARM_CLGID:
+                if (addrp)
+                {
+                    if (*(p + 1) > TSEL_MAXLEN)
+                    {
+                        TRC(fprintf(stderr, "Called TSEL too long.\n"));
+                        t_errno = TSYSERR; /* Wrong.. ## */
+                        return -1;
+                    }
+                    *addrp = *(p + 1); /* length */
+                    memcpy(addrp + 1, p + 2, *(p + 1)); /* remote TSEL */
+                    addrp += *(p + 1); /* move past TSEL */
+                }
+                break;
+            /* we silently ignore preferred TPDU size and others */
+        }
+        p++;
+        new->hlen -= (unsigned char) *p + 2;
+        p += (unsigned char) *p + 1;
     }
     if (addrp)
     {
-       addrp++;
-       if (getpeername(cnt->tmpfd, (struct sockaddr*) &addr, &len) < 0)
-       {
-           TRC(perror("getpeername()"));
-           t_errno = TSYSERR;
-           return -1;
-       }
-       *(addrp++) = sizeof(struct sockaddr_in);
-       memcpy(addrp, (struct sockaddr *) &addr, sizeof(struct sockaddr_in));
+        addrp++;
+        if (getpeername(cnt->tmpfd, (struct sockaddr*) &addr, &len) < 0)
+        {
+            TRC(perror("getpeername()"));
+            t_errno = TSYSERR;
+            return -1;
+        }
+        *(addrp++) = sizeof(struct sockaddr_in);
+        memcpy(addrp, (struct sockaddr *) &addr, sizeof(struct sockaddr_in));
     }
     new->event = 0;
     cnt->event = 0;
@@ -1174,118 +1178,118 @@ int t_listen(int fd, struct t_call *call)
     TRC(fprintf(stderr, "T_LISTEN\n"));
     if (!cnt || cnt->state != T_IDLE)
     {
-       TRC(fprintf(stderr, "T_listen expects state==T_IDLE (wrong?)\n"));
-       t_errno = TOUTSTATE;
-       return -1;
+        TRC(fprintf(stderr, "T_listen expects state==T_IDLE (wrong?)\n"));
+        t_errno = TOUTSTATE;
+        return -1;
     }
     if (!cnt->qlen)
     {
-       t_errno = TBADQLEN;
-       return -1;
+        t_errno = TBADQLEN;
+        return -1;
     }
     for (i = 0; i < cnt->qlen; i++)
-       if (cnt->oci[i] < 0)
-           break;
+        if (cnt->oci[i] < 0)
+            break;
     if (i == cnt->qlen) /* no slots in queue */
     {
-       TRC(fprintf(stderr, "No more space in queue\n"));
-       t_errno = TBADF; /* what would be more correct? */
-       return -1;
+        TRC(fprintf(stderr, "No more space in queue\n"));
+        t_errno = TBADF; /* what would be more correct? */
+        return -1;
     }
     if (cnt->tmpfd < 0)
     {
-       TRC(fprintf(stderr, "Accept..."));
-       if ((cnt->tmpfd = accept(fd, (struct sockaddr*) &addr, &addrlen)) < 0)
-       {
-           if (errno == EWOULDBLOCK)
-           {
-               t_errno = TNODATA;
-               TRC(fprintf(stderr, "Accept returned WOULDBLOCK\n"));
-           }
-           else
-           {
-               TRC(fprintf(stderr, "accept failed\n"));
-               t_errno = TSYSERR;
-           }
-           return -1;
-       }
+        TRC(fprintf(stderr, "Accept..."));
+        if ((cnt->tmpfd = accept(fd, (struct sockaddr*) &addr, &addrlen)) < 0)
+        {
+            if (errno == EWOULDBLOCK)
+            {
+                t_errno = TNODATA;
+                TRC(fprintf(stderr, "Accept returned WOULDBLOCK\n"));
+            }
+            else
+            {
+                TRC(fprintf(stderr, "accept failed\n"));
+                t_errno = TSYSERR;
+            }
+            return -1;
+        }
 #ifdef NONBLOCKING_OSI
-       if ((cnt->flags & O_NONBLOCK) && fcntl(cnt->tmpfd, F_SETFL,
-           O_NONBLOCK) < 0)
-       {
-           t_errno = TSYSERR;
-           return -1;
-       }
+        if ((cnt->flags & O_NONBLOCK) && fcntl(cnt->tmpfd, F_SETFL,
+            O_NONBLOCK) < 0)
+        {
+            t_errno = TSYSERR;
+            return -1;
+        }
 #endif
-       tmpfd_is_new = 1;
-       TRC(fprintf(stderr, "Accept OK\n"));
-       if (!(new = control[cnt->tmpfd] = malloc(sizeof(*new))))
-       {
-           TRC(perror("malloc()"));
-           t_errno = TSYSERR;
-           return -1;
-       }
-       new->togo = 0;
-       new->pending = 0;
-       new->state = T_IDLE;
-       new->event = 0;
-       new->listen = 0;
-       new->qlen = cnt->qlen;
-       new->flags = cnt->flags;
-       new->tmpfd = cnt->tmpfd;
-       new->ltsel_len = 0;
-       for (i = 0; i < MAX_QLEN; i++)
-           new->oci[i] = -1;
+        tmpfd_is_new = 1;
+        TRC(fprintf(stderr, "Accept OK\n"));
+        if (!(new = control[cnt->tmpfd] = malloc(sizeof(*new))))
+        {
+            TRC(perror("malloc()"));
+            t_errno = TSYSERR;
+            return -1;
+        }
+        new->togo = 0;
+        new->pending = 0;
+        new->state = T_IDLE;
+        new->event = 0;
+        new->listen = 0;
+        new->qlen = cnt->qlen;
+        new->flags = cnt->flags;
+        new->tmpfd = cnt->tmpfd;
+        new->ltsel_len = 0;
+        for (i = 0; i < MAX_QLEN; i++)
+            new->oci[i] = -1;
     }
     /* we got a network connection. Now try to read transport CREQ TPDU */
     if ((event = t_look_wait(tmpfd_is_new ? cnt->tmpfd : fd, 1)) < 0)
     {
-       if (t_errno == TNODATA)
-       {
-           if (tmpfd_is_new)
-           {
-               /*
-                * We give the user something to select on for the incoming
-                * CR. Switch the new association with the listener socket.
-                */
-               TRC(fprintf(stderr, "Switching FDs\n"));
-               if (switch_fds(cnt->tmpfd, fd) < 0)
-               {
-                   t_errno = TSYSERR;
-                   return -1;
-               }
-           }
-           return -1;
-       }
-       else
-       {
-           t_close(cnt->tmpfd);
-           cnt->tmpfd = -1;
-       }
-       return -1; /* t_look & t_read hopefully set up the right errcodes */
+        if (t_errno == TNODATA)
+        {
+            if (tmpfd_is_new)
+            {
+                /*
+                 * We give the user something to select on for the incoming
+                 * CR. Switch the new association with the listener socket.
+                 */
+                TRC(fprintf(stderr, "Switching FDs\n"));
+                if (switch_fds(cnt->tmpfd, fd) < 0)
+                {
+                    t_errno = TSYSERR;
+                    return -1;
+                }
+            }
+            return -1;
+        }
+        else
+        {
+            t_close(cnt->tmpfd);
+            cnt->tmpfd = -1;
+        }
+        return -1; /* t_look & t_read hopefully set up the right errcodes */
     }
     else
     {
-       /* We got something! */
-       if (event != T_LISTEN)
-       {
-           TRC(fprintf(stderr, "Expected T_LISTEN\n"));
-           t_errno = TLOOK;
-           return -1;
-       }
-       /*
-        * switch back the fds, if necessary */
-       if (!tmpfd_is_new && switch_fds(fd, cnt->tmpfd) < 0)
-       {
-           t_errno = TSYSERR;
-           return -1;
-       }
-       if (rcvconreq(fd, call) < 0)
-       {
-           t_close(cnt->tmpfd);
-           cnt->tmpfd = -1;
-       }
-       return 0;
+        /* We got something! */
+        if (event != T_LISTEN)
+        {
+            TRC(fprintf(stderr, "Expected T_LISTEN\n"));
+            t_errno = TLOOK;
+            return -1;
+        }
+        /*
+         * switch back the fds, if necessary */
+        if (!tmpfd_is_new && switch_fds(fd, cnt->tmpfd) < 0)
+        {
+            t_errno = TSYSERR;
+            return -1;
+        }
+        if (rcvconreq(fd, call) < 0)
+        {
+            t_close(cnt->tmpfd);
+            cnt->tmpfd = -1;
+        }
+        return 0;
     }
 }    
 
@@ -1298,7 +1302,7 @@ int t_listen(int fd, struct t_call *call)
 int t_unbind(int fd)
 {
     TRC(fprintf(stderr,
-       "T_UNBIND [not supported by transport implementation]\n"));
+        "T_UNBIND [not supported by transport implementation]\n"));
     t_errno = TNOTSUPPORT;
     return -1;
 }    
@@ -1317,64 +1321,64 @@ int t_accept(int fd, int resfd, struct t_call *call)
     TRC(fprintf(stderr, "T_ACCEPT\n"));
     if (!listener || listener->state != T_INCON)
     {
-       TRC(fprintf(stderr, "TOUTSTATE\n"));
-       t_errno = TOUTSTATE;
-       return -1;
+        TRC(fprintf(stderr, "TOUTSTATE\n"));
+        t_errno = TOUTSTATE;
+        return -1;
     }
     /* Get the semi-connection */
     if (call->sequence >= listener->qlen || listener->oci[call->sequence] < 0)
     {
-       TRC(fprintf(stderr, "TBADSEQ\n"));
-       t_errno = TBADSEQ;
-       return -1;
+        TRC(fprintf(stderr, "TBADSEQ\n"));
+        t_errno = TBADSEQ;
+        return -1;
     }
     new = control[(newfd = listener->oci[call->sequence])];
     listener->oci[call->sequence] = -1;
     res = control[resfd];
     if (!res)
     {
-       t_errno = TBADF;
-       return -1;
+        t_errno = TBADF;
+        return -1;
     }
     if (res != listener) /* move the new connection */
     {
-       TRC(fprintf(stderr, "  Moving to new fd (%d)\n", resfd));
-       if (res->state != T_IDLE || res->qlen)
-       {
-           TRC(fprintf(stderr, "Trying to move new assc. to bad fd.\n"));
-           t_errno = TBADF;
-           return -1;
-       }
-       dup2(newfd, resfd); /* closes resfd */
-       close(newfd);
-       control[resfd] = new;
-       /* transfer local bindings from res */
-       if (res->ltsel_len)
-           memcpy(control[resfd]->ltsel, res->ltsel, res->ltsel_len);
-       control[resfd]->ltsel_len = res->ltsel_len;
-       free(res);
-       res = control[resfd];
-       listener->event = 0;
-       listener->state = T_IDLE;
+        TRC(fprintf(stderr, "  Moving to new fd (%d)\n", resfd));
+        if (res->state != T_IDLE || res->qlen)
+        {
+            TRC(fprintf(stderr, "Trying to move new assc. to bad fd.\n"));
+            t_errno = TBADF;
+            return -1;
+        }
+        dup2(newfd, resfd); /* closes resfd */
+        close(newfd);
+        control[resfd] = new;
+        /* transfer local bindings from res */
+        if (res->ltsel_len)
+            memcpy(control[resfd]->ltsel, res->ltsel, res->ltsel_len);
+        control[resfd]->ltsel_len = res->ltsel_len;
+        free(res);
+        res = control[resfd];
+        listener->event = 0;
+        listener->state = T_IDLE;
     }
     else /* lose our listener */
     {
-       TRC(fprintf(stderr, "  Moving to listener fd\n"));
-       for (i = 0; i < listener->qlen; i++)
-           if (listener->oci[i] >= 0)
-           {
-               TRC(fprintf(stderr, "Still conn indications on listener\n"));
-               t_errno = TBADF;
-               return -1;
-           }
-       dup2(newfd, fd);
-       close(newfd);
-       control[fd] = new;
-       if (listener->ltsel_len)
-           memcpy(control[resfd]->ltsel, listener->ltsel, listener->ltsel_len);
-       control[resfd]->ltsel_len = listener->ltsel_len;
-       free(listener);
-       res = control[resfd];
+        TRC(fprintf(stderr, "  Moving to listener fd\n"));
+        for (i = 0; i < listener->qlen; i++)
+            if (listener->oci[i] >= 0)
+            {
+                TRC(fprintf(stderr, "Still conn indications on listener\n"));
+                t_errno = TBADF;
+                return -1;
+            }
+        dup2(newfd, fd);
+        close(newfd);
+        control[fd] = new;
+        if (listener->ltsel_len)
+            memcpy(control[resfd]->ltsel, listener->ltsel, listener->ltsel_len);
+        control[resfd]->ltsel_len = listener->ltsel_len;
+        free(listener);
+        res = control[resfd];
     }
     rfc.version = RFC_VERSION;
     rfc.reserved = 0;
@@ -1394,7 +1398,7 @@ int t_accept(int fd, int resfd, struct t_call *call)
     parm[3] = TPDU_PARM_CLDID;
     parm[4] = res->ltsel_len; 
     if (res->ltsel_len)
-       memcpy(parm + 5, res->ltsel, res->ltsel_len);
+        memcpy(parm + 5, res->ltsel, res->ltsel_len);
 
     rfc.len =  htons(4 + 7 + 3 + 2 + res->ltsel_len);
     rfc.hlen = 6 + 3 + 2 + res->ltsel_len;
@@ -1406,9 +1410,9 @@ int t_accept(int fd, int resfd, struct t_call *call)
     vec[2].iov_len = 3 + 2 + res->ltsel_len;
     if (writev(resfd, vec, 3) < 4 + 7 + 3 + (2 + res->ltsel_len))
     {
-       TRC(fprintf(stderr, "writev came up short. Aborting connect\n"));
-       t_errno = TSYSERR;
-       return -1;
+        TRC(fprintf(stderr, "writev came up short. Aborting connect\n"));
+        t_errno = TSYSERR;
+        return -1;
     }
     res->state = T_DATAXFER;
     res->event = 0;
@@ -1420,3 +1424,11 @@ int t_getstate(int fd)
     TRC(fprintf(stderr, "T_GETSTATE\n"));
     return control[fd] ? control[fd]->state : T_UNINIT;
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 908188e..0239f82 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: atoin.c,v 1.6 2005-01-15 19:47:10 adam Exp $
+ * $Id: atoin.c,v 1.7 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -29,8 +29,16 @@ int atoi_n (const char *buf, int len)
     {
         if (isdigit (*(const unsigned char *) buf))
             val = val*10 + (*buf - '0');
-       buf++;
+        buf++;
     }
     return val;
 }
 
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index b300315..8899dde 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_any.c,v 1.3 2005-01-15 19:47:11 adam Exp $
+ * $Id: ber_any.c,v 1.4 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -58,23 +58,23 @@ int completeBER_n(const unsigned char *buf, int len, int level)
     
     if (len > 5000000 || level > 1000)
     {
-       bad = 1;
+        bad = 1;
 #if BER_ANY_DEBUG
-       yaz_log(LOG_LOG, "completeBER lev=%d len=%d", level, len);
+        yaz_log(LOG_LOG, "completeBER lev=%d len=%d", level, len);
 #endif
-       if (level > 1000)
-           return -2;
+        if (level > 1000)
+            return -2;
     }
     if (len < 2)
-       return 0;
+        return 0;
     if (!buf[0] && !buf[1])
-       return -2;
+        return -2;
     if ((res = ber_dectag(b, &zclass, &tag, &cons, len)) <= 0)
-       return 0;
+        return 0;
 #if 0
 /* removed, since ber_dectag never reads that far .. */
     if (res > len)
-       return 0;
+        return 0;
 #endif
     b += res;
     len -= res;
@@ -83,36 +83,36 @@ int completeBER_n(const unsigned char *buf, int len, int level)
     if (res == -2)
     {
 #if BER_ANY_DEBUG
-       if (bad)
-           yaz_log(LOG_LOG, "<<<<<<<<< return1 lev=%d res=%d", level, res);
+        if (bad)
+            yaz_log(LOG_LOG, "<<<<<<<<< return1 lev=%d res=%d", level, res);
 #endif
-       return -1;  /* error */
+        return -1;  /* error */
     }
     if (res == -1)  
     {
 #if BER_ANY_DEBUG
-       if (bad)
-           yaz_log(LOG_LOG, "<<<<<<<<< return3 lev=%d res=-1", level);
+        if (bad)
+            yaz_log(LOG_LOG, "<<<<<<<<< return3 lev=%d res=-1", level);
 #endif
-       return 0;    /* incomplete length */
+        return 0;    /* incomplete length */
     }
     if (ll > 5000000)
     {
 #if BER_ANY_DEBUG
-       if (bad)
-           yaz_log(LOG_LOG, "<<<<<<<<< return2 lev=%d len=%d res=%d ll=%d",
-                   level, len, res, ll);
+        if (bad)
+            yaz_log(LOG_LOG, "<<<<<<<<< return2 lev=%d len=%d res=%d ll=%d",
+                    level, len, res, ll);
 #endif
-       return -1;  /* error */
+        return -1;  /* error */
     }
 #if 0
 /* no longer necessary, since ber_declen never reads that far (returns -1) */
     if (res > len)
     {
-       if (bad)
-           yaz_log(LOG_LOG, "<<<<<<<<< return4 lev=%d res=%d len=%d",
-                   level, res, len);
-       return 0;
+        if (bad)
+            yaz_log(LOG_LOG, "<<<<<<<<< return4 lev=%d res=%d len=%d",
+                    level, res, len);
+        return 0;
     }
 #endif
     b += res;
@@ -120,35 +120,35 @@ int completeBER_n(const unsigned char *buf, int len, int level)
     if (ll >= 0)
     {   /* definite length */
 #if BER_ANY_DEBUG
-       if (bad && len < ll)
-           yaz_log(LOG_LOG, "<<<<<<<<< return5 lev=%d len=%d ll=%d",
-                   level, len, ll);
+        if (bad && len < ll)
+            yaz_log(LOG_LOG, "<<<<<<<<< return5 lev=%d len=%d ll=%d",
+                    level, len, ll);
 #endif
-       return (len >= ll ? ll + (b-buf) : 0);
+        return (len >= ll ? ll + (b-buf) : 0);
     }
     /* indefinite length */
     if (!cons)
     {   /* if primitive, it's an error */
 #if BER_ANY_DEBUG
-       yaz_log(LOG_LOG, "<<<<<<<<< return6 lev=%d ll=%d len=%d res=%d",
-               level, ll, len, res);
+        yaz_log(LOG_LOG, "<<<<<<<<< return6 lev=%d ll=%d len=%d res=%d",
+                level, ll, len, res);
 #endif
-       return -1;   /* error */
+        return -1;   /* error */
     }
     /* constructed - cycle through children */
     while (len >= 2)
     {
-       if (b[0] == 0 && b[1] == 0)
-           break;
-       if (!(res = completeBER_n(b, len, level+1)))
-           return 0;
-       if (res == -1)
-           return -1;
-       b += res;
-       len -= res;
+        if (b[0] == 0 && b[1] == 0)
+            break;
+        if (!(res = completeBER_n(b, len, level+1)))
+            return 0;
+        if (res == -1)
+            return -1;
+        b += res;
+        len -= res;
     }
     if (len < 2)
-       return 0;
+        return 0;
     return (b - buf) + 2;
 }
 
@@ -156,6 +156,14 @@ int completeBER(const unsigned char *buf, int len)
 {
     int res = completeBER_n(buf, len, 0);
     if (res < 0)
-       return len;
+        return len;
     return res;
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 39bf989..7fbaed1 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_bit.c,v 1.3 2005-01-15 19:47:11 adam Exp $
+ * $Id: ber_bit.c,v 1.4 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -82,3 +82,11 @@ int ber_bitstring(ODR o, Odr_bitmask *p, int cons)
         return 0;
     }
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index e2cbeda..8d74df9 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_bool.c,v 1.3 2005-01-15 19:47:11 adam Exp $
+ * $Id: ber_bool.c,v 1.4 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -58,3 +58,11 @@ int ber_boolean(ODR o, int *val)
     default: odr_seterror(o, OOTHER, 11); return 0;
     }
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index fc89b0d..84e560b 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_int.c,v 1.4 2005-01-16 21:51:50 adam Exp $
+ * $Id: ber_int.c,v 1.5 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -41,21 +41,21 @@ int ber_integer(ODR o, int *val)
     switch (o->direction)
     {
     case ODR_DECODE:
-       if ((res = ber_decinteger(o->bp, val, odr_max(o))) <= 0)
-       {
-           odr_seterror(o, OPROTO, 50);
-           return 0;
-       }
-       o->bp += res;
-       return 1;
+        if ((res = ber_decinteger(o->bp, val, odr_max(o))) <= 0)
+        {
+            odr_seterror(o, OPROTO, 50);
+            return 0;
+        }
+        o->bp += res;
+        return 1;
     case ODR_ENCODE:
-       if ((res = ber_encinteger(o, *val)) < 0)
-           return 0;
-       return 1;
+        if ((res = ber_encinteger(o, *val)) < 0)
+            return 0;
+        return 1;
     case ODR_PRINT:
-       return 1;
+        return 1;
     default:
-       odr_seterror(o, OOTHER, 51);  return 0;
+        odr_seterror(o, OOTHER, 51);  return 0;
     }
 }
 
@@ -116,3 +116,11 @@ int ber_decinteger(const unsigned char *buf, int *val, int max)
 #endif
     return b - buf;
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 4075ea6..1a02fde 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_len.c,v 1.3 2005-01-15 19:47:11 adam Exp $
+ * $Id: ber_len.c,v 1.4 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -40,49 +40,49 @@ int ber_enclen(ODR o, int len, int lenlen, int exact)
 #endif
     if (len < 0)      /* Indefinite */
     {
-       if (odr_putc(o, 0x80) < 0)
-           return 0;
+        if (odr_putc(o, 0x80) < 0)
+            return 0;
 #ifdef ODR_DEBUG
-       fprintf(stderr, "[indefinite]");
+        fprintf(stderr, "[indefinite]");
 #endif
-       return 0;
+        return 0;
     }
     if (len <= 127 && (lenlen == 1 || !exact)) /* definite short form */
     {
-       if (odr_putc(o, (unsigned char) len) < 0)
-           return 0;
-       return 1;
+        if (odr_putc(o, (unsigned char) len) < 0)
+            return 0;
+        return 1;
     }
     if (lenlen == 1)
     {
-       if (odr_putc(o, 0x80) < 0)
-           return 0;
-       return 0;
+        if (odr_putc(o, 0x80) < 0)
+            return 0;
+        return 0;
     }
     /* definite long form */
     do
     {
-       octs[n++] = len;
-       len >>= 8;
+        octs[n++] = len;
+        len >>= 8;
     }
     while (len);
     if (n >= lenlen)
-       return -1;
+        return -1;
     lenpos = odr_tell(o); /* remember length-of-length position */
     if (odr_putc(o, 0) < 0)  /* dummy */
-       return 0;
+        return 0;
     if (exact)
-       while (n < --lenlen)        /* pad length octets */
-           if (odr_putc(o, 0) < 0)
-               return 0;
+        while (n < --lenlen)        /* pad length octets */
+            if (odr_putc(o, 0) < 0)
+                return 0;
     while (n--)
-       if (odr_putc(o, octs[n]) < 0)
-           return 0;
+        if (odr_putc(o, octs[n]) < 0)
+            return 0;
     /* set length of length */
     end = odr_tell(o);
     odr_seek(o, ODR_S_SET, lenpos);
     if (odr_putc(o, (end - lenpos - 1) | 0X80) < 0)
-       return 0;
+        return 0;
     odr_seek(o, ODR_S_END, 0);
     return odr_tell(o) - lenpos;
 }
@@ -107,22 +107,22 @@ int ber_declen(const unsigned char *buf, int *len, int max)
         return -1;
     if (*b == 0X80)     /* Indefinite */
     {
-       *len = -1;
+        *len = -1;
 #ifdef ODR_DEBUG
-       fprintf(stderr, "[len=%d]", *len);
+        fprintf(stderr, "[len=%d]", *len);
 #endif
-       return 1;
+        return 1;
     }
     if (!(*b & 0X80))   /* Definite short form */
     {
-       *len = (int) *b;
+        *len = (int) *b;
 #ifdef ODR_DEBUG
-       fprintf(stderr, "[len=%d]", *len);
+        fprintf(stderr, "[len=%d]", *len);
 #endif
-       return 1;
+        return 1;
     }
     if (*b == 0XFF)     /* reserved value */
-       return -2;
+        return -2;
     /* indefinite long form */ 
     n = *b & 0X7F;
     if (n >= max)
@@ -131,8 +131,8 @@ int ber_declen(const unsigned char *buf, int *len, int max)
     b++;
     while (--n >= 0)
     {
-       *len <<= 8;
-       *len |= *(b++);
+        *len <<= 8;
+        *len |= *(b++);
     }
     if (*len < 0)
         return -2;
@@ -141,3 +141,11 @@ int ber_declen(const unsigned char *buf, int *len, int max)
 #endif
     return (b - buf);
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 526e491..7797e13 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_null.c,v 1.3 2005-01-15 19:47:11 adam Exp $
+ * $Id: ber_null.c,v 1.4 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -48,9 +48,17 @@ int ber_null(ODR o)
 #endif
         return 1;
     case ODR_PRINT:
-       return 1;
+        return 1;
     default:
-       odr_seterror(o, OOTHER, 13);
-       return 0;
+        odr_seterror(o, OOTHER, 13);
+        return 0;
     }
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index a69219d..593cc11 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_oct.c,v 1.3 2005-01-15 19:47:11 adam Exp $
+ * $Id: ber_oct.c,v 1.4 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -28,59 +28,67 @@ int ber_octetstring(ODR o, Odr_oct *p, int cons)
     switch (o->direction)
     {
     case ODR_DECODE:
-       if ((res = ber_declen(o->bp, &len, odr_max(o))) < 0)
-       {
-           odr_seterror(o, OPROTO, 14);
-           return 0;
-       }
-       o->bp += res;
-       if (cons)       /* fetch component strings */
-       {
-           base = o->bp;
-           while (odp_more_chunks(o, base, len))
-               if (!odr_octetstring(o, &p, 0, 0))
-                   return 0;
-           return 1;
-       }
-       /* primitive octetstring */
-       if (len < 0)
-       {
-           odr_seterror(o, OOTHER, 15);
-           return 0;
-       }
-       if (len > odr_max(o))
-       {
-           odr_seterror(o, OOTHER, 16);
-           return 0;
-       }
-       if (len + 1 > p->size - p->len)
-       {
-           c = (unsigned char *)odr_malloc(o, p->size += len + 1);
-           if (p->len)
-               memcpy(c, p->buf, p->len);
-           p->buf = c;
-       }
-       if (len)
-           memcpy(p->buf + p->len, o->bp, len);
-       p->len += len;
-       o->bp += len;
-       /* the final null is really not part of the buffer, but */
-       /* it helps somes applications that assumes C strings */
-       if (len)
-           p->buf[p->len] = '\0';
-       return 1;
+        if ((res = ber_declen(o->bp, &len, odr_max(o))) < 0)
+        {
+            odr_seterror(o, OPROTO, 14);
+            return 0;
+        }
+        o->bp += res;
+        if (cons)       /* fetch component strings */
+        {
+            base = o->bp;
+            while (odp_more_chunks(o, base, len))
+                if (!odr_octetstring(o, &p, 0, 0))
+                    return 0;
+            return 1;
+        }
+        /* primitive octetstring */
+        if (len < 0)
+        {
+            odr_seterror(o, OOTHER, 15);
+            return 0;
+        }
+        if (len > odr_max(o))
+        {
+            odr_seterror(o, OOTHER, 16);
+            return 0;
+        }
+        if (len + 1 > p->size - p->len)
+        {
+            c = (unsigned char *)odr_malloc(o, p->size += len + 1);
+            if (p->len)
+                memcpy(c, p->buf, p->len);
+            p->buf = c;
+        }
+        if (len)
+            memcpy(p->buf + p->len, o->bp, len);
+        p->len += len;
+        o->bp += len;
+        /* the final null is really not part of the buffer, but */
+        /* it helps somes applications that assumes C strings */
+        if (len)
+            p->buf[p->len] = '\0';
+        return 1;
     case ODR_ENCODE:
-       if ((res = ber_enclen(o, p->len, 5, 0)) < 0)
-           return 0;
-       if (p->len == 0)
-           return 1;
-       if (odr_write(o, p->buf, p->len) < 0)
-           return 0;
-       return 1;
+        if ((res = ber_enclen(o, p->len, 5, 0)) < 0)
+            return 0;
+        if (p->len == 0)
+            return 1;
+        if (odr_write(o, p->buf, p->len) < 0)
+            return 0;
+        return 1;
     case ODR_PRINT:
-       return 1;
+        return 1;
     default:
-       odr_seterror(o, OOTHER, 17);
-       return 0;
+        odr_seterror(o, OOTHER, 17);
+        return 0;
     }
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index e1947d6..6a0541e 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_oid.c,v 1.6 2005-05-26 21:46:40 adam Exp $
+ * $Id: ber_oid.c,v 1.7 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -44,8 +44,8 @@ int ber_oidc(ODR o, Odr_oid *p, int max_oid_size)
             return 0;
         }
         pos = 0;
-       while (len)
-       {
+        while (len)
+        {
             int id = 0;
             do
             {
@@ -61,20 +61,20 @@ int ber_oidc(ODR o, Odr_oid *p, int max_oid_size)
             while (*(o->bp++) & 0X80);
             if (pos > 0)
                 p[pos++] = id;
-           else
+            else
             {
                 p[0] = id / 40;
-               if (p[0] > 2)
+                if (p[0] > 2)
                     p[0] = 2;
-               p[1] = id - p[0] * 40;
-               pos = 2;
+                p[1] = id - p[0] * 40;
+                pos = 2;
+            }
+            if (pos >= max_oid_size)
+            {
+                odr_seterror(o, OPROTO, 55);
+                return 0;
             }
-           if (pos >= max_oid_size)
-           {
-               odr_seterror(o, OPROTO, 55);
-               return 0;
-           }
-       }
+        }
         p[pos] = -1;
         return 1;
     case ODR_ENCODE:
@@ -93,7 +93,7 @@ int ber_oidc(ODR o, Odr_oid *p, int max_oid_size)
             n = 0;
             if (pos == 1)
                 id = p[0]*40 + p[1];
-           else 
+            else 
                 id = p[pos];
             do
             {
@@ -124,3 +124,11 @@ int ber_oidc(ODR o, Odr_oid *p, int max_oid_size)
         return 0;
     }
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index b6f7644..64908d7 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: ber_tag.c,v 1.4 2005-01-15 19:47:11 adam Exp $
+ * $Id: ber_tag.c,v 1.5 2005-06-25 15:46:03 adam Exp $
  */
 
 /** 
@@ -21,8 +21,8 @@
 
 /* ber_tag
  * On encoding:
- *     if  p: write tag. return 1 (success) or -1 (error).
- *     if !p: return 0.
+ *      if  p: write tag. return 1 (success) or -1 (error).
+ *      if !p: return 0.
  * On decoding:
  *      if tag && zclass match up, advance pointer and return 1. set cons.
  *      else leave pointer unchanged. Return 0.
@@ -37,13 +37,13 @@ int ber_tag(ODR o, void *p, int zclass, int tag, int *constructed, int opt,
     char **pp = (char **)p;
 
     if (o->direction == ODR_DECODE)
-       *pp = 0;
+        *pp = 0;
     o->t_class = -1;
     if (o->op->stackp < 0)
     {
-       odr_seek(o, ODR_S_SET, 0);
+        odr_seek(o, ODR_S_SET, 0);
         o->top = 0;
-       o->bp = o->buf;
+        o->bp = o->buf;
         odr_ber_tag->lclass = -1;
     }
     switch (o->direction)
@@ -137,31 +137,31 @@ int ber_enctag(ODR o, int zclass, int tag, int constructed)
     b |= (cons << 5) & 0X20;
     if (tag <= 30)
     {
-       b |= tag & 0X1F;
-       if (odr_putc(o, b) < 0)
-           return -1;
-       return 1;
+        b |= tag & 0X1F;
+        if (odr_putc(o, b) < 0)
+            return -1;
+        return 1;
     }
     else
     {
-       b |= 0X1F;
-       if (odr_putc(o, b) < 0)
-           return -1;
-       do
-       {
-           octs[n++] = tag & 0X7F;
-           tag >>= 7;
-       }
-       while (tag);
-       while (n--)
-       {
-           unsigned char oo;
+        b |= 0X1F;
+        if (odr_putc(o, b) < 0)
+            return -1;
+        do
+        {
+            octs[n++] = tag & 0X7F;
+            tag >>= 7;
+        }
+        while (tag);
+        while (n--)
+        {
+            unsigned char oo;
 
-           oo = octs[n] | ((n > 0) << 7);
-           if (odr_putc(o, oo) < 0)
-               return -1;
-       }
-       return 0;
+            oo = octs[n] | ((n > 0) << 7);
+            if (odr_putc(o, oo) < 0)
+                return -1;
+        }
+        return 0;
     }
 }
 
@@ -179,15 +179,23 @@ int ber_dectag(const unsigned char *b, int *zclass, int *tag,
     *zclass = *b >> 6;
     *constructed = (*b >> 5) & 0X01;
     if ((*tag = *b & 0x1F) <= 30)
-       return 1;
+        return 1;
     *tag = 0;
     do
     {
         if (l >= max)
             return -1;
-       *tag <<= 7;
-       *tag |= b[l] & 0X7F;
+        *tag <<= 7;
+        *tag |= b[l] & 0X7F;
     }
     while (b[l++] & 0X80);
     return l;
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 2c4256b..201e0aa 100644 (file)
@@ -54,7 +54,7 @@
 /*
  * Europagate, 1995
  *
- * $Id: cclerrms.c,v 1.2 2004-10-15 00:18:59 adam Exp $
+ * $Id: cclerrms.c,v 1.3 2005-06-25 15:46:03 adam Exp $
  *
  * Old Europagate Log:
  *
@@ -108,3 +108,11 @@ const char *ccl_err_msg (int ccl_errno)
 {
     return err_msg_array[ccl_errno];
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 9037887..72f1aa6 100644 (file)
@@ -56,7 +56,7 @@
 /* CCL find (to rpn conversion)
  * Europagate, 1995
  *
- * $Id: cclfind.c,v 1.7 2005-03-15 16:32:52 adam Exp $
+ * $Id: cclfind.c,v 1.8 2005-06-25 15:46:03 adam Exp $
  *
  * Old Europagate log:
  *
@@ -140,7 +140,7 @@ static int qual_val_type (struct ccl_rpn_attr **qa, int type, int value,
         while (q)
         {
             if (q->type == type && q->kind == CCL_RPN_ATTR_NUMERIC &&
-               q->value.numeric == value)
+                q->value.numeric == value)
             {
                 if (attset)
                     *attset = q->set;
@@ -216,8 +216,8 @@ void ccl_rpn_delete (struct ccl_rpn_node *rpn)
         for (attr = rpn->u.t.attr_list; attr; attr = attr1)
         {
             attr1 = attr->next;
-           if (attr->kind == CCL_RPN_ATTR_STRING)
-               xfree(attr->value.str);
+            if (attr->kind == CCL_RPN_ATTR_STRING)
+                xfree(attr->value.str);
             if (attr->set)
                 xfree (attr->set);
             xfree (attr);
@@ -250,7 +250,7 @@ static struct ccl_rpn_node *search_terms (CCL_parser cclp,
                                           struct ccl_rpn_attr **qa);
 
 static struct ccl_rpn_attr *add_attr_node (struct ccl_rpn_node *p,
-                                          const char *set, int type)
+                                           const char *set, int type)
 {
     struct ccl_rpn_attr *n;
     
@@ -280,7 +280,7 @@ static struct ccl_rpn_attr *add_attr_node (struct ccl_rpn_node *p,
  * set: Attribute set name
  */
 static void add_attr_numeric (struct ccl_rpn_node *p, const char *set,
-                             int type, int value)
+