# Makefile for comparator tools
SOURCES = shredtree.c shredcompare.c main.c md5.c md5.h
+DOCS = README comparator.xml
CFLAGS=-g
-all: comparator
+all: comparator comparator.1
main.o: main.c shred.h
$(CC) -c $(CFLAGS) main.c
clean:
rm -f comparator shredtree.o md5.o shredcompare.o TEST1 TEST2
+comparator.1: comparator.xml
+ xmlto man comparator.xml
+
test-a: comparator
comparator test1 test2
test-b: comparator
#include <string.h>
#include "shred.h"
+int debug = 0;
+
struct scf_t
{
char *name;
int oldcount, file_count;
oldcount = sort_count;
- fprintf(stderr, "%% Reading %s...", tree);
+ fprintf(stderr, "%% Reading tree %s...", tree);
list = sorted_file_list(tree, &file_count);
for (place = list; place < list + file_count; place++)
shredfile(*place, corehook);
u_int32_t sectcount;
int hashcount = 0;
- fprintf(stderr, "%% Reading %s... ", name);
+ fprintf(stderr, "%% Reading hash list %s... ", name);
fread(§count, sizeof(u_int32_t), 1, fp);
sectcount = ntohl(sectcount);
while (sectcount--)
struct match_t *hitlist, *sorted, *match;
int i, matchcount;
-#ifdef ODEBUG
- struct sorthash_t *np;
-
- for (np = obarray; np < obarray + hashcount; np++)
- printf("%d: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x %s:%d:%d\n",
- np-obarray,
- np->hash.hash[0],
- np->hash.hash[1],
- np->hash.hash[2],
- np->hash.hash[3],
- np->hash.hash[4],
- np->hash.hash[5],
- np->hash.hash[6],
- np->hash.hash[7],
- np->hash.hash[8],
- np->hash.hash[9],
- np->hash.hash[10],
- np->hash.hash[11],
- np->hash.hash[12],
- np->hash.hash[13],
- np->hash.hash[14],
- np->hash.hash[15],
- np->file, np->hash.start, np->hash.end);
-#endif /* ODEBUG */
+ if (debug)
+ {
+ struct sorthash_t *np;
+
+ for (np = obarray; np < obarray + hashcount; np++)
+ printf("%d: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x %s:%d:%d\n",
+ np-obarray,
+ np->hash.hash[0],
+ np->hash.hash[1],
+ np->hash.hash[2],
+ np->hash.hash[3],
+ np->hash.hash[4],
+ np->hash.hash[5],
+ np->hash.hash[6],
+ np->hash.hash[7],
+ np->hash.hash[8],
+ np->hash.hash[9],
+ np->hash.hash[10],
+ np->hash.hash[11],
+ np->hash.hash[12],
+ np->hash.hash[13],
+ np->hash.hash[14],
+ np->hash.hash[15],
+ np->file, np->hash.start, np->hash.end);
+ }
hitlist = reduce_matches(obarray, hashcount);
report_time("Reduction done");
/* control bits, meant to be set at startup */
int c_only = 0;
int rws = 0;
-int debug = 0;
int shredsize = 5;
struct item
unsigned char *cp;
struct hash_t out;
- if (debug)
- {
- for (i = 0; i < shredsize; i++)
- if (display[i].line)
- {
- fputc('\'', stderr);
- for (cp = display[i].line; *cp; cp++)
- if (*cp == '\n')
- fputs("\\n", stderr);
- else if (*cp == '\t')
- fputs("\\t", stderr);
- else
- fputc(*cp, stderr);
- fputc('\'', stderr);
- fputc('\n', stderr);
- }
- }
-
/* build completed chunk onto end of array */
md5_init_ctx(&ctx);
for (i = 0; i < shredsize; i++)