Move rust-readelf out into its own package

This commit is contained in:
Christopher Cole 2016-04-20 21:03:18 -07:00
parent 0a9f684c9b
commit 2810b1b803
2 changed files with 0 additions and 37 deletions

View File

@ -10,9 +10,6 @@ description = "A pure-rust library for parsing ELF files"
keywords = ["elf"]
readme = "README.md"
[[bin]]
name = "rust-readelf"
[lib]
name = "elf"

View File

@ -1,34 +0,0 @@
extern crate elf;
use std::env;
use std::path::PathBuf;
fn main() {
let args: Vec<String> = env::args().collect();
let paths: Vec<PathBuf> = if args.len() == 1 {
vec!(From::from("stress"))
} else {
let mut i = args.into_iter();
i.next();
i.map(|arg| From::from(arg) )
.collect()
};
for path in paths.into_iter() {
let file = match elf::File::open_path(&path) {
Ok(f) => f,
Err(e) => panic!("Error: {:?}", e),
};
println!("Debug-print ELF file:");
println!("{:?}", file);
println!("");
println!("Pretty-print ELF file:");
println!("{}", file);
println!("Getting the .text section");
let text = file.get_section(".text");
match text {
Some(s) => println!("shdr: {}", s),
None => println!("Failed to look up .text section!"),
}
}
}