Since stdout is line-buffered by default, we need to ensure any pending
writes are flushed before exiting. Ideally, this should be enforced by
each utility. Since all utilities are wrapped by mkmain, this was a
convenient location to enforce this behavior. I previously was handling
this on a case-by-case basis.
See: https://github.com/rust-lang/rust/issues/23818
With this change, individual submodules can specify their dependencies with
an additional file called "deps.mk" in the subdir. When building, only
the dependencies that are necessary are built, using cargo, and then linked.
This greatly simplifies adding new dependencies: add the package in
deps/Cargo.toml, and add the appropriate line in "deps.mk" in the
src/utilname/ directory, and the dependency will be built automatically
as needed.
This also removes the need to use git submodules.
This patch begins the work of modernizing uutils to work with 1.0-ish
Rust. In particular, it
1. Updates to the latest submodules.
2. Convert mkmain.rs, mkuutils.rs, and src/uutils/uutils.rs
to new slice syntax and use of new io, fs, and path APIs.
3. Convert src/common/util.rs to new io, fs, and path APIs.
4. Convert fmt to use new APIs.