Age | Commit message (Collapse) | Author |
|
|
|
Although we can get away with ignoring termcap/terminfo on the output
side by restricting ourselves to generally-supported escape sequences,
the input side is trickier because we need to support the sequences sent
by common terminals. Luckily, this isn't is as bad as it sounds because
only Home/End commonly differ. But it does mean we need a slightly
different implementation to deal with the many-to-one mapping.
Since we can't use TAGGED_ARRAY for this (without inflicting pain on all
the callers) I've also switched to OR-ing in the modifier keys, so we
have (say) KEY_UP|KEY_SHIFT rather than a separate KEY_SUP. This also
generalizes better should we ever need to support multiple modifiers at
once.
To reduce the number of #defines, I've also switched from KEY_F1,
KEY_F2, and so on to KEY_FN+1, KEY_FN+2, and so on. This isn't obviously
necessary, and easily undone if we'd rather have move #defines in return
for slightly more natural naming.
To enable all this, I've inverted scan_key and scan_key_getsize so that
scan_key_getsize is now the underlying function, and we don't waste all
the top bits encoding width and height between scan_key and
scan_key_getsize.
Tested by pressing Home and End in hexedit in all of the terminals
available to me.
|
|
|
|
and tweak a couple comments.
|
|
|
|
SELinux on Android is unhappy if you try to read "/":
avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:hal_dumpstate_impl:s0 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
That could happen via the open of ".." too, and potentially any other
directory might have similar restrictions, so move all of the open calls
to using O_PATH.
O_PATH seems more intention-revealing given what this function is doing anyway.
|
|
|
|
SELinux on Android is unhappy if you try to read "/":
avc: denied { read } for name="/" dev="dm-3" ino=2 scontext=u:r:hal_dumpstate_impl:s0 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
O_PATH seems more intention-revealing anyway.
|
|
and fix tests to pass on host too.
|
|
|
|
Now there's a second user... the libc function already null terminates
at len+1, and it doesn't malloc the full size if strlen() smaller so
the redundant termination stomped unallocated memory. Oops.
sort.c never noticed because it calculated length to truncate or copy
existing string, so never hit this.
|
|
|
|
|
|
|
|
|
|
stdin/stdout filehandles.
|
|
|
|
|
|
|
|
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.
|
|
always set SO_REUSEADDR (which won't reuse an active port but merely disables
the strange "but reply packets might come in after we close the socket"
hand-wringing timeout nobody's cared about in decades.)
|
|
|
|
|
|
it has clock_settime(), but not the libc adjtime() function...)
*shrug* Stub it out in portability.h.
|
|
|
|
Broke the bionic build:
external/toybox/toys/net/netcat.c:188:37: error: incompatible pointer types assigning to 'sigjmp_buf *' (aka 'long (*)[33]') from 'jmp_buf *' (aka 'long (*)[32]') [-Werror,-Wincompatible-pointer-types]
if (toys.optflags&FLAG_L) NOEXIT(child = XVFORK());
^~~~~~~~~~~~~~~~~~~~~~~~
external/toybox/lib/lib.h:375:19: note: expanded from macro 'NOEXIT'
#define NOEXIT(x) WOULD_EXIT(_noexit_res, x)
^~~~~~~~~~~~~~~~~~~~~~~~~~
external/toybox/lib/lib.h:367:16: note: expanded from macro 'WOULD_EXIT'
toys.rebound = &_noexit; \
^ ~~~~~~~~
1 error generated.
|
|
|
|
|
|
Used to construct SELinux policies in the AOSP build.
I left loopfiles_lines with its hard-coded '\n' because although cut(1)
also has a -z option, I can't find any case where it's used in any of
the codebases searchable by me. (And fmt(1), the other user, doesn't
even have the option.) YAGNI.
Bug: http://b/122744241
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This (eventually) lets "ps ax" and "ps -ax" behave differently.
|
|
|
|
|
|
Hopefully they'll fix this properly at some point, but until then...
|
|
|
|
I think this was the preferred option for this code that turns out
to be very different on Linux vs BSD. I don't yet have a BSD
implementation, and I'm not likely to have chance to work on one
in the near future, so this just #ifdefs it out for macOS right
now.
With this (and a suitably minimal .config), toybox builds for macOS
out of the box.
|
|
These were added in macOS 10.7 in 2011-07, so the seven year rule applies...
|
|
|
|
I've also flipped the `#if` because `#ifdef` feels more naturally readable
than #ifndef when there's also a `#else`.
(I've preserved the oddness of the clearenv declaration being here,
because there isn't currently a more suitable `#ifdef __APPLE__` to move
it too. Later...)
|
|
|
|
The only part of this I actually need for macOS is to remove __APPLE__
from the getdelim/getline workaround, but if we're following the usual
"seven year rule", glibc 2.10 is dead to us anyway, and we should just
remove all of this.
|
|
|