fputs("Generator-Program: comparator 1.0\n", ofp);
fputs("Hash-Method: MD5\n", ofp);
buf[0] = '\0';
- if (rws)
+ if (remove_whitespace)
strcat(buf, "remove-whitespace,");
- if (c_normalization)
- strcat(buf, "c-normalization,");
+ if (remove_braces)
+ strcat(buf, "remove-braces,");
if (buf[0])
buf[strlen(buf)-1] = '\0';
else
break;
case 'C':
- c_normalization = 1;
+ remove_braces = 1;
break;
case 'd':
break;
case 'w':
- rws = 1;
+ remove_whitespace = 1;
break;
case 'x':
/* if there were no SCFs, create a dummy one */
if (scf_head == &dummy_scf)
{
+ char buf[BUFSIZ];
+
dummy_scf.hash_method = "MD5";
- dummy_scf.normalization = rws ? "remove_whitespace" : "none";
+ buf[0] == '\0';
+ if (remove_whitespace)
+ strcat(buf, "remove-whitespace,");
+ if (remove_braces)
+ strcat(buf, "remove-braces,");
+ if (buf[0])
+ buf[strlen(buf)-1] = '\0';
+ else
+ strcpy(buf, "none");
+ dummy_scf.normalization = strdup(buf);
dummy_scf.shred_size = shredsize;
dummy_scf.generator_program = "comparator 1.0";
}
</affiliation>
</author>
-<revhistory>
+<revhistory>
<revision>
+ <revnumber>1.1</revnumber>
+ <date>2003-10-07</date>
+ <authorinitials>esr</authorinitials>
+ <revremark>
+ Added remove-braces.
+ </revremark>
+ </revision>
+ <revision>
<revnumber>1.0</revnumber>
<date>2003-09-07</date>
<authorinitials>esr</authorinitials>
(spaces, tabs, and linefeeds) has been stripped out.</para>
</listitem>
-<!--
<listitem>
<para><emphasis>remove-braces</emphasis>: Remove { and }.</para>
</listitem>
+<!--
<listitem>
<para><emphasis>remove-C-comments</emphasis>: Remove /* and */</para>
</listitem>
};
/* control bits, meant to be set at startup */
-extern int c_normalization;
-extern int rws;
+extern int remove_braces;
+extern int remove_whitespace;
extern int debug;
extern int shredsize;
#include "shred.h"
/* control bits, meant to be set at startup */
-int c_normalization = 0;
-int rws = 0;
+int remove_braces = 0;
+int remove_whitespace = 0;
int shredsize = 3;
struct item
static int normalize(char *buf)
/* normalize a buffer in place, return 0 if it should be skipped */
{
- if (rws) /* strip whitespace, ignore blank lines */
+ if (remove_whitespace) /* strip whitespace, ignore blank lines */
{
char *tp, *sp;
*tp++ = *sp;
*tp = '\0';
}
- if (c_normalization) /* strip whitespace, ignore blank lines */
+ if (remove_braces) /* strip C statement brackets */
{
char *tp, *sp;