Fix up the -s option, and make usage consitent with behaviour,

patch by Steven Scholz
This commit is contained in:
Glenn L McGrath 2003-11-20 05:58:26 +00:00
parent d85421de22
commit 5c069aaf2f

View File

@ -143,8 +143,10 @@ extern int hash_files(int argc, char **argv, const uint8_t hash_algo)
hash_value = hash_file(filename_ptr, hash_algo);
if (hash_value && (strcmp(hash_value, line) == 0)) {
if (!(flags & FLAG_SILENT))
printf("%s: OK\n", filename_ptr);
} else {
if (!(flags & FLAG_SILENT))
printf("%s: FAILED\n", filename_ptr);
count_failed++;
}
@ -152,7 +154,7 @@ extern int hash_files(int argc, char **argv, const uint8_t hash_algo)
free(hash_value);
free(line);
}
if (count_failed) {
if (count_failed && !(flags & FLAG_SILENT)) {
bb_error_msg("WARNING: %d of %d computed checksums did NOT match",
count_failed, count_total);
}
@ -178,9 +180,6 @@ extern int hash_files(int argc, char **argv, const uint8_t hash_algo)
if (hash_value == NULL) {
return_value++;
} else {
#ifdef CONFIG_FEATURE_MD5_SHA1_SUM_CHECK
if (!flags & FLAG_SILENT)
#endif
printf("%s %s\n", hash_value, file_ptr);
free(hash_value);
}