Add option to display hash information without enabling verbose mode.

This commit is contained in:
Con Kolivas 2011-02-20 12:20:05 +11:00
parent 4036125f94
commit 44a279579e
3 changed files with 7 additions and 3 deletions

6
main.c
View file

@ -52,6 +52,7 @@ static void usage(void)
print_output(" -V show version\n");
print_output(" -t test compressed file integrity\n");
print_output(" -i show compressed file information\n");
print_output(" -H display md5 Hash integrity information\n");
print_output("\nIf no filenames or \"-\" is specified, stdin/out will be used.\n");
}
@ -569,7 +570,7 @@ int main(int argc, char *argv[])
else if (!strstr(eptr,"NOCONFIG"))
read_config(&control);
while ((c = getopt(argc, argv, "L:hdS:tVvDfqo:w:nlbMUO:T:N:p:gzi")) != -1) {
while ((c = getopt(argc, argv, "L:hdS:tVvDfqo:w:nlbMUO:T:N:p:gziH")) != -1) {
switch (c) {
case 'L':
control.compression_level = atoi(optarg);
@ -683,6 +684,9 @@ int main(int argc, char *argv[])
case 'i':
control.flags |= FLAG_INFO;
break;
case 'H':
control.flags |= FLAG_HASH;
break;
case 'h':
usage();
return -1;

View file

@ -243,7 +243,7 @@ i64 runzip_fd(int fd_in, int fd_out, int fd_hist, i64 expected_size)
md5_finish_ctx (&control.ctx, md5_resblock);
if (HASH_CHECK || VERBOSE) {
print_output("MD5 sum: ");
print_output("MD5: ");
for (j = 0; j < MD5_DIGEST_SIZE; j++)
print_output("%02x", md5_resblock[j] & 0xFF);
print_output("\n");

2
rzip.c
View file

@ -917,7 +917,7 @@ retry:
md5_finish_ctx (&control.ctx, md5_resblock);
if (HASH_CHECK || VERBOSE) {
print_output("MD5 sum: ");
print_output("MD5: ");
for (j = 0; j < MD5_DIGEST_SIZE; j++)
print_output("%02x", md5_resblock[j] & 0xFF);
print_output("\n");