Skip to content
21 changes: 10 additions & 11 deletions src/uu/cksum/src/cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use std::iter;
use std::path::Path;
use uucore::checksum::{
calculate_blake2b_length, detect_algo, digest_reader, perform_checksum_validation,
ChecksumError, ALGORITHM_OPTIONS_BLAKE2B, ALGORITHM_OPTIONS_BSD, ALGORITHM_OPTIONS_CRC,
ALGORITHM_OPTIONS_SYSV, SUPPORTED_ALGORITHMS,
ChecksumError, ChecksumOptions, ALGORITHM_OPTIONS_BLAKE2B, ALGORITHM_OPTIONS_BSD,
ALGORITHM_OPTIONS_CRC, ALGORITHM_OPTIONS_SYSV, SUPPORTED_ALGORITHMS,
};
use uucore::{
encoding,
Expand Down Expand Up @@ -318,17 +318,16 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|| iter::once(OsStr::new("-")).collect::<Vec<_>>(),
|files| files.map(OsStr::new).collect::<Vec<_>>(),
);
return perform_checksum_validation(
files.iter().copied(),
strict,
status,
warn,
binary_flag,
let opts = ChecksumOptions {
binary: binary_flag,
ignore_missing,
quiet,
algo_option,
length,
);
status,
strict,
warn,
};

return perform_checksum_validation(files.iter().copied(), algo_option, length, opts);
}

let (tag, asterisk) = handle_tag_text_binary_flags(&matches)?;
Expand Down
16 changes: 10 additions & 6 deletions src/uu/hashsum/src/hashsum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use uucore::checksum::digest_reader;
use uucore::checksum::escape_filename;
use uucore::checksum::perform_checksum_validation;
use uucore::checksum::ChecksumError;
use uucore::checksum::ChecksumOptions;
use uucore::checksum::HashAlgorithm;
use uucore::error::{FromIo, UResult};
use uucore::sum::{Digest, Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256};
Expand Down Expand Up @@ -239,18 +240,21 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
|| iter::once(OsStr::new("-")).collect::<Vec<_>>(),
|files| files.map(OsStr::new).collect::<Vec<_>>(),
);
let opts = ChecksumOptions {
binary,
ignore_missing,
quiet,
status,
strict,
warn,
};

// Execute the checksum validation
return perform_checksum_validation(
input.iter().copied(),
strict,
status,
warn,
binary,
ignore_missing,
quiet,
Some(algo.name),
Some(algo.bits),
opts,
);
} else if quiet {
return Err(ChecksumError::QuietNotCheck.into());
Expand Down
Loading
Loading