mark_time = endtime;
}
+static void usage(void)
+{
+ fprintf(stderr,"usage: shredtree [-c] [-d dir ] [-s shredsize] [-w] [-x] path...\n");
+ fprintf(stderr," -c = generate SCF files\n");
+ fprintf(stderr," -d dir = change directory before digesting.\n");
+ fprintf(stderr," -s size = set shred size (default %d)\n", shredsize);
+ fprintf(stderr," -w = remove whitespace.\n");
+ fprintf(stderr," -x = debug, display chunks in output.\n");
+ exit(0);
+}
+
main(int argc, char *argv[])
{
extern char *optarg; /* set by getopt */
debug = 1;
break;
- case 'h':
default:
- fprintf(stderr,"usage: shredtree [-c] [-d dir ] [-h] [-s shredsize] [-w] [-x] path\n");
- fprintf(stderr," -c = generate SCF files\n");
- fprintf(stderr," -d dir = change directory before digesting.\n");
- fprintf(stderr," -h = help (display this message).\n");
- fprintf(stderr," -s size = set shred size (default %d)\n",
- shredsize);
- fprintf(stderr," -w = remove whitespace.\n");
- fprintf(stderr," -x = debug, display chunks in output.\n");
- exit(0);
+ usage();
}
}
sort_count = 0;
}
+ if ((argc - optind) == 0)
+ usage();
+
report_time(NULL);
/* special case if user gave exactly one tree */
- if (optind == argc - 1)
+ if (!compile_only && optind == argc - 1)
{
generate_shredfile(argv[optind], stdout);
exit(0);
{
u_int32_t sectcount;
int hashcount = 0;
+ struct stat sb;
+ stat(name, &sb);
fprintf(stderr, "%% Reading hash list %s... ", name);
fread(§count, sizeof(u_int32_t), 1, fp);
sectcount = ntohl(sectcount);
this.end = FROMNET(this.end);
corehook(this, head->file);
hashcount++;
-#ifdef FIXME
if (hashcount % 10000 == 0)
- fprintf(stderr,"\b\b\b%02.0f%%",(ftell(fp) / (total * 0.01)));
-#endif
+ fprintf(stderr,"\b\b\b%02.0f%%",(ftell(fp) / (sb.st_size * 0.01)));
}
}
fprintf(stderr, "\b\b\b100%%...done, %d entries\n", hashcount);