#include <unistd.h>
#include <stdarg.h>
#include <string.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include "shred.h"
{
char buf[BUFSIZ];
linenum_t chunks;
- struct item *new;
fgets(buf, sizeof(buf), fp);
*strchr(buf, '\n') = '\0';
if (mark_time)
{
- int elapsed = endtime - mark_time;
- int hours = elapsed/3600; elapsed %= 3600;
- int minutes = elapsed/60; elapsed %= 60;
- int seconds = elapsed;
+ int elapsed, hours, minutes, seconds;
char buf[BUFSIZ];
+ elapsed = endtime - mark_time;
+ hours = elapsed/3600; elapsed %= 3600;
+ minutes = elapsed/60; elapsed %= 60;
+ seconds = elapsed;
va_start(ap, legend);
vsprintf(buf, legend, ap);
exit(0);
}
+int
main(int argc, char *argv[])
{
extern char *optarg; /* set by getopt */
if (outfile)
{
- FILE *ofp;
-
if (freopen(outfile, "w", stdout) == NULL)
{
perror("comparator");
char buf[BUFSIZ];
dummy_scf.hash_method = "MD5";
- buf[0] == '\0';
+ buf[0] = '\0';
if (remove_whitespace)
strcat(buf, "remove-whitespace, ");
if (remove_comments)
#include <stdio.h>
#include <time.h>
#include <string.h>
+#include <stdlib.h>
#include <sys/types.h>
#include "shred.h"
#endif /* DEBUG */
}
dummy_match;
-static struct match_t *reduced = &dummy_match;
static int merge_ranges(struct range_t *p, struct range_t *q, int nmatches)
/* merge p into q, if the ranges in the match are compatible */
return reduced;
}
-static int sortmatch(void *a, void *b)
+static int sortmatch(const void *a, const void *b)
/* sort by file and first line */
{
struct range_t *s = ((struct match_t *)a)->matches;
#include <string.h>
#include <ftw.h>
#include <errno.h>
-#include <alloca.h>
+#include <ctype.h>
+#include <stdlib.h>
#include <netinet/in.h>
#include "md5.h"
#include "shred.h"
{
FILE *fp = fopen(file, "r");
char buf[BUFSIZ], *cp;
- int printable;
+ int printable = 0;
if (!fp || !fgets(buf, sizeof(buf)-1, fp))
return(0);
{
struct md5_ctx ctx;
int i, firstline;
- unsigned char *cp;
struct hash_t out;
/* build completed chunk onto end of array */
md5_process_bytes(display[i].line, strlen(display[i].line), &ctx);
}
md5_finish_ctx(&ctx, (void *)&out.hash);
+ firstline = shredsize;
for (i = shredsize - 1; i >= 0; i--)
if (display[i].line)
firstline = i;
return(0);
}
-static int stringsort(void *a, void *b)
+static int stringsort(const void *a, const void *b)
/* sort comparison of strings by content */
{
return strcmp(*(char **)a, *(char **)b);
*
*************************************************************************/
-static int sortchunk(void *a, void *b)
+static int sortchunk(const void *a, const void *b)
/* sort by hash */
{
int cmp = HASHCMP((struct sorthash_t *)a, (struct sorthash_t *)b);