Age | Commit message (Collapse) | Author |
|
This patch adds a BSD version of xgetmountlist (for the path ==
NULL case only), tested on macOS. It also papers over the differences
between macOS' and Linux's xattr APIs. For once I think the macOS
one is better. The imitation of mknodat I've had to write swings
things back in Linux's favor though.
BSD calls f_frsize by the name f_iosize instead. (FWIW, it looks
like this is meaningless on Linux and actually meaningful on macOS.)
I've added one #if to toys/ --- I'm calling pathconf in stat.c to
work around the absence of f_namelen, and have left a TODO with an
explanation. I'm not sure what the best fix is here, so punting.
No-one can agree what f_fsid is, even if they're all basically the
same, so work around the `val` versus `__val` issue between macOS
and Linux.
With this patch, it's now possible to build cp/mv/install and stat
for macOS too. (Which completes the set of "toybox commands currently
used on Linux as part of the AOSP build" if you ignore stuff that
deals with processes, which I doubt we'll ever be able to support
for lack of any API.)
|
|
We'd documented find %Z but not implemented it. We'd neither documented
nor implemented stat's corresponding %C (they'd already taken %Z for
ctime, which is ironic because %c/%C sounds more obvious than %z/%Z for
that to me).
|
|
next_printf() shouldn't return null unless it never found the start of an
escape sequence (it'll return a pointer to the null at the end of the string
otherwise), and the only time we point it at a % and it doesn't is when it's
%%. So handle that before calling. (Also, a single trailing % prints in
other implementations, and while I'm there update to use FLAG() macros,
add a couple comments, and only xflush() once per pattern.)
|
|
When the specified format string has odd '%' in the end,
the next_printf function will return null. Checking
the result value before using it.
Signed-off-by: liwugang <liwugang@xiaomi.com>
|
|
Used in the AOSP x86 host build.
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
|
|
(My apologies for mixing these two unrelated changes up.)
|
|
(At least for coreutils 8.28.)
|
|
`stat -c %a` doesn't output a leading zero, but `stat` does.
|
|
Even GNU coreutils 8.28 doesn't use the lopsided `quoting' any more.
|
|
|
|
POSIX does have a name for the struct timespec in struct stat.
|
|
|
|
not segfault on a lookup failure (they print the number instead of UNKNOWN).
The whitespace in the default output may need some adjusting.
|
|
(man 2 stat says so) and %B is the units on %b (I.E. always 512), so change
output and help text. This matches what other implementations produce.
|
|
|
|
7ca5dc4232b9ac5ee5cd25c8b5b33a58904cd251 didn't switch all callers over
to the new functions.
|
|
Suggested by Sameer Pradhan, or possibly Bilal Qureshi.
|
|
checking, and fix up format checking complaints.
Added out(type, value) function to stat to avoid a zillion printf typecasts.
|
|
|
|
|
|
Change-Id: I0ad65a40bf380d789c4396ebdc01be217901a2e3
|
|
Elliott Hughes).
|
|
|
|
|