diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-16 21:09:25 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-16 21:09:25 -0700 |
commit | 884baebe2d14a1326998be7704beb42564d1e9fd (patch) | |
tree | 0931aeb699697f55dded7cd24f315c8eae2daed6 /src | |
parent | b427cb6a1890ee5071ba6667c1a390fe93cb0a9d (diff) | |
download | geniza-884baebe2d14a1326998be7704beb42564d1e9fd.tar.gz geniza-884baebe2d14a1326998be7704beb42564d1e9fd.zip |
SLEEP read helper
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/geniza-sleep.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bin/geniza-sleep.rs b/src/bin/geniza-sleep.rs index 168f803..b7bb88e 100644 --- a/src/bin/geniza-sleep.rs +++ b/src/bin/geniza-sleep.rs @@ -23,6 +23,9 @@ fn run() -> Result<()> { .arg_from_usage("<magic> 'Magic word to use (eg, 0x5025700)'") .arg_from_usage("<entry_size> 'Size of each entry (bytes)'") .arg_from_usage("<algo_name> 'Name of algorithm (empty string for none)'")) + .subcommand(SubCommand::with_name("read-all") + .about("Reads a SLEEP file, iterates through all entries, prints raw bytes") + .arg_from_usage("<FILE> 'SLEEP file to read'")) .get_matches(); @@ -51,6 +54,13 @@ fn run() -> Result<()> { algo_name)?; println!("Done!"); }, + ("read-all", Some(subm)) => { + let path = Path::new(subm.value_of("FILE").unwrap()); + let mut sf = SleepFile::open(path, false)?; + for i in 0..sf.length()? { + println!("{}: {:?}", i, sf.read(i)); + } + }, _ => { println!("Missing or unimplemented command!"); println!("{}", matches.usage()); |