fix line counter for skipped lines
cargo devel CI / cargo CI (push) Successful in 2m0s Details

This commit is contained in:
Christoph J. Scherr 2024-01-18 12:04:20 +01:00
parent 55e7bf0f86
commit 73bd34c78d
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
2 changed files with 6 additions and 19 deletions

View File

@ -150,6 +150,7 @@ pub fn dump(data: &mut dyn DataSource, config: &mut HeduConfig) -> Result<()> {
if config.stop || config.len == 0 {
break;
}
rd_data(data, config)?;
// after line logic
if config.buf[0] == config.buf[1] && config.len == BYTES_PER_LINE && !config.show_identical
@ -164,7 +165,7 @@ pub fn dump(data: &mut dyn DataSource, config: &mut HeduConfig) -> Result<()> {
}
config.display_buf += &format!(
"^^^^^^^^ {LINE_SEP_VERT} (repeats {} lines){:32}",
(config.data_idx - start_line) / (BYTES_PER_LINE * 2),
(config.data_idx - start_line) / (BYTES_PER_LINE) + 1,
""
);
if config.chars {
@ -177,28 +178,14 @@ pub fn dump(data: &mut dyn DataSource, config: &mut HeduConfig) -> Result<()> {
config.alt_buf ^= 1; // read into the other buf, so we can check for sameness
config.display();
}
rd_data(data, config)?;
}
config.data_idx += config.len;
config.sep();
config.display_buf += &format!(
"{:08X} {LINE_SEP_VERT} dumped total:\t{:<8} {:<16}{:3}",
config.data_idx,
humanbytes(config.data_idx),
format!("({} B)", config.data_idx),
""
);
if config.chars {
config.display_buf += &format!("{LINE_SEP_VERT}");
}
config.display();
config.display_buf += &format!(
"{:08X} {LINE_SEP_VERT} read total:\t\t{:<8} {:<16}{:3}",
"{:08X} {LINE_SEP_VERT} read total:\t\t {:<8} {:<15}",
config.rd_counter,
humanbytes(config.rd_counter),
format!("({} B)", config.rd_counter),
""
format!("({} B)", config.rd_counter)
);
if config.chars {
config.display_buf += &format!("{LINE_SEP_VERT}");

View File

@ -101,8 +101,8 @@ fn main() {
if cli.data_source.len() > 0 && cli.data_source[0] != "-" {
for data_source in &cli.data_source {
let data_source: PathBuf = PathBuf::from(data_source);
if !data_source.is_file() {
warn!("Not a regular file {:?}, skipping", data_source);
if data_source.is_dir() {
warn!("Not a file {:?}, skipping", data_source);
// std::process::exit(1);
continue;
}