some fixes for hedu #64

Merged
PlexSheep merged 15 commits from devel into master 2024-01-18 13:45:27 +01:00
2 changed files with 6 additions and 19 deletions
Showing only changes of commit 73bd34c78d - Show all commits

View File

@ -150,6 +150,7 @@ pub fn dump(data: &mut dyn DataSource, config: &mut HeduConfig) -> Result<()> {
if config.stop || config.len == 0 { if config.stop || config.len == 0 {
break; break;
} }
rd_data(data, config)?;
// after line logic // after line logic
if config.buf[0] == config.buf[1] && config.len == BYTES_PER_LINE && !config.show_identical 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!( config.display_buf += &format!(
"^^^^^^^^ {LINE_SEP_VERT} (repeats {} lines){:32}", "^^^^^^^^ {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 { 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.alt_buf ^= 1; // read into the other buf, so we can check for sameness
config.display(); config.display();
} }
rd_data(data, config)?;
} }
config.data_idx += config.len;
config.sep(); config.sep();
config.display_buf += &format!( config.display_buf += &format!(
"{:08X} {LINE_SEP_VERT} dumped total:\t{:<8} {:<16}{:3}", "{:08X} {LINE_SEP_VERT} read total:\t\t {:<8} {:<15}",
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}",
config.rd_counter, config.rd_counter,
humanbytes(config.rd_counter), humanbytes(config.rd_counter),
format!("({} B)", config.rd_counter), format!("({} B)", config.rd_counter)
""
); );
if config.chars { if config.chars {
config.display_buf += &format!("{LINE_SEP_VERT}"); 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] != "-" { if cli.data_source.len() > 0 && cli.data_source[0] != "-" {
for data_source in &cli.data_source { for data_source in &cli.data_source {
let data_source: PathBuf = PathBuf::from(data_source); let data_source: PathBuf = PathBuf::from(data_source);
if !data_source.is_file() { if data_source.is_dir() {
warn!("Not a regular file {:?}, skipping", data_source); warn!("Not a file {:?}, skipping", data_source);
// std::process::exit(1); // std::process::exit(1);
continue; continue;
} }