Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
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>
|
|
|
|
Also be a bit more consistent about `COMMAND [ARG...]` in usage text.
|
|
|
|
|
|
|
|
--signal is simply a synonym for the exiting -s.
--foreground disables functionality we didn't yet have: putting the
child into a new process group. I've added the functionality and the
flag to disable it.
--preserve-status also makes it clear that our exit statuses didn't match
the coreutils version. In addition to callers that use --preserve-status
to get away from this madness, I also have callers that check for
specific exit values. This patch implements --preserve-status but also
fixes all the other exit statuses.
(The "125" exit value is broken for toybox in the same way that
`toybox grep --whoops ; echo $?` is. To fix this, we'd need some way to
signal that command-line parsing failures should exit with a different
value than the usual 1 --- 2 for grep, 125 for timeout. I've done as much
as grep manages, and left a TODO.)
Also add timeout tests. I couldn't think of an easy test for
--foreground, so I tested that manually with strace.
Also add some newlines to the `toybox --help` output to make it easier
to find the different sections, and expand the section on durations to
call out that fractions are supported as a matter of policy.
As long as timeout and sleep have text describing the duration syntax,
make them the same. (Personally I'd remove both in favor of the `toybox
--help` output, but as long as they're duplicated, keep them consistent.)
Also remove the SLEEP_FLOAT variant --- xparsetime means that sleep no
longer requires floating point to support sub-second resolution.
|
|
stdin/stdout filehandles.
|
|
|
|
|
|
|
|
More consistent tense, capitalization, and punctuation. A few commands were
missing an introductory line, so I copied those from the first comment
line.
|
|
Do the FLAG() and short argument variable cleanups while we're there.
|
|
|
|
|
|
|
|
Inspired by some of the small patches that have gone by recently.
Limited to only things found in `generated/help.h`, plus a wider cleanup
for the more common "milisecond" typo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Used in the AOSP x86 host build.
|
|
Internally, Google uses all the longopts; Android currently only uses
this one. I was tempted to add the others, but went with "add them when a
toybox user needs them" rather than "add them when you've seen them used".
|
|
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".
|
|
|
|
|
|
|
|
|
|
|
|
xparsetime() not to need floating point, adjust callers.
|
|
From eyeballing the output of
for i in `./toybox | tr " " "\n"` ; do ./toybox $i --help ; done | \
grep '^-' | grep -v "\t"
|
|
|
|
Bug: https://github.com/landley/toybox/issues/104
|
|
|
|
|
|
(Fixed one declaration not at start of a block.)
|
|
|
|
|
|
|
|
|
|
(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.
|