CODE = shredtree.c shred.h report.c main.c md5.c md5.h filterator
DOCS = README comparator.xml scf-standard.xml COPYING
EXTRAS = shredtree.py shredcompare.py
-TEST = test1 test2 test3 test4
+TEST = test1
SOURCES = $(CODE) $(DOCS) $(EXTRAS) $(TEST) comparator.spec Makefile
CFLAGS=-g
scf-standard.html: scf-standard.xml
xmlto html-nochunks scf-standard.xml
-test-a: comparator
- @comparator test1 test2
-test-b: comparator
- @comparator test3 test4
+test1: comparator
+ @comparator -w -C -d test test1-a test1-b
+test2: comparator
+ @comparator -w -C -d test test2-a test2-b
+test3: comparator
+ @comparator -w -C -d test test3-a test3-b
install: comparator.1 uninstall
install -m 755 -o 0 -g 0 -d $(ROOT)/usr/bin/
<arg choice='opt'>-o <replaceable>file</replaceable></arg>
<arg choice='opt'>-s <replaceable>shredsize</replaceable></arg>
<arg choice='opt'>-w</arg>
+ <arg choice='opt'>-C</arg>
<arg choice='opt'>-x</arg>
<arg choice='plain' rep='repeat'>path</arg>
<sbr/>
<para>The <option>-w</option> causes all whitespace in the file
(including blank lines) to be ignored for comparison purposes (line
-numbers in the output report will nevertheless be correct). This is
-recommended for comparing C code; among other things it means the
-comparison won't be fooled by differences in indent style.</para>
+numbers in the output report will nevertheless be correct).</para>
+
+<para>The <option>-C</option> applies C-language-specific
+normalization; { and } characters are removed. This is recommended
+for comparing C code; it prevents the comparison won't be fooled by
+differences in indent style.</para>
<para>The <option>-x</option> enables some debugging output. It
is for developers; if you need to understand it, read the code.</para>
compile_only = file_only = 0;
dir = outfile = NULL;
- while ((status = getopt(argc, argv, "cd:ho:s:wx")) != EOF)
+ while ((status = getopt(argc, argv, "cCd:ho:s:wx")) != EOF)
{
switch (status)
{
compile_only = 1;
break;
+ case 'C':
+ c_normalization = 1;
+ break;
+
case 'd':
dir = optarg;
break;
sort_hashes(sort_buffer, sort_count);
report_time("Sort done");
-#ifdef DEBUG
if (debug)
{
puts("Chunk list before reduction.");
- dump_array(obarray, hashcount, NULL);
+ dump_array(sort_buffer, sort_count, NULL);
}
+#ifdef DEBUG
#endif /* DEBUG */
emit_report(sort_buffer, sort_count);
};
/* control bits, meant to be set at startup */
-extern int c_only;
+extern int c_normalization;
extern int rws;
extern int debug;
extern int shredsize;
#include "shred.h"
/* control bits, meant to be set at startup */
-int c_only = 0;
+int c_normalization = 0;
int rws = 0;
int shredsize = 3;
*tp++ = *sp;
*tp = '\0';
}
+ if (c_normalization) /* strip whitespace, ignore blank lines */
+ {
+ char *tp, *sp;
+
+ for (tp = sp = buf; *sp; sp++)
+ if (*sp != '{' && *sp != '}')
+ *tp++ = *sp;
+ *tp = '\0';
+ }
return(buf[0]);
}