updated helpmsg

This commit is contained in:
cr0sd 2020-12-30 16:09:55 -06:00
parent 9f264ba16d
commit cb83333cfd
2 changed files with 26 additions and 24 deletions

2
README
View File

@ -1,4 +1,4 @@
usage: hd [-abh] [-n OFFSET] [-w WIDTH] [--help] FILES
usage: hd [-abh] [-n OFFSET] [-r RADIX] [-w WIDTH] [--help] FILES
-a Don't display ASCII dump
-b Don't display binary file offset
-h, --help Display this help

48
main.rs
View File

@ -1,32 +1,10 @@
struct Hdinfo
{
columns:usize,
showoffset:bool,
showascii:bool,
numbytes:usize,
radix:u32,
percent:f32,
}
fn newhd() -> Hdinfo
{
return Hdinfo{
columns:8,
showoffset:true,
showascii:true,
numbytes:0,
radix:16,
percent:1.0,
}
}
fn main()
{
let argv:Vec<String>=std::env::args().collect();
let mut files:Vec<String>=vec!();
let mut curarg=1;
let mut h:Hdinfo=newhd();
let helpmsg=format!("usage: {} [-abh] [-n OFFSET] [-w WIDTH] [--help] FILES\n\
let helpmsg=format!("usage: {} [-abh] [-n OFFSET] [-r RADIX] [-w WIDTH] [--help] FILES\n\
-a Don't display ASCII dump\n\
-b Don't display binary file offset\n\
-h, --help Display this help\n\
@ -208,6 +186,30 @@ fn main()
}
}
// Contain information for hexdump
struct Hdinfo
{
columns:usize,
showoffset:bool,
showascii:bool,
numbytes:usize,
radix:u32,
percent:f32,
}
// Initialize Hdinfo struct
fn newhd() -> Hdinfo
{
return Hdinfo{
columns:8,
showoffset:true,
showascii:true,
numbytes:0,
radix:16,
percent:1.0,
}
}
// Hexdump a file
fn hexdump(filename:&String,h:&Hdinfo)
{