Change `printf` to correctly terminate with an error message when an
escape sequence starts with `\x` but doesn't include a literal
hexadecimal value after. For example, before this commit,
printf '\x'
would output `\x`, but after this commit, it terminates with an error
message,
printf: missing hexadecimal number in escape
Fixes#7097
Add support for parsing percent arguments to the `-S` option. The given
percentage specifies a percentage of the total physical memory. For
Linux, the total physical memory is read from `/proc/meminfo`. The
feature is not yet implemented for other systems.
In order to implement the feature, the `uucore::parser::parse_size`
function was updated to recognize strings of the form `NNN%`.
Fixes#3500
Replace the display of certain special characters in `df`: ASCII space
for plain space character, ASCII horizontal tab for plain tab
character, and ASCII backslash for plain backslash character.
Co-authored-by: Jeffrey Finkelstein <jeffrey.finkelstein@protonmail.com>
This change resolves issues with exponent calculation and usage,
ensuring more accurate formatting:
- Exponent for negative values can differ from 0
- Switching to decimal mode now follows the P > X ≥ −4 rule
Improve the error message produced by `seq` when given invalid format
specifiers for the `-f` option. Before this commit:
$ seq -f "%" 1
seq: %: invalid conversion specification
$ seq -f "%g%" 1
seq: %: invalid conversion specification
After this commit:
$ seq -f "%" 1
seq: format '%' ends in %
$ seq -f "%g%" 1
seq: format '%g%' has too many % directives
This matches the behavior of GNU `seq`.
This adds the `os_str_as_bytes_lossy` function, for when we want infallible
conversion across platforms, and improves the doc comments of similar functions
to be more accurate and better formatted.
The code above this line handles the case if `res` is
larger than `ngroups`, but `res < ngroups` is also a possibility,
which this line attempts to address but actually does not.
The original code resizes to `ngroups` which is a no-op (given
that `groups` is already `ngroups` size). The correct target for
re-sizing the `groups` is the result from the last `getgroups`,
i.e., `res`.
Splice is a Linux-specific syscall that allows direct data copying from
one file descriptor to another without user-space buffer. As of now, this
is used by `cp`, `cat`, and `install` when compiled for Linux and Android.
This exposes the non-UTF-8 functionality to callers. Support in `argument`,
`spec`, and `wc` are implemented, as their usage is simple. A wrapper only
returning valid unicode is used in `ls`, since proper handling of OsStrings
there is more involved (outputs that escape non-unicode work now though).