Combine the `first`, `increment`, and `last` parameters of the
`print_seq()` and `print_seq_integers()` functions into a `RangeF64` or
`RangeInt` type, respectively.
- Implement all of GNU's fiddly little details
- Don't assume Linux for error codes
- Accept badly-encoded filenames
- Report errors after the fact instead of checking ahead of time
- General cleanup
rmdir now passes GNU's tests.
If reading fails midway through then a count should be reported for
what could be read.
If opening a file fails then no count should be reported.
The exit code shouldn't report the number of failures, that's fragile
in case of many failures.
Errors are now always shown with the corresponding filename.
Errors are no longer converted into warnings. Previously `wc < .`
would cause a loop.
Checking whether something is a directory is no longer done in
advance. This removes race conditions and the edge case where stdin is
a directory.
The custom error type is removed because io::Error is now enough.
- Reuse allocations for read lines
- Increase splice size
- Check if /dev/null was opened correctly
- Do not discard read bytes after I/O error
- Add fast line counting with bytecount
Adapt the tests to work with the changed function interfaces. Added a
convenience function to construct a `clap` application that's used to test the
functions from a "user"-perspective.
Change all relevant functions to return `UResult`s from `BackupError` instead
of error strings. Make `determine_backup_mode/suffix` accept `clap::ArgMatches`
as input argument to parse for the arguments themselves, using the arguments
with are defined in the `arguments` submodule.
This way the user only needs to include the pre-defined arguments from the
`arguments` module and passes a reference to the applications `ArgMatches` into
the respective functions here. The functions then take care of handling the
arguments. It is recommended to use the arguments provided in the `arguments`
module over custom-defined ones.
Implements an error type based on `UError` that replaces the previously used
error strings. The errors are currently returned when determining the backup
mode, but extensions for future uses are already in place as comments.
Removes the `return_if_err!` and `safe_unwrap!` macros, which have now
been replaces by `crash_if_err!` throughout the whole code and thus
aren't used any longer.
Unify the usage of macros `return_if_err` and `crash_if_err`. As
`return_if_err` is used only in `uumain` routines of utilities, it
achieves the same thing as `crash_if_err`, which calls the `crash!`
macro to terminate function execution immediately.
Unify the usage of macros `safe_unwrap` and `crash_if_err` that are
identical to each other except for the assumption of a default error
code. Use the more generic `crash_if_err` so that `safe_unwrap` is now
obsolete and can be removed.