Age | Commit message (Collapse) | Author |
|
|
|
leaking memory), and mod env command to test it.
|
|
|
|
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 fix tests to pass on host too.
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
bionic, glibc, macOS, and musl all have strcasestr
(see http://man7.org/linux/man-pages/man3/strstr.3.html).
macOS (via BSD) has a strnstr that does what strnstr sounds like it
should do by analogy with strnlen and strncpy.
So we at least need to rename strnstr, but it probably makes more sense
just to switch to strcasestr instead.
|
|
The macOS libc headers use `__attribute__((noreturn))` rather than
`__attribute__((__noreturn__))`, so toybox's `noreturn` macro trips them
up. Since we already have a variety of uses of `__attribute__` that
aren't guarded in this way, let's do the same here.
|
|
xparsetime() not to need floating point, adjust callers.
|
|
|
|
xsignal() wraps sigaction() giving control of SA_RESTART behavior and such.
|
|
|
|
|
|
(My apologies for mixing these two unrelated changes up.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Requires echo 0 $((1<<30)) > /proc/sys/net/ipv4/ping_group_range (as root)
|
|
|
|
|
|
of utf8 support (not finished yet)...
Adds new loopfiles_lines() wrapper to lib.c that calls do_lines from loopfiles.
|
|
This avoids "xargs: exec echo: Argument list too long" errors in practice.
find(1) needs to be fixed too, but that's a bit more complicated and a working
xargs provides a workaround.
Bug: http://b/65818597
Test: find /proc | strace -f -e execve ./toybox xargs echo > /dev/null
|
|
|
|
scripts/*.c builds against lib.c but not linestack.c.
|
|
or care about locale.
|
|
|
|
Everyone forgets that mmap returns MAP_FAILED rather than NULL on failure.
Every use of mmap in toybox was either doing the wrong check, or no check
at all (including the two I personally added).
|
|
|
|
|
|
|
|
an array index, which doesn't work as a local variable name. So rename it.
|
|
__attribute__((returns_twice)) instead of noinline.
Yes LLVM supports it: https://llvm.org/bugs/show_bug.cgi?id=6287
|
|
make xsocket()'s returned fd CLOEXEC.
|