[Forensics-changes] [afflib] 01/02: Imported Upstream version 3.7.7+git20160511.4fd23a

Joao Eriberto Mota Filho eriberto at moszumanska.debian.org
Mon May 16 11:23:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

eriberto pushed a commit to branch debian
in repository afflib.

commit c65b2e3de5f7bffc399c38e323c209ec7ef7c77d
Author: Joao Eriberto Mota Filho <eriberto at debian.org>
Date:   Mon May 16 08:23:00 2016 -0300

    Imported Upstream version 3.7.7+git20160511.4fd23a
---
 README                    |  1 -
 configure.ac              |  5 +--
 lib/aff_db.cpp            |  2 +-
 lib/aff_toc.cpp           |  2 +-
 lib/afflib.cpp            | 18 +++++-----
 lib/afflib.h              |  4 +--
 lib/afflib_pages.cpp      | 34 +++++++++---------
 lib/afflib_stream.cpp     |  8 ++---
 lib/aftest.cpp            |  9 +++++
 lib/vnode_aff.cpp         |  8 ++---
 lib/vnode_afm.cpp         |  6 ++--
 lib/vnode_split_raw.cpp   |  4 +--
 lzma443/C/Common/String.h |  2 +-
 lzma443/C/Common/Vector.h |  2 +-
 man/affcat.1              |  2 +-
 man/affconvert.1          | 17 ++++++++-
 tools/aff_bom.cpp         | 24 +++++++------
 tools/affcat.cpp          | 16 ++++-----
 tools/affcompare.cpp      | 34 +++++++++---------
 tools/affconvert.cpp      | 23 ++++--------
 tools/affcopy.cpp         |  6 +---
 tools/affdiskprint.cpp    |  6 ++--
 tools/affinfo.cpp         | 92 +++++++++--------------------------------------
 tools/affix.cpp           |  6 +---
 tools/affrecover.cpp      |  4 ---
 tools/affsegment.cpp      |  6 ++--
 tools/affstats.cpp        |  8 ++---
 tools/affverify.cpp       |  2 +-
 tools/affxml.cpp          | 10 +++---
 29 files changed, 149 insertions(+), 212 deletions(-)

diff --git a/README b/README
index 18b6781..e79b550 100644
--- a/README
+++ b/README
@@ -30,7 +30,6 @@ forensic information. Using these tools you can:
 
    - raw or "dd" 
    - splitraw (in which a single image is split between mulitple files)
-   - EnCase or "E01" format
    - AFF format (in which the entire disk image is stored in a single file.)
    - AFD format (in which a disk image is stored in mulitple AFF files
      stored in a single directory.)
diff --git a/configure.ac b/configure.ac
index a5bab0b..88500aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,7 +81,7 @@ AC_STRUCT_ST_RDEV
 
 
 # Specific headers that I plan to use
-AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h dmalloc.h err.h errno.h fcntl.h getopt.h inttypes.h linux/fs.h malloc.h netinet/in.h regex.h signal.h stdint.h stdio.h stdlib.h string.h sys/cdefs.h sys/disk.h sys/file.h sys/ioctl.h sys/ioctl.h sys/param.h sys/param.h sys/socket.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/vfs.h sysexits.h term.h time.h unistd.h zlib.h _mingw.h])
+AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h dmalloc.h err.h errno.h fcntl.h getopt.h inttypes.h linux/fs.h malloc.h netinet/in.h regex.h signal.h stdint.h stdio.h stdlib.h string.h sys/cdefs.h sys/disk.h sys/file.h sys/ioctl.h sys/ioctl.h sys/param.h sys/param.h sys/socket.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/vfs.h sysexits.h time.h unistd.h zlib.h _mingw.h])
 
 AC_CHECK_LIB([regex],[regcomp])        # see if we need -lregex
 
@@ -113,12 +113,9 @@ AC_LANG_POP([C++])
 ################################################################
 # For AFF tools
 AC_CHECK_HEADERS([readline/readline.h])
-AC_CHECK_HEADERS([curses.h termcap.h])
 AC_CHECK_LIB([readline],[readline],, AC_MSG_RESULT([readline not installed]))
 AC_CHECK_LIB([z],[uncompress],, AC_MSG_ERROR([zlib not installed; cannot continue. Try adding zlib-dev or zlib1g-dev.]))
 AC_CHECK_LIB([rt],[aio_error64])
-AC_SEARCH_LIBS(tgetent, termlib termcap curses)
-AC_CHECK_FUNCS(putp tputs tgoto tgetstr tgetnum gotorc beep endwin setupterm printw)
 
 ################################################################
 ## Expat
diff --git a/lib/aff_db.cpp b/lib/aff_db.cpp
index 1bc82d8..5894cb1 100644
--- a/lib/aff_db.cpp
+++ b/lib/aff_db.cpp
@@ -50,7 +50,7 @@ int af_probe_next_seg(AFFILE *af,
     uint32_t name_len = ntohl(segh.name_len);
     uint32_t datasize = ntohl(segh.data_len);
     if(name_len>AF_MAX_NAME_LEN){
-	snprintf(af->error_str,sizeof(af->error_str),"afflib: name_len=%"PRIu32" (an outrageous value)",name_len);
+	snprintf(af->error_str,sizeof(af->error_str),"afflib: name_len=%" PRIu32 " (an outrageous value)",name_len);
 	return AF_ERROR_NAME;
     }
 
diff --git a/lib/aff_toc.cpp b/lib/aff_toc.cpp
index 67b9408..c3d10ed 100644
--- a/lib/aff_toc.cpp
+++ b/lib/aff_toc.cpp
@@ -29,7 +29,7 @@ void	aff_toc_print(AFFILE *af)
     printf("AF DIRECTORY:\n");
     for(int i=0;i<af->toc_count;i++){
 	if(af->toc[i].name){
-	    printf("%-32s @%"I64u" len: %"I64u" \n",af->toc[i].name, af->toc[i].offset,af->toc[i].segment_len);
+	    printf("%-32s @%" I64u " len: %" I64u " \n",af->toc[i].name, af->toc[i].offset,af->toc[i].segment_len);
 	}
     }
 }
diff --git a/lib/afflib.cpp b/lib/afflib.cpp
index 85688ad..4baa820 100644
--- a/lib/afflib.cpp
+++ b/lib/afflib.cpp
@@ -455,7 +455,7 @@ int af_close(AFFILE *af)
 uint64_t af_seek(AFFILE *af,int64_t pos,int whence)
 {
     AF_WRLOCK(af);
-    if(af_trace) fprintf(af_trace,"af_seek(%p,%"I64d",%d)\n",af,pos,whence);
+    if(af_trace) fprintf(af_trace,"af_seek(%p,%" I64d ",%d)\n",af,pos,whence);
     uint64_t new_pos=0;
     switch(whence){
     case SEEK_SET:
@@ -788,7 +788,7 @@ int af_rewind_seg(AFFILE *af)
 int af_update_segf(AFFILE *af, const char *segname,
 		  uint32_t arg,const u_char *data,uint32_t datalen,uint32_t flag)
 {
-    if(af_trace) fprintf(af_trace,"af_update_segf(%p,segname=%s,arg=%"PRIu32",datalen=%d)\n",
+    if(af_trace) fprintf(af_trace,"af_update_segf(%p,segname=%s,arg=%" PRIu32 ",datalen=%d)\n",
 			 af,segname,arg,datalen);
     AF_WRLOCK(af);
     if(af->v->update_seg==0){
@@ -954,13 +954,13 @@ void af_stats(AFFILE *af,FILE *f)
 {
     AF_READLOCK(af);
     fprintf(f,"AFSTATS for %s\n",af_filename(af));
-    fprintf(f,"Pages read: %"I64u"\n",af->pages_read);
-    fprintf(f,"Pages written: %"I64u"\n",af->pages_written);
-    fprintf(f,"Pages compressed: %"I64u"\n",af->pages_compressed);
-    fprintf(f,"Pages decompressed: %"I64u"\n",af->pages_decompressed);
-    fprintf(f,"Cache hits: %"I64u"\n",af->cache_hits);
-    fprintf(f,"Cache misses: %"I64u"\n",af->cache_misses);
-    fprintf(f,"Bytes copied: %"I64u"\n",af->bytes_memcpy);
+    fprintf(f,"Pages read: %" I64u "\n",af->pages_read);
+    fprintf(f,"Pages written: %" I64u "\n",af->pages_written);
+    fprintf(f,"Pages compressed: %" I64u "\n",af->pages_compressed);
+    fprintf(f,"Pages decompressed: %" I64u "\n",af->pages_decompressed);
+    fprintf(f,"Cache hits: %" I64u "\n",af->cache_hits);
+    fprintf(f,"Cache misses: %" I64u "\n",af->cache_misses);
+    fprintf(f,"Bytes copied: %" I64u "\n",af->bytes_memcpy);
     AF_UNLOCK(af);
 }
 
diff --git a/lib/afflib.h b/lib/afflib.h
index af4cf86..ef1a069 100644
--- a/lib/afflib.h
+++ b/lib/afflib.h
@@ -406,7 +406,7 @@ int af_hash_verify_seg2(AFFILE *af,const char *segname,unsigned char *sigbuf_,si
 #define AF_SECTORSIZE	"sectorsize"	// in bytes, stored in arg
 #define AF_DEVICE_SECTORS "devicesectors"// stored as a 64-bit number
 #define AF_BADFLAG      "badflag"	// data used to mark a bad sector
-#define AF_PAGE		"page%"I64d	// segment flag indicates compression (replaces seg%d)
+#define AF_PAGE		"page%" I64d	// segment flag indicates compression (replaces seg%d)
 #define AF_PAGE_MD5	AF_PAGE"_md5"	// md5 hash of page
 #define AF_PAGE_SHA1	AF_PAGE"_sha1"	// sha1 hash of page
 #define AF_PAGE_SHA256	AF_PAGE"_sha256"// sha256 hash of page
@@ -428,7 +428,7 @@ int af_hash_verify_seg2(AFFILE *af,const char *segname,unsigned char *sigbuf_,si
 #define AF_BOM_SEG "affbom%d"
 
 /* Deprecated terminology; pages were originally called data segments */
-#define AF_SEG_D        "seg%"I64d	// segment flag indicates compression (deprecated)
+#define AF_SEG_D        "seg%" I64d	// segment flag indicates compression (deprecated)
 #define AF_SEGSIZE_D	"segsize"	// segment data size (deprecated)
 
 /* Bill of Materials */
diff --git a/lib/afflib_pages.cpp b/lib/afflib_pages.cpp
index df57229..2569c2a 100644
--- a/lib/afflib_pages.cpp
+++ b/lib/afflib_pages.cpp
@@ -168,7 +168,7 @@ int af_get_page(AFFILE *af,int64_t pagenum,unsigned char *data,size_t *bytes)
     size_t page_len=0;
 
     if (af_trace){
-	fprintf(af_trace,"af_get_page(%p,pagenum=%"I64d",buf=%p,bytes=%u)\n",af,pagenum,data,(int)*bytes);
+	fprintf(af_trace,"af_get_page(%p,pagenum=%" I64d ",buf=%p,bytes=%u)\n",af,pagenum,data,(int)*bytes);
     }
 
     /* Find out the size of the segment and if it is compressed or not.
@@ -247,17 +247,17 @@ int af_get_page(AFFILE *af,int64_t pagenum,unsigned char *data,size_t *bytes)
 	    case Z_OK:
 		break;
 	    case Z_ERRNO:
-		(*af->error_reporter)("Z_ERRNOR decompressing segment %"I64d,pagenum);
+		(*af->error_reporter)("Z_ERRNOR decompressing segment %" I64d,pagenum);
 	    case Z_STREAM_ERROR:
-		(*af->error_reporter)("Z_STREAM_ERROR decompressing segment %"I64d,pagenum);
+		(*af->error_reporter)("Z_STREAM_ERROR decompressing segment %" I64d,pagenum);
 	    case Z_DATA_ERROR:
-		(*af->error_reporter)("Z_DATA_ERROR decompressing segment %"I64d,pagenum);
+		(*af->error_reporter)("Z_DATA_ERROR decompressing segment %" I64d,pagenum);
 	    case Z_MEM_ERROR:
-		(*af->error_reporter)("Z_MEM_ERROR decompressing segment %"I64d,pagenum);
+		(*af->error_reporter)("Z_MEM_ERROR decompressing segment %" I64d,pagenum);
 	    case Z_BUF_ERROR:
-		(*af->error_reporter)("Z_BUF_ERROR decompressing segment %"I64d,pagenum);
+		(*af->error_reporter)("Z_BUF_ERROR decompressing segment %" I64d,pagenum);
 	    case Z_VERSION_ERROR:
-		(*af->error_reporter)("Z_VERSION_ERROR decompressing segment %"I64d,pagenum);
+		(*af->error_reporter)("Z_VERSION_ERROR decompressing segment %" I64d,pagenum);
 	    default:
 		(*af->error_reporter)("uncompress returned an invalid value in get_segment");
 	    }
@@ -266,13 +266,13 @@ int af_get_page(AFFILE *af,int64_t pagenum,unsigned char *data,size_t *bytes)
 #ifdef USE_LZMA
 	case AF_PAGE_COMP_ALG_LZMA:
 	    res = lzma_uncompress(data,bytes,compressed_data,compressed_data_len);
-	    if (af_trace) fprintf(af_trace,"   LZMA decompressed page %"I64d". %d bytes => %u bytes\n",
+	    if (af_trace) fprintf(af_trace,"   LZMA decompressed page %" I64d ". %d bytes => %u bytes\n",
 				  pagenum,(int)compressed_data_len,(int)*bytes);
 	    switch(res){
 	    case 0:break;		// OK
-	    case 1:(*af->error_reporter)("LZMA header error decompressing segment %"I64d"\n",pagenum);
+	    case 1:(*af->error_reporter)("LZMA header error decompressing segment %" I64d "\n",pagenum);
 		break;
-	    case 2:(*af->error_reporter)("LZMA memory error decompressing segment %"I64d"\n",pagenum);
+	    case 2:(*af->error_reporter)("LZMA memory error decompressing segment %" I64d "\n",pagenum);
 		break;
 	    }
 	    break;
@@ -553,7 +553,7 @@ int af_cache_flush(AFFILE *af)
 		ret = -1;		// got an error; keep going, though
 	    }
 	    p->pagebuf_dirty = 0;
-	    if(af_trace) fprintf(af_trace,"af_cache_flush: slot %d page %"PRIu64" flushed.\n",i,p->pagenum);
+	    if(af_trace) fprintf(af_trace,"af_cache_flush: slot %d page %" PRIu64 " flushed.\n",i,p->pagenum);
 	}
     }
     return ret;				// now return the error that I might have gotten
@@ -570,7 +570,7 @@ void af_cache_writethrough(AFFILE *af,int64_t pagenum,const unsigned char *buf,i
 	struct aff_pagebuf *p = &af->pbcache[i];
 	if(p->pagenum_valid && p->pagenum == pagenum){
 	    if(p->pagebuf_dirty){
-		(*af->error_reporter)("af_cache_writethrough: overwriting page %"I64u".\n",pagenum);
+		(*af->error_reporter)("af_cache_writethrough: overwriting page %" I64u ".\n",pagenum);
 		exit(-1);		// this shouldn't happen
 	    }
 	    memcpy(p->pagebuf,buf,bufflen);
@@ -593,7 +593,7 @@ void af_cache_writethrough(AFFILE *af,int64_t pagenum,const unsigned char *buf,i
 
 struct aff_pagebuf *af_cache_alloc(AFFILE *af,int64_t pagenum)
 {
-    if(af_trace) fprintf(af_trace,"af_cache_alloc(%p,%"I64d")\n",af,pagenum);
+    if(af_trace) fprintf(af_trace,"af_cache_alloc(%p,%" I64d ")\n",af,pagenum);
 
     /* Make sure nothing in the cache is dirty */
     if(af_cache_flush(af) < 0)
@@ -604,7 +604,7 @@ struct aff_pagebuf *af_cache_alloc(AFFILE *af,int64_t pagenum)
 	struct aff_pagebuf *p = &af->pbcache[i];
 	if(p->pagenum_valid && p->pagenum==pagenum){
 	    af->cache_hits++;
-	    if(af_trace) fprintf(af_trace,"  page %"I64d" satisfied fromcache\n",pagenum);
+	    if(af_trace) fprintf(af_trace,"  page %" I64d " satisfied fromcache\n",pagenum);
 	    p->last = cachetime++;
 	    return p;
 	}
@@ -617,7 +617,7 @@ struct aff_pagebuf *af_cache_alloc(AFFILE *af,int64_t pagenum)
 	struct aff_pagebuf *p = &af->pbcache[i];
 	if(p->pagenum_valid==0){
 	    slot = i;
-	    if(af_trace) fprintf(af_trace,"  slot %d given to page %"I64d"\n",slot,pagenum);
+	    if(af_trace) fprintf(af_trace,"  slot %d given to page %" I64d "\n",slot,pagenum);
 	    break;
 	}
     }
@@ -632,7 +632,7 @@ struct aff_pagebuf *af_cache_alloc(AFFILE *af,int64_t pagenum)
 	    }
 	}
 	slot = oldest_i;
-	if(af_trace) fprintf(af_trace,"  slot %d assigned to page %"I64d"\n",slot,pagenum);
+	if(af_trace) fprintf(af_trace,"  slot %d assigned to page %" I64d "\n",slot,pagenum);
     }
     /* take over this slot */
     struct aff_pagebuf *p = &af->pbcache[slot];
@@ -656,7 +656,7 @@ struct aff_pagebuf *af_cache_alloc(AFFILE *af,int64_t pagenum)
     if(af_trace){
 	fprintf(af_trace,"   current pages in cache: ");
 	for(int i=0;i<af->num_pbufs;i++){
-	    fprintf(af_trace," %"I64d,af->pbcache[i].pagenum);
+	    fprintf(af_trace," %" I64d,af->pbcache[i].pagenum);
 	}
 	fprintf(af_trace,"\n");
     }
diff --git a/lib/afflib_stream.cpp b/lib/afflib_stream.cpp
index 9db1604..3cb5f79 100644
--- a/lib/afflib_stream.cpp
+++ b/lib/afflib_stream.cpp
@@ -29,14 +29,14 @@ int af_set_maxsize(AFFILE *af,int64_t maxsize)
 {
     AF_WRLOCK(af);
     if(af->image_size>0){
-	(*af->error_reporter)("Cannot set maxsize as imagesize is already set (%"I64d")",af->image_size);
+	(*af->error_reporter)("Cannot set maxsize as imagesize is already set (%" I64d ")",af->image_size);
 	AF_UNLOCK(af);
 	return -1;	// now allowed to set if imagesize is bigger than 0
     }
     if((af->image_pagesize!=0)
        && (af->v->type & AF_VNODE_MAXSIZE_MULTIPLE)
        && (maxsize % af->image_pagesize != 0)){
-	(*af->error_reporter)("Cannot set maxsize to %"I64d" --- not multiple of pagesize=%d\n",
+	(*af->error_reporter)("Cannot set maxsize to %" I64d " --- not multiple of pagesize=%d\n",
 			      maxsize,af->image_pagesize);
 	AF_UNLOCK(af);
 	return -1;
@@ -83,7 +83,7 @@ extern "C" ASIZE af_read(AFFILE *af,unsigned char *buf,ASIZE count)
     int total = 0;
 
     AF_WRLOCK(af);			// wrlock because cache may change
-    if (af_trace) fprintf(af_trace,"af_read(%p,%p,%d) (pos=%"I64d")\n",af,buf,(int)count,af->pos);
+    if (af_trace) fprintf(af_trace,"af_read(%p,%p,%d) (pos=%" I64d ")\n",af,buf,(int)count,af->pos);
     if (af->v->read){			// check for bypass
 	int r = (af->v->read)(af, buf, af->pos, count);
 	if(r>0) af->pos += r;
@@ -162,7 +162,7 @@ int af_write(AFFILE *af,unsigned char *buf,size_t count)
 {
     AF_WRLOCK(af);
     if (af_trace){
-	fprintf(af_trace,"af_write(af=%p,buf=%p,count=%d) pos=%"I64d"\n", af,buf,(int)count,af->pos);
+	fprintf(af_trace,"af_write(af=%p,buf=%p,count=%d) pos=%" I64d "\n", af,buf,(int)count,af->pos);
     }
     /* Invalidate caches */
     af_invalidate_vni_cache(af);
diff --git a/lib/aftest.cpp b/lib/aftest.cpp
index a46edea..c568e6c 100644
--- a/lib/aftest.cpp
+++ b/lib/aftest.cpp
@@ -764,6 +764,10 @@ void rsatest()
     uint32_t  siglen = sizeof(sig);
 
     BIO *bp = BIO_new_file("signing_key.pem","r");
+    if (!bp) {
+      perror("BIO_new_file");
+      return;
+    }
 
     EVP_MD_CTX md;
     EVP_PKEY *pkey = PEM_read_bio_PrivateKey(bp,0,0,0);
@@ -774,6 +778,11 @@ void rsatest()
 
     /* let's try to verify it */
     bp = BIO_new_file("signing_cert.pem","r");
+    if (!bp) {
+      perror("BIO_new_file");
+      return;
+    }
+
     X509 *x = 0;
     PEM_read_bio_X509(bp,&x,0,0);
     EVP_PKEY *pubkey = X509_get_pubkey(x);
diff --git a/lib/vnode_aff.cpp b/lib/vnode_aff.cpp
index 1fac55e..e07d2c7 100644
--- a/lib/vnode_aff.cpp
+++ b/lib/vnode_aff.cpp
@@ -111,7 +111,7 @@ static int aff_write_ignore(AFFILE *af,size_t bytes)
 
 int aff_write_seg(AFFILE *af, const char *segname,uint32_t arg,const u_char *data,size_t datalen)
 {
-    if(af_trace) fprintf(af_trace,"aff_write_seg(%p,%s,%"PRIu32",%p,len=%u)\n",
+    if(af_trace) fprintf(af_trace,"aff_write_seg(%p,%s,%" PRIu32 ",%p,len=%u)\n",
 			 af,segname,arg,data,(int)datalen);
 
     struct af_segment_head segh;
@@ -141,7 +141,7 @@ int aff_write_seg(AFFILE *af, const char *segname,uint32_t arg,const u_char *dat
     aff_toc_update(af,segname,ftello(af->aseg),datalen);
 
 
-    if(af_trace) fprintf(af_trace,"aff_write_seg: putting segment %s (datalen=%d) offset=%"PRId64"\n",
+    if(af_trace) fprintf(af_trace,"aff_write_seg: putting segment %s (datalen=%d) offset=%" PRId64 "\n",
 			 segname,(int)datalen,ftello(af->aseg));
 
     if(fwrite(&segh,sizeof(segh),1,af->aseg)!=1) return -10;
@@ -307,7 +307,7 @@ static int aff_get_next_seg(AFFILE *af,char *segname,size_t segname_len,uint32_t
 	return AF_ERROR_TAIL;
     }
     if(stl != calculated_segment_len){
-	snprintf(af->error_str,sizeof(af->error_str),"af_get_next_segv: AF file corrupt (%"PRIu32"!=%"PRIu32")/!",
+	snprintf(af->error_str,sizeof(af->error_str),"af_get_next_segv: AF file corrupt (%" PRIu32 "!=%" PRIu32 ")/!",
 		 stl,calculated_segment_len);
 	fseeko(af->aseg,start,SEEK_SET); // go back to last good position
 	return AF_ERROR_TAIL;
@@ -363,7 +363,7 @@ static int aff_update_seg(AFFILE *af, const char *name,
     size_t size_needed = vallen+aff_segment_overhead(name);
     struct aff_toc_mem *adm = aff_toc(af,name);
 
-    if(af_trace) fprintf(af_trace,"aff_update_seg(name=%s,arg=%"PRIu32",vallen=%u)\n",name,arg,vallen);
+    if(af_trace) fprintf(af_trace,"aff_update_seg(name=%s,arg=%" PRIu32 ",vallen=%u)\n",name,arg,vallen);
 
     if(adm)
     {
diff --git a/lib/vnode_afm.cpp b/lib/vnode_afm.cpp
index a037a50..663b496 100644
--- a/lib/vnode_afm.cpp
+++ b/lib/vnode_afm.cpp
@@ -187,7 +187,7 @@ static int afm_split_raw_setup(AFFILE *af)
 	    return -1;
 	}
 	if (af->maxsize % af->image_pagesize) {
-	    (*af->error_reporter)("afm_split_raw_setup: maxsize (%"I64d") "
+	    (*af->error_reporter)("afm_split_raw_setup: maxsize (%" I64d ") "
 				  "not a multiple of image_pagesize (%d)\n",
 				  af->maxsize,af->image_pagesize);
 	    return -1;
@@ -212,7 +212,7 @@ static int afm_split_raw_setup(AFFILE *af)
      */
     if (ap->aff->image_size && ap->aff->image_size != ap->sr->image_size) {
 	(*af->error_reporter)("afm_split_raw_setup: internal error. "
-			      "AFF image_size %"I64d" != SR image_size %"I64d"\n",
+			      "AFF image_size %" I64d " != SR image_size %" I64d "\n",
 			      ap->aff->image_size,ap->sr->image_size);
 	return -1;
     }
@@ -225,7 +225,7 @@ static int afm_split_raw_setup(AFFILE *af)
     /* Verify that the parameters make sense */
     if (ap->sr->maxsize != (pages_per_file * af->image_pagesize) && pages_per_file>0) {
 	(*af->error_reporter)("afm_split_raw_setup: %s: per size indicated by metadata (%d * %d) "
-			      "doesn't match maxsize (%"I64d")\n",
+			      "doesn't match maxsize (%" I64d ")\n",
 			      af_filename(af),pages_per_file,af->image_pagesize,ap->sr->maxsize);
 	return -1;
     }
diff --git a/lib/vnode_split_raw.cpp b/lib/vnode_split_raw.cpp
index 46c37ae..955e241 100644
--- a/lib/vnode_split_raw.cpp
+++ b/lib/vnode_split_raw.cpp
@@ -169,7 +169,7 @@ void srp_dump(AFFILE *af)
 {
     struct split_raw_private *srp = SPLIT_RAW_PRIVATE(af);
     for(uint32_t i=0;i<srp->num_raw_files;i++){
-	fprintf(stderr,"   fds[%d]=%d   pos[%d]=%"I64d"\n",i,srp->fds[i],i,srp->pos[i]);
+	fprintf(stderr,"   fds[%d]=%d   pos[%d]=%" I64d "\n",i,srp->fds[i],i,srp->pos[i]);
     }
     srp_validate(af);
     fprintf(stderr,"===================\n");
@@ -287,7 +287,7 @@ static int split_raw_open(AFFILE *af)
 	af->image_pagesize *= 2;
 
     if ((ret == 0) && (af->maxsize % af->image_pagesize!=0)) {
-	(*af->error_reporter)("split_raw_open: %s: raw_file_size (%"I64d" not a multiple of pagesize %lu\n",
+	(*af->error_reporter)("split_raw_open: %s: raw_file_size (%" I64d " not a multiple of pagesize %lu\n",
 			      af->fname, af->maxsize,af->image_pagesize);
 	split_raw_close (af);
 	return -1;
diff --git a/lzma443/C/Common/String.h b/lzma443/C/Common/String.h
index c4277c1..d8c42f9 100755
--- a/lzma443/C/Common/String.h
+++ b/lzma443/C/Common/String.h
@@ -417,7 +417,7 @@ public:
     for(int i = 0; i < _length; i++)
       if (s.Find(_chars[i]) >= 0)
         return i;
-      return -1;
+    return -1;
   }
 
   void TrimLeft(T c)
diff --git a/lzma443/C/Common/Vector.h b/lzma443/C/Common/Vector.h
index 210c385..41a5f3a 100755
--- a/lzma443/C/Common/Vector.h
+++ b/lzma443/C/Common/Vector.h
@@ -178,7 +178,7 @@ public:
     for(int i = 0; i < Size(); i++)
       if (item == (*this)[i])
         return i;
-      return -1;
+    return -1;
   }
   int FindInSorted(const T& item) const
   {
diff --git a/man/affcat.1 b/man/affcat.1
index c849b1f..8371fca 100644
--- a/man/affcat.1
+++ b/man/affcat.1
@@ -28,7 +28,7 @@ Quiet mode. Don't print to STDERR if a page is skipped because it is not present
 .IP "-n"
 Noisy mode. Tell when pages are skipped.
 .IP "-l" 
-List all the segment names, rather than outputing data.
+List all the segment names, rather than outputting data.
 .IP "-L"
 List Long. Prints segment names, lengths, and args.
 .IP "-d" 
diff --git a/man/affconvert.1 b/man/affconvert.1
index d5790f3..6d06e6b 100644
--- a/man/affconvert.1
+++ b/man/affconvert.1
@@ -78,7 +78,7 @@ Use 'ext' for the raw \fIfiles\fP (default is raw). Implies in \fB-r\fP.
 .TP
 .B
 \fB-r\fP
-Force raw output.
+Generate raw output.
 .RE
 .PP
 Dangerous input \fIoptions\fP:
@@ -104,6 +104,14 @@ Convert file1.raw to file1.aff:
 
 .fam T
 .fi
+Convert file1.aff to file1.raw:
+.PP
+.nf
+.fam C
+    $ affconvert -r file1.aff
+
+.fam T
+.fi
 Batch convert \fIfiles\fP:
 .PP
 .nf
@@ -112,6 +120,13 @@ Batch convert \fIfiles\fP:
 
 .fam T
 .fi
+.PP
+.nf
+.fam C
+    $ affconvert -r file1.aff file2.aff file3.aff
+
+.fam T
+.fi
 Split an AFF file into 4GB chunks for archiving to DVD:
 .PP
 .nf
diff --git a/tools/aff_bom.cpp b/tools/aff_bom.cpp
index a7974b7..72d7b46 100644
--- a/tools/aff_bom.cpp
+++ b/tools/aff_bom.cpp
@@ -13,7 +13,7 @@
  * United States Government and/or for any works created by United
  * States Government employees. User acknowledges that this software
  * contains work which was created by NPS employee(s) and is therefore
- * in the public domain and not subject to copyright.  
+ * in the public domain and not subject to copyright.
  * --------------------------------------------------------------------
  *
  * Change History:
@@ -97,7 +97,7 @@ char *aff_bom::get_notes()
     while(notes){
 	char buf2[1024];
 	char *val=0;
-	
+
 #ifdef HAVE_LIBREADLINE
 	if(isatty(fileno(stdin))){
 	    val = readline("");
@@ -120,10 +120,12 @@ char *aff_bom::get_notes()
 int aff_bom::read_files(const char *cert_file,const char *key_file)
 {
     BIO *bp_cert = BIO_new_file(cert_file,"r"); // read the certfile
+    if (!bp_cert)
+      return -1;
     PEM_read_bio_X509(bp_cert,&cert,0,0); // get an x509 cert
     BIO_free(bp_cert);
     if(!cert) return -1;		// can't read certificate file
-	
+
     /* Now read the private key */
     BIO *bp_privkey = BIO_new_file(key_file,"r");
     privkey = PEM_read_bio_PrivateKey(bp_privkey,0,0,0);
@@ -133,14 +135,14 @@ int aff_bom::read_files(const char *cert_file,const char *key_file)
 	cert = 0;
 	return -1;
     }
-	
+
     bom_open = true;
     xml = BIO_new(BIO_s_mem());	// where we are writing
     time_t clock = time(0);
     struct tm *tm = localtime(&clock);
     char timebuf[1024];
     strftime(timebuf,sizeof(timebuf),"<date type='ISO 8601'>%FT%T</date>",tm);
-    
+
     BIO_printf(xml,"<%s version=\"1\">\n",AF_XML_AFFBOM);
     BIO_printf(xml,"  %s\n",timebuf);
     BIO_printf(xml,"  <program>afcopy</program>\n");
@@ -185,18 +187,18 @@ void aff_bom::close()
 	size_t xlen = BIO_get_mem_data(xml,&xbuf);
 	unsigned char sig[1024];
 	u_int  siglen = sizeof(sig);
-	
+
 	EVP_MD_CTX md;
 	EVP_SignInit(&md,sha256);
 	EVP_SignUpdate(&md,xbuf,xlen);
 	EVP_SignFinal(&md,sig,&siglen,privkey);
-    
+
 	/* Write the signature in base64 encoding... */
 	BIO *b64 = BIO_new(BIO_f_base64());
 	xml = BIO_push(b64,xml);
 	BIO_write(xml,sig,siglen);
 	if(BIO_flush(xml)!=1) return;	// something wrong
-	
+
 	/* Remove the base64 bio */
 	xml = BIO_pop(b64);
     }
@@ -237,8 +239,8 @@ int aff_bom::add(AFFILE *af,const char *segname)
     size_t datalen = 0;
     if(af_get_seg(af,segname,0,0,&datalen)<0) return -1;
     uint32_t arg;
-    u_char *segdata = (u_char *)malloc(datalen);/* Allocate memory */
-    if(segdata<0) return -1;
+    u_char *segdata = (u_char *)malloc(datalen);
+    if(!segdata) return -1;
     if(af_get_seg(af,segname,&arg,segdata,&datalen)<0){
 	free(segdata);
 	return -1;
@@ -248,7 +250,7 @@ int aff_bom::add(AFFILE *af,const char *segname)
     add(segname,AF_SIGNATURE_MODE0,seghash,sizeof(seghash));
     free(segdata);
     return(0);
-    
+
 }
 
 
diff --git a/tools/affcat.cpp b/tools/affcat.cpp
index a83d20e..bc9cc4e 100644
--- a/tools/affcat.cpp
+++ b/tools/affcat.cpp
@@ -61,7 +61,7 @@ void sig_info(int arg)
 {
     fprintf(stderr,"affcat ");
     if(current_fname) fprintf(stderr,"%s: ",current_fname);
-    if(current_page>=0) fprintf(stderr,"[%"PRId64"] ",current_page);
+    if(current_page>=0) fprintf(stderr,"[%" PRId64 "] ",current_page);
     fflush(stderr);
 }
 
@@ -99,12 +99,12 @@ int output_page(AFFILE *af,FILE *outfile,int64_t pagenum)
     int bytes = af_read(af,buf,af->image_pagesize); // read what we can
 
     if(bytes<0){
-	if(opt_debug) fprintf(stderr,"affcat: cannot read page %"I64d"\n",pagenum);
+	if(opt_debug) fprintf(stderr,"affcat: cannot read page %" I64d "\n",pagenum);
 	return -1;
     }
 
     if(opt_debug){
-	fprintf(stderr,"affcat: page:%"I64d" bytes: %d offset:%"I64d"\n",
+	fprintf(stderr,"affcat: page:%" I64d" bytes: %d offset:%" I64d "\n",
 		pagenum, bytes,offset);
     }
 
@@ -117,7 +117,7 @@ int output_page(AFFILE *af,FILE *outfile,int64_t pagenum)
 	}
     }
 
-    if(opt_debug) fprintf(stderr,"  outputing %d bytes\n",bytes);
+    if(opt_debug) fprintf(stderr,"  outputting %d bytes\n",bytes);
     int count = fwrite(buf,1,bytes,outfile);	// send to the output
     if(count!=bytes) fprintf(stderr,"fwrite(buf,1,%d,outfile) only wrote %d bytes\n",bytes,count);
     free(buf);
@@ -196,7 +196,7 @@ int affcat(AFFILE *af)
 	    const char *opt = opts.c_str();
 	    uint64_t offset=0;
 	    int count=0;
-	    if(sscanf(opt,"%"I64u":%d",&offset,&count)!=2){
+	    if(sscanf(opt,"%" I64u ":%d",&offset,&count)!=2){
 		err(1,"Cannot decode '%s'\n",opt);
 	    }
 	    af_seek(af,offset,SEEK_SET);
@@ -227,7 +227,7 @@ int affcat(AFFILE *af)
 	if(opt_list){
 	    printf("%s",segname);
 	    if(opt_list_long){
-		printf("\targ:%"PRIu32"\tlen:%d",arg,(int)datalen);
+		printf("\targ:%" PRIu32 "\tlen:%d",arg,(int)datalen);
 	    }
 	    putchar('\n');
 	}
@@ -270,7 +270,7 @@ int affcat(AFFILE *af)
 
 	//fprintf(stderr,"bytes written=%qd imagesize=%qd\n",total_bytes_written,imagesize);
 	if((total_bytes_written > imagesize) && (imagesize>0)){
-	    err(1,"affcat internal error. bytes written=%"I64d" imagesize=%" I64d,
+	    err(1,"affcat internal error. bytes written=%" I64d " imagesize=%" I64d,
 		(int64_t)total_bytes_written,
 		(int64_t)imagesize);
 	    return -1;
@@ -284,7 +284,7 @@ int64_t atoi64(const char *buf)
 {
     int64_t r=0;
     char ch;
-    if(sscanf(buf,"%"I64d"%c",&r,&ch)==1) return r;
+    if(sscanf(buf,"%" I64d "%c",&r,&ch)==1) return r;
     fprintf(stderr,"Cannot parse '%s'\n",buf);
     exit(0);
 }
diff --git a/tools/affcompare.cpp b/tools/affcompare.cpp
index 9f20dec..993d558 100644
--- a/tools/affcompare.cpp
+++ b/tools/affcompare.cpp
@@ -153,10 +153,10 @@ void print_sector(AFFILE *af,unsigned char *buf)
 void print_info(char dir,const char *segname,uint32_t arg,size_t len,
 		unsigned char *data,int mcr)
 {
-    printf("    %c %s arg=%"PRIu32" len=%d\n",dir,segname,arg,(int)len);
+    printf("    %c %s arg=%" PRIu32 " len=%d\n",dir,segname,arg,(int)len);
     printf("          ");
     if((arg == AF_SEG_QUADWORD) && (len==8)){
-	printf("data=%"I64d" as a 64-bit value\n",af_decode_q(data));
+	printf("data=%" I64d " as a 64-bit value\n",af_decode_q(data));
 	return;
     }
     /* Otherwise, just print some stuff... */
@@ -290,17 +290,17 @@ int  compare_aff_data_segments(char *title,AFFILE *af1,AFFILE *af2,int64_t pagen
 
     /* Find the size of each page, then get the page */
     if(af_get_page(af1,pagenum,0,&data1_len)<0)
-	err(1,"Cannot read page %"I64d" size from %s\n",pagenum,af_filename(af1));
+	err(1,"Cannot read page %" I64d " size from %s\n",pagenum,af_filename(af1));
     if(af_get_page(af1,pagenum,data1,&data1_len)<0)
-	err(1,"Cannot read page %"I64d" from %s",pagenum,af_filename(af1));
+	err(1,"Cannot read page %" I64d " from %s",pagenum,af_filename(af1));
 
     if(af_get_page(af2,pagenum,0,&data2_len)<0)
-	err(1,"Cannot read page %"I64d" size from %s\n",pagenum,af_filename(af2));
+	err(1,"Cannot read page %" I64d " size from %s\n",pagenum,af_filename(af2));
     if(af_get_page(af2,pagenum,data2,&data2_len)<0)
-	err(1,"Cannot read page %"I64d" from %s",pagenum,af_filename(af2));
+	err(1,"Cannot read page %" I64d " from %s",pagenum,af_filename(af2));
 
     if(data1_len != data2_len){
-	printf("page %"I64d" size %d != size %d\n",pagenum,(int)data1_len,(int)data2_len);
+	printf("page %" I64d " size %d != size %d\n",pagenum,(int)data1_len,(int)data2_len);
 	return 1;
     }
 
@@ -341,7 +341,7 @@ int  compare_aff_data_segments(char *title,AFFILE *af1,AFFILE *af2,int64_t pagen
     outline[0] = 0;
     if(opt_all || (no_match>0) || af1_bad || af2_bad){
 	snprintf(outline,sizeof(outline),
-		"   page%"I64d" sectors:%4d  matching: %3d  different:%3d",
+		"   page%" I64d " sectors:%4d  matching: %3d  different:%3d",
 		pagenum,total_sectors,matching_sectors,no_match);
     }
     if(af1_bad){
@@ -373,7 +373,7 @@ int  compare_aff_data_segments(char *title,AFFILE *af1,AFFILE *af2,int64_t pagen
 	    if(i==0){
 		printf("\n   ");
 	    }
-	    printf(" %"I64d,*j);
+	    printf(" %" I64d,*j);
 	    i = (i+1) % 10;
 	}
 	putchar('\n');
@@ -391,7 +391,7 @@ int  compare_aff_data_segments(char *title,AFFILE *af1,AFFILE *af2,int64_t pagen
 	    memcpy(b2,data1+offset,16);
 	    b2[15]=0;
 
-	    printf("===  sector %"I64d" (offset=%d) ===\n",*j,offset);
+	    printf("===  sector %" I64d " (offset=%d) ===\n",*j,offset);
 	    printf("   %s:\n",af_filename(af1));
 	    print_sector(af1,data1+offset);
 	    printf("-------------------------------------\n");
@@ -429,10 +429,10 @@ int compare_preen(AFFILE *af1,AFFILE *af2)
 	size_t len1,len2;
 
 	if(af_get_page_raw(af1,*i,&arg1,0,&len1)){
-	    err(1,"Could not read page %"I64d" in file %s\n",*i,af_filename(af1));
+	    err(1,"Could not read page %" I64d " in file %s\n",*i,af_filename(af1));
 	}
 	if(af_get_page_raw(af2,*i,&arg2,0,&len2)){
-	    err(1,"Page %"I64d" is in file %s but not in %s\n",*i,af_filename(af1),
+	    err(1,"Page %" I64d " is in file %s but not in %s\n",*i,af_filename(af1),
 		af_filename(af2));
 	}
 	if(arg1==arg2 && len1==len2){
@@ -450,7 +450,7 @@ int compare_preen(AFFILE *af1,AFFILE *af2)
 	    continue;
 	}
     }
-    printf("%s -> %s Nochg: %d  NUL: %d  LZMA: %d  old: %"I64d" new: %"I64d" LZred: %6.2f%%\n",
+    printf("%s -> %s Nochg: %d  NUL: %d  LZMA: %d  old: %" I64d " new: %" I64d " LZred: %6.2f%%\n",
 	   af_filename(af1),
 	   af_filename(af2),
 	   comp_unchanged,comp_zero,comp_lzma,bytes_old,bytes_new,(bytes_old-bytes_new)*100.0/bytes_old);
@@ -492,8 +492,8 @@ int compare_aff_aff(const char *file1,const char *file2)
     if(af1->image_pagesize != af2->image_pagesize){
 	fprintf(stderr,"Currently, %s requires that both images have the "
 		"same image datsegsize.\n"
-		"  pagesize(%s)=%"PRIu32"\n"
-		"  pagesize(%s)=%"PRIu32"\n",
+		"  pagesize(%s)=%" PRIu32 "\n"
+		"  pagesize(%s)=%" PRIu32 "\n",
 		progname,file1,af1->image_pagesize, file2,af2->image_pagesize);
 	fprintf(stderr,"Data segments will be ignored.\n");
 	no_data_segments = true;
@@ -502,8 +502,8 @@ int compare_aff_aff(const char *file1,const char *file2)
     if(af1->image_sectorsize != af2->image_sectorsize){
 	fprintf(stderr,"Currently, %s requires that both images have the "
 		"same image sectorsize.\n"
-		"  sectorsize(%s)=%"PRIu32"\n"
-		"  sectorsize(%s)=%"PRIu32"\n",
+		"  sectorsize(%s)=%" PRIu32 "\n"
+		"  sectorsize(%s)=%" PRIu32 "\n",
 		progname,file1,af1->image_sectorsize, file2,af2->image_sectorsize);
 	fprintf(stderr,"Data segments will be ignored.\n");
 	no_data_segments = true;
diff --git a/tools/affconvert.cpp b/tools/affconvert.cpp
index 4024abe..024b75f 100644
--- a/tools/affconvert.cpp
+++ b/tools/affconvert.cpp
@@ -22,15 +22,6 @@
 #include "unix4win32.h"
 #endif
 
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-
-#ifdef HAVE_TERM_H
-#include <term.h>
-#endif
-
-
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -423,15 +414,15 @@ int convert(const char *infile,char *outfile)
 	    
 	    int64_t pagenum = *i;
 	    
-	    if(!opt_quiet) printf("Converting page %"I64d" of %"I64d"\r",pagenum,highest_pagenum);fflush(stdout);
+	    if(!opt_quiet) { printf("Converting page %" I64d " of %" I64d "\r",pagenum,highest_pagenum); fflush(stdout); }
 	    
 	    size_t data_len = image_pagesize;
 	    if(af_get_page(a_in,pagenum,data,&data_len)){
-		err(1,"af_get_page(file=%s,page=%"I64d")",
+		err(1,"af_get_page(file=%s,page=%" I64d ")",
 		    af_filename(a_in),pagenum);
 	    }
 	    if(af_update_page(a_out,pagenum,data,data_len)){
-		err(1,"af_update_page(file=%s,page=%"I64d")",
+		err(1,"af_update_page(file=%s,page=%" I64d ")",
 		    af_filename(a_out),pagenum);
 	    }
 	    
@@ -448,7 +439,7 @@ int convert(const char *infile,char *outfile)
 	/* Go back and update the image size (necessary since I have been writing page-by-page) */
 	if(af_update_segq(a_out,AF_IMAGESIZE,last_byte_in_image)
 	   && errno!=ENOTSUP){
-	    err(1,"Could not upate AF_IMAGESIZE");
+	    err(1,"Could not update AF_IMAGESIZE");
 	}
     } else {
 	/* No page support; Copy from beginning to end */
@@ -499,10 +490,10 @@ int convert(const char *infile,char *outfile)
 
     /* Finish the hash calculations and write to the db */
     if(!opt_quiet){
-	printf("bytes converted: %"I64d" \n",total_bytes_converted);
+	printf("bytes converted: %" I64d " \n",total_bytes_converted);
 	/* If the vnode implementation tracked segments written, report it. */
 	if(a_out->pages_written || a_out->pages_compressed){
-	    printf("Total pages: %"I64u"  (%"I64u" compressed)\n",
+	    printf("Total pages: %" I64u "  (%" I64u " compressed)\n",
 		   a_out->pages_written,a_out->pages_compressed);
 	}
     }
@@ -552,7 +543,7 @@ int convert(const char *infile,char *outfile)
 int64_t atoi64(const char *buf)
 {
     int64_t r=0;
-    sscanf(buf,"%"I64d,&r);
+    sscanf(buf,"%" I64d,&r);
     return r;
 }
 
diff --git a/tools/affcopy.cpp b/tools/affcopy.cpp
index 22e9cb1..853eabb 100644
--- a/tools/affcopy.cpp
+++ b/tools/affcopy.cpp
@@ -39,10 +39,6 @@ using namespace aff;
 #include <unistd.h>
 #endif
 
-#ifdef HAVE_TERM_H
-#include <term.h>
-#endif
-
 #ifdef WIN32
 #include "unix4win32.h"
 #endif
@@ -469,7 +465,7 @@ int affcopy(char *infile,vector<string> &outfiles)
 	AFFILE *af = afouts.begin()->af;
 	uint64_t w = af->bytes_written;
 	double sec = ((t1.tv_sec-t0.tv_sec)+(t1.tv_usec-t0.tv_usec)/1000000.0);
-	printf("%s: %"I64d" bytes transferred in %.2f seconds. xfer rate: %.2f MBytes/sec\n",
+	printf("%s: %" I64d " bytes transferred in %.2f seconds. xfer rate: %.2f MBytes/sec\n",
 	       af_filename(af),w,sec,(w/1000000.0) / sec);
     }
 	
diff --git a/tools/affdiskprint.cpp b/tools/affdiskprint.cpp
index cf2a9fd..6609be7 100644
--- a/tools/affdiskprint.cpp
+++ b/tools/affdiskprint.cpp
@@ -97,7 +97,7 @@ uint64_t random64()
 uint64_t atoi64(const char *buf)
 {
     uint64_t ret=0;
-    sscanf(buf,"%"PRIu64,&ret);
+    sscanf(buf,"%" PRIu64,&ret);
     return ret;
 }
 
@@ -201,7 +201,7 @@ int diskprint(const char *infile)
     int64_t imagesize = af_get_imagesize(af);
     if(imagesize>0){
 	char buf[32];
-	snprintf(buf,sizeof(buf),"%"PRIu64,imagesize);
+	snprintf(buf,sizeof(buf),"%" PRIu64,imagesize);
 	out_xmlstr(cout,2,AF_IMAGESIZE,buf);
 	cout << "\n";
     }
@@ -212,7 +212,7 @@ int diskprint(const char *infile)
     int64_t sectors = imagesize/sectorsize;
     if(sectors>0){
 	char buf[32];
-	snprintf(buf,sizeof(buf),"%"PRIu32"",sectorsize);
+	snprintf(buf,sizeof(buf),"%" PRIu32,sectorsize);
 	out_xmlstr(cout,2,AF_SECTORSIZE,buf);
 	cout << "\n";
     }
diff --git a/tools/affinfo.cpp b/tools/affinfo.cpp
index be76f90..743f58b 100644
--- a/tools/affinfo.cpp
+++ b/tools/affinfo.cpp
@@ -33,14 +33,6 @@
 
 using namespace std;
 
-#ifdef HAVE_CURSES_H
-#include <curses.h>
-#endif
-
-#ifdef HAVE_TERM_H
-#include <term.h>
-#endif
-
 #ifdef WIN32
 #include "unix4win32.h"
 #endif
@@ -79,46 +71,6 @@ const char *opt_passphrase = 0;
 
 vector<string> opt_seglist;		// just info these segments
 bool something_was_decrypted = false;
-const char *term = 0;
-
-
-/**
- * select bold on or off
- */
-void bold(int on)
-{
-    if(!term) return;
-#ifdef HAVE_ISATTY
-    if(!isatty(fileno(stdout))) return;
-#endif
-#if defined(HAVE_TPUTS) && defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)
-    if(on) tputs(enter_bold_mode,1,putchar);
-    else tputs(exit_attribute_mode,0,putchar);
-#endif
-}
-
-/**
- * select a color.
- * @param num - 0 is black; 1 red; 2 green; 3 yellow; 4 blue; 5 magenta; 6 cyan; 7 white;
- */
-  
-#define RED 1
-#define WHITE 7
-
-void color(int num)
-{
-#ifdef HAVE_ISATTY
-    if(!isatty(fileno(stdout))) return;
-#endif
-#if defined(HAVE_TIGETSTR) && defined(HAVE_PUTP) && defined(HAVE_TPARM)
-    char *setf = tigetstr((char *)"setf");
-    if(!setf) setf = tigetstr((char *)"setaf");
-    if(setf){
-	putp(tparm(setf,num));
-    }
-#endif
-}
-
 
 void usage()
 {
@@ -164,12 +116,6 @@ void usage()
 #endif
     printf("\n");
 
-    if(opt_debug){
-	for(int i=0;i<9;i++){
-	    color(i);printf("Color %d\n",i);color(7);
-	}
-    }
-
     exit(0);
 }
 
@@ -179,7 +125,7 @@ AFFILE *af=0;
 void sig_info(int arg)
 {
     if(af==0) return;
-    printf("Validating %"I64d" of %"I64d"\n", af->pos,af->image_size);
+    printf("Validating %" I64d" of %" I64d"\n", af->pos,af->image_size);
 }
 
 
@@ -408,7 +354,6 @@ void print_info(AFFILE *af,const char *segname)
     af_set_option(af,AF_OPTION_AUTO_DECRYPT,prev);    
 
     if(was_decrypted){
-	bold(1);
 	something_was_decrypted = true;	// print key at bottom
     }
 
@@ -417,7 +362,7 @@ void print_info(AFFILE *af,const char *segname)
     memset(output_line,0,sizeof(output_line));
 
     /* Now append the arg and the data len */
-    sprintf(output_line,"%-24s %8"PRIu32"   %8d   ",segname,arg,(int)data_len);
+    sprintf(output_line,"%-24s %8" PRIu32 "   %8d   ",segname,arg,(int)data_len);
 
     if(opt_no_preview){
 	printf("%s\n",output_line);
@@ -447,7 +392,7 @@ void print_info(AFFILE *af,const char *segname)
 	 */
 	switch(data_len){
 	case 8:
-	    printf("%s= %"I64d" (64-bit value)\n",
+	    printf("%s= %" I64d" (64-bit value)\n",
 		   output_line,af_decode_q(data));
 	    break;
 	case 0:
@@ -552,9 +497,6 @@ void print_info(AFFILE *af,const char *segname)
     putchar('\n');
  done:
     if(data) free(data);
-    bold(0);			// make sure bold is off
-
-    //color(WHITE);		// make sure we are back to normal color
 }
 
 
@@ -666,29 +608,27 @@ int info_file(const char *infile)
 
     /* Print the key */
     if(something_was_decrypted){
-	bold(1);
-	printf("Bold indicates segments that were decrypted.\n");
-	bold(0);
+	printf("Some segments were decrypted.\n");
     }
 
 
     printf("\n");
-    printf("Total segments:        %8"PRIu32"   (%"PRIu32" real)\n", total_segs,(total_segs-total_nulls));
+    printf("Total segments:        %8" PRIu32 "   (%" PRIu32" real)\n", total_segs,(total_segs-total_nulls));
     if(aes_segs){
 	printf("  Encrypted segments:  %8u\n",aes_segs);
     }
-    printf("  Page  segments:      %8"PRIu32"\n",total_pages);
-    printf("  Hash  segments:      %8"PRIu32"\n",total_hashes);
-    printf("  Signature segments:  %8"PRIu32"\n",total_signatures);
-    printf("  Null segments:       %8"PRIu32"\n",total_nulls);
+    printf("  Page  segments:      %8" PRIu32 "\n",total_pages);
+    printf("  Hash  segments:      %8" PRIu32 "\n",total_hashes);
+    printf("  Signature segments:  %8" PRIu32 "\n",total_signatures);
+    printf("  Null segments:       %8" PRIu32 "\n",total_nulls);
     if(opt_all){
-	printf("  Empty segments:      %8"PRIu32"\n",total_nulls);
+	printf("  Empty segments:      %8" PRIu32 "\n",total_nulls);
 	printf("\n");
-	printf("Total data bytes in segments: %"I64d"\n",total_datalen);
+	printf("Total data bytes in segments: %" I64d"\n",total_datalen);
 
 	printf("Total space in file dedicated to segment names: %zd\n",
 	       total_segname_len);
-	printf("Total overhead for %"PRIu32" segments: %zd bytes (%"PRIu32"*(%zd+%zd))\n",
+	printf("Total overhead for %" PRIu32 " segments: %zd bytes (%" PRIu32 "*(%zd+%zd))\n",
 	       total_segs,
 	       (size_t) total_segs*(sizeof(struct af_segment_head) +sizeof(struct af_segment_tail)),
 	       total_segs,
@@ -720,7 +660,7 @@ int info_file(const char *infile)
 	//printf("device_bytes=%"I64d"\n",device_bytes);
 	//printf("device_pages=%"I64d"\n",device_pages);
 	if(missing_pages!=0){
-	    printf("Missing page segments: %8"I64u"\n",missing_pages);
+	    printf("Missing page segments: %8" I64u"\n",missing_pages);
 	}
 	else {
 	    some_missing_pages=0;
@@ -735,7 +675,7 @@ int info_file(const char *infile)
 
     if(some_missing_pages && opt_debug){
 	printf("Cannot calculate missing pages\n");
-	printf("  device_sectors=%"I64d" image_pagesize=%"PRIu32" sectorsize=%"PRIu32"\n",
+	printf("  device_sectors=%" I64d" image_pagesize=%" PRIu32 " sectorsize=%" PRIu32 "\n",
 	       device_sectors,af->image_pagesize,af->image_sectorsize);
     }
     af_close(af);
@@ -756,8 +696,8 @@ void figure_media(const char *fn)
     printf("<!DOCTYPE Server >\n");
     printf("<device name='%s'>\n",fn);
     printf("   <sector_size>%d</sector_size>\n",afb.sector_size);
-    printf("   <total_sectors>%"PRId64"</total_sectors>\n",afb.total_sectors);
-    printf("   <max_read_blocks>%"PRIu64"</max_read_blocks>\n",afb.max_read_blocks);
+    printf("   <total_sectors>%" PRId64 "</total_sectors>\n",afb.total_sectors);
+    printf("   <max_read_blocks>%" PRIu64 "</max_read_blocks>\n",afb.max_read_blocks);
     printf("</device>\n");
     close(fd);
 }
diff --git a/tools/affix.cpp b/tools/affix.cpp
index 92baff4..da1050e 100644
--- a/tools/affix.cpp
+++ b/tools/affix.cpp
@@ -24,10 +24,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef HAVE_TERM_H
-#include <term.h>
-#endif
-
 #ifdef WIN32
 #include "unix4win32.h"
 #include <malloc.h>
@@ -93,7 +89,7 @@ int fix(const char *infile)
     r = (*af->v->open)(af);
     /* See if we can build a TOC */
     if(r<0){
-	printf("AFF file corrupt at %"I64d" out of %"I64d" (%"I64d" bytes from end)\n",
+	printf("AFF file corrupt at %" I64d " out of %" I64d " (%" I64d " bytes from end)\n",
 	       ftello(af->aseg),(int64_t)len,len-ftello(af->aseg));
 	if(opt_fix){
 	    printf("Truncating... %d \n",fileno(af->aseg));
diff --git a/tools/affrecover.cpp b/tools/affrecover.cpp
index 8de7ba8..bc220cb 100644
--- a/tools/affrecover.cpp
+++ b/tools/affrecover.cpp
@@ -23,10 +23,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef HAVE_TERM_H
-#include <term.h>
-#endif
-
 #ifdef WIN32
 #include "unix4win32.h"
 #include <malloc.h>
diff --git a/tools/affsegment.cpp b/tools/affsegment.cpp
index 8235472..aafb8bc 100644
--- a/tools/affsegment.cpp
+++ b/tools/affsegment.cpp
@@ -230,19 +230,19 @@ void process(const char *fn)
 		free(buf);
 		continue;
 	    }
-	    if(opt_debug) fprintf(stderr," arg=%"PRIu32" len=%zd\n",arg,len);
+	    if(opt_debug) fprintf(stderr," arg=%" PRIu32 " len=%zd\n",arg,len);
 	    int p = 1;
 	    
 	    if(filecount>1) printf("%s:",fn);
 	    if(print_segs.size()>1) printf("%s=",segname);
 	    if(opt_quad && len==8){
 		uint64_t quad = af_decode_q(buf);
-		printf("%"I64u"\n",quad);
+		printf("%" I64u "\n",quad);
 		p = 0;
 	    }
 	    
 	    if(opt_arg){
-		printf("%"PRIu32"\n",arg);
+		printf("%" PRIu32 "\n",arg);
 		p = 0;
 	    }
 	    
diff --git a/tools/affstats.cpp b/tools/affstats.cpp
index 3cb7778..3c0038d 100644
--- a/tools/affstats.cpp
+++ b/tools/affstats.cpp
@@ -65,10 +65,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef HAVE_TERM_H
-#include <term.h>
-#endif
-
 #ifdef WIN32
 #include "unix4win32.h"
 #include <malloc.h>
@@ -98,7 +94,7 @@ void print_size(uint64_t s)
 	printf("%u",(unsigned int)(s/(1024*1024)));
 	return;
     }
-    printf("%"I64u,s);    
+    printf("%" I64u,s);    
 }
 
 void affstats_title()
@@ -150,7 +146,7 @@ void affstats(const char *fname)
     print_size(compressed_bytes);
     printf("\t");
     print_size(uncompressed_bytes);
-    printf(" %"I64d" %"I64d,blanksectors,badsectors);
+    printf(" %" I64d " %" I64d,blanksectors,badsectors);
     putchar('\n');
     
     
diff --git a/tools/affverify.cpp b/tools/affverify.cpp
index 20ad6d2..b89d53d 100644
--- a/tools/affverify.cpp
+++ b/tools/affverify.cpp
@@ -451,7 +451,7 @@ int hash_verify(AFFILE *af)
     printf("\n");
     do {
 	double frac = (double)total_read / af_get_imagesize(af);
-	printf("  Read %14zd/%14"PRId64" bytes; done in %s\n",
+	printf("  Read %14zd/%14" PRId64" bytes; done in %s\n",
 	       total_read,
 	       af_get_imagesize(af),
 	       t.eta_text(frac).c_str());
diff --git a/tools/affxml.cpp b/tools/affxml.cpp
index 86fc916..24607c2 100644
--- a/tools/affxml.cpp
+++ b/tools/affxml.cpp
@@ -135,7 +135,7 @@ bool is_blank(const u_char *buf,size_t len)
 
 void print_xml64(const char *name,int64_t val)
 {
-    printf("   <%s coding='base10'>%"I64d"</%s>\n\n",name,val,name);
+    printf("   <%s coding='base10'>%" I64d"</%s>\n\n",name,val,name);
 }
 
 int xml_info(const char *infile)
@@ -191,7 +191,7 @@ int xml_info(const char *infile)
 	    size_t pagesize = af_page_size(af);
 	    size_t sectorsize = af_get_sectorsize(af);
 	    if(af_get_page(af,*it,data,&pagesize)){
-		err(1,"Can't read page %"PRId64,*it);
+		err(1,"Can't read page %" PRId64,*it);
 	    }
 	    psb.pages++;
 	    bool allblank = true;
@@ -250,14 +250,14 @@ int xml_info(const char *infile)
 	     * The strcmp is there because early AF_IMAGESIZE segs didn't set
 	     * AF_SEG_QUADWORD...
 	     */
-	    printf("    <%s coding='base10'>%"I64d"</%s>\n",segname,af_decode_q(data),segname);
+	    printf("    <%s coding='base10'>%" I64d"</%s>\n",segname,af_decode_q(data),segname);
 	    free(data);
 	    continue;
 	}
 
 	/* If datalen==0, just print the arg as an unsigned number */
 	if(datalen==0){
-	    printf("    <%s coding='base10'>%"PRIu32"</%s>\n",segname,arg,segname);
+	    printf("    <%s coding='base10'>%" PRIu32 "</%s>\n",segname,arg,segname);
 	    free(data);
 	    continue;
 	}
@@ -265,7 +265,7 @@ int xml_info(const char *infile)
 	/* Just handle it as binhex ... */
 	printf("    <%s",segname);
 	if(datalen==0){
-	    printf(" arg='%"PRIu32"' />\n",arg);
+	    printf(" arg='%" PRIu32 "' />\n",arg);
 	    free(data);
 	    continue;
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/afflib.git



More information about the forensics-changes mailing list