version number

This commit is contained in:
corey 2024-01-08 08:00:25 -06:00
parent 02e2a8351c
commit 5ccabca9ab
3 changed files with 9 additions and 3 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
hd
version.rs

View File

@ -7,9 +7,11 @@ install: $(OBJS)
install hd $(DESTDIR)$(PREFIX)/bin/
uninstall:
$(RM) $(DESTDIR)$(PREFIX)/hd
hd: main.rs
rustc $^ -o $@
hd: main.rs hdinfo.rs version.rs
rustc $< -o $@
@strip $@
version.rs:
printf "pub const VERSION:&str=\"$(shell git describe --abbrev=0 --tags)\";\n" > $@
%:%.rs
rustc $^ -o $@
@strip $@

View File

@ -1,3 +1,4 @@
mod version;
mod hdinfo;
fn main()
@ -6,7 +7,8 @@ fn main()
let mut files:Vec<String>=vec!();
let mut curarg=1;
let mut h:hdinfo::Hdinfo=hdinfo::Hdinfo::new();
let helpmsg=format!("usage: {} [-abh] [-n OFFSET] [-r RADIX] [-w WIDTH] [--help] FILES\n\
let helpmsg=format!("hd v{}\n\
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\
@ -15,6 +17,7 @@ fn main()
-w WIDTH Number of columns for output\n\n\
SIZE An unsigned integer or a percentage (e.g., 50%)\n\
RADIX One of: 8, 10, 16",
version::VERSION,
argv[0]);
// Parse each file