Age | Commit message (Collapse) | Author |
|
(Based on someone else's patch.)
Implementing -F with inotify is a lot more work (including more
portability shims for macOS), so this is a simpler polling
implementation.
Also fix my earlier mistake where xnotify_add() wasn't actually an 'x'
function that exits on failure.
|
|
|
|
|
|
and not many systems need to know "free terabytes".
|
|
|
|
|
|
|
|
I don't think it was wrong before, but the strchr() in particular left
me scratching my head. This formulation is slightly cheaper and seems
more obviously correct.
(Unrelated but nearby, I don't understand why anyone would ever want to
calculate these tables at runtime, so this seems like another
unnecessary CFG_TOYBOX_FLOAT to me, though an unusual one where we might
want to _remove_ the floating-point code.)
|
|
|
|
|
|
The intent here seems to have been to ignore lines with too few
arguments to be valid, but since strtok() returns NULL at the end of the
string, if you only have "verb noun", you'd be falsely rejected.
Since we've kept a count anyway, just check the count.
|
|
Make everything an OLDTOY of md5sum (combining help text), remove enum,
combine unions, actually track 128 bit count for sha384/512.
|
|
|
|
|
|
Used by someone's script.
|
|
|
|
|
|
work for SHA-512's 64-bit values
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I don't _think_ that can happen with the .dep files since they're
machine-generated, but the config files can and do contain empty lines
to aid readability.
(Not found on Android, so I haven't tested this, but the code already
even contained a special case for empty lines. I haven't touched the
/proc/modules loop because the kernel definitely isn't going to insert
empty lines, and that code _would_ need to be modified to cope with
empty lines, and since I can't test this, that would be not just
pointless but also irresponsible!)
|
|
|
|
The maximum unicode code point is 0x10ffff which is 21 bits.
|
|
|
|
|
|
(utf8 can go to 7 bytes but unicode can't) so only test unicode range.
|
|
|
|
|
|
|
|
|
|
I don't see the need for the separate buffer, and just using dprintf()
directly is less code. The only downside really is having to get the
right number of `%c`s in your format string.
|
|
|
|
|
|
|
|
|
|
This patch does two things:
1. Enable line buffering for echo and yes. I found this through test
flakiness from the toybox xargs tests running in CI on devices where
"echo" is provided by toybox. For `echo y`, GNU echo does one write
of "y\n" but toybox echo was doing two writes, which makes it more
likely (4% on the heavily-loaded CI machines) for writes from the two
processes to be interleaved.
2. Fix line buffering on glibc if you're calling `toybox foo` rather
than `foo`. Otherwise we come through once and switch to unbuffered
mode, then again and switch to line buffered mode --- which doesn't
seem to actually work in glibc unless you specify a buffer (so
passing toybuf and sizeof(toybuf) works, but NULL and 0 doesn't).
I hit the second issue trying to reproduce the first issue on the desktop
rather than on Android.
(If you're scratching your head wondering "why yes(1) too, not just
echo(1)?", that represents a blind alley I went down when I mistook
which tool was in use. It seemed like the same principle should apply,
and it matches what other implementations do.)
|
|
mostly only safe to use behind a firewall or through a VPN these days.
|
|
Of course "x() { echo hello; } | tr e f; x" allows the pipe but not the call.
Ok, take out the union so you can && after a function declaration.
|
|
|
|
|
|
This got a bit out of hand. All I wanted to fix was the CR conversion to
get this part of https://tools.ietf.org/html/rfc854 right:
Therefore, the sequence "CR LF" must be treated as a single "new
line" character and used whenever their combined action is
intended; the sequence "CR NUL" must be used where a carriage
return alone is actually desired; and the CR character must be
avoided in other contexts. This rule gives assurance to systems
which must decide whether to perform a "new line" function or a
multiple-backspace that the TELNET stream contains a character
following a CR that will allow a rational decision.
But to understand the code well enough to do that, and to fix it so that
it works when IAC or CR sequences are split across multiple reads, I
ended up rewriting a lot:
* Add punctuation in help.
* Remove duplicated #include.
* Remove some unnecessary globals, enlarge the global buffers, and keep
state for correct IAC sequence processing across reads.
* Reduce code duplication and rewrite bits that made no sense.
* Handle entering/exiting raw mode more uniformly.
* Fix the prompt (the character count was wrong).
* Allow ^]^D (like BSD telnet) as well as ^]e to exit, and look less
like we crashed when doing so.
* Simplify the IAC sequence handling, but more importantly work
correctly when a sequence is split across multiple reads.
* Use more of the existing "x" functions from lib. (And remove code that
was duplicating what the "x" functions they'd just called had already
done.)
* Show "Connected to".
* Better signal handling.
I'm still not happy with TELOPT_ECHO and TELOPT_SGA in handle_wwdd(),
but don't (yet) understand them well enough to simplify them further. On
the bright side, I think TELOPT_NAWS is a lot clearer now.
It also occurs to me now I'm looking at the diff that although the IAC
output code is now better than it was, it probably still isn't pulling
its weight and might better be replaced by printf().
...but this patch has already gotten way out of hand!
|