aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-10-16 21:09:25 -0700
committerBryan Newbold <bnewbold@robocracy.org>2017-10-16 21:09:25 -0700
commit884baebe2d14a1326998be7704beb42564d1e9fd (patch)
tree0931aeb699697f55dded7cd24f315c8eae2daed6 /src/bin
parentb427cb6a1890ee5071ba6667c1a390fe93cb0a9d (diff)
downloadgeniza-884baebe2d14a1326998be7704beb42564d1e9fd.tar.gz
geniza-884baebe2d14a1326998be7704beb42564d1e9fd.zip
SLEEP read helper
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/geniza-sleep.rs10
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());