For coreutils, there are two build artifacts:
1. multicall executable (each utility is a separate static library)
2. individual utilities (still separate library with main wrapper)
To avoid namespace collision, each utility crate is defined as
"uu_{CMD}". The end user only sees the original utility name. This
simplifies build.rs.
Also, the thin wrapper for the main() function is no longer contained in
the crate. It has been separated into a dedicated file. This was
necessary to work around Cargo's need for the crate name attribute to
match the name in the respective Cargo.toml.
I switched over to the getopts crate on crates.io, instead of Rust's
private implementation. This will allow coreutils to build for Rust 1.0.
I'm splitting the updates into several commits for better reviewing.
Prior to this CL, --address-radix was being used to determine the format
of the output bytes. This was wrong: this flag controls the printing of
the address (in the POSIX spec for od, this is called the "input offset
base"), not the printing of the content bytes.
+ Make parse_radix terser and clearer.
+ Make purpose of radix clearer at use site
(note that the code currently completely misuses the --address-radix
flag; this is inherited from the previous code)
+ Don't panic! inside parse_radix; instead return Result<> and let the
caller handle errors (currently we panic, but probably we'll want to use
some less alarming error routine); this will be more testable later as
well.