aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2020-01-10sntp.c: fix 32-bit.Elliott Hughes
The epoch was being defined as UL, which is fine for LP64, but too small on LP32 for what we're trying to do. toys/net/sntp.c:60:32: warning: left shift count >= width of type return ((tv.tv_sec+SEVENTIES)<<32)+(((long long)tv.tv_nsec)<<32)/1000000000; ^~ (Android doesn't use this, I'm just fixing this too while I fix the LP64isms I introduced in readelf...)
2020-01-09readelf: RELR (both new and historical).Elliott Hughes
The "historical" variant is still the only one in use on Android right now. We still need to switch to the numbers we agreed on with the other System V ABI users. See https://groups.google.com/g/generic-abi/c/bX460iggiKg for the original discussion on RELR.
2020-01-09vi: fix warnings, improve status display.Elliott Hughes
mbtowc(0, 0, 4) is weird, and ignoring the result is weird. Avoid all this by just reusing the toybox lib utf8 functions. Also fix the row/column display on the status line to count from 1 and correctly distinguish bytes and characters in non-ASCII, and change the mode output to only explicitly say when we're in insert mode, in the same way that vim does. (Every time I saw the old blue-on-black text for COMMAND I thought toybox vi had crashed!)
2020-01-09ls.c: just use getxattr()/lgetxattr().Elliott Hughes
bionic works around the fact that you can't use an O_PATH fd with fgetxattr(2), but glibc doesn't. Fixes https://github.com/landley/toybox/issues/158.
2020-01-08Implement readelf(1).Elliott Hughes
Basic readelf(1) implementation, with output close enough to the binutils version to be usable with scripts that expect the binutils version. This started as an implementation of nm(1) until I realized that I almost always want readelf instead, and that you actually have to do much of the work needed for readelf just to implement nm. Arguably nm (being part of POSIX) belongs in toybox while readelf doesn't. An argument could also be made that neither really belongs in toybox, belonging in a separate set of development tools (such as binutils or the LLVM binutils). Doesn't support most of the architecture-specific stuff, most notably relocations, but is aware of things like ARM exidx sections and the common register state notes in core dumps for the "big four" architectures: arm, arm64, x86, and x86-64. Doesn't support symbol versions (but probably should). Doesn't support section groups or the -t "section details" (which is a long form of -S "section headers" that I've never seen used in practice and which isn't part of -a). Doesn't support dumping unwind info or the hash table bucket histograms. Reuses the table of ELF architectures from file(1). Not fuzzed, but successfully parses all the ELF files in my Ubuntu 18.04 system's lib directories. Attempts to exit with an error when presented with an invalid ELF file rather than struggle on as binutils seems to.
2020-01-08Remove lots of debugging dprintf()s.Rob Landley
2020-01-08Fix commaless brace discard.Rob Landley
2020-01-08Implement quote removal and fix unterminated bracket expansion.Rob Landley
2020-01-07Bracket support in progress. Mind the dprintf()s.Rob Landley
2020-01-06date.c: add a few more important specifiers to --help.Elliott Hughes
Odd (and un-toyboxy) that we advertise the locale-specific output formats but not the ISO ones :-)
2020-01-03Add local variables support.Rob Landley
2020-01-03Finish cd, make help -ahu unconditional, fix expand memory cleanup path,Rob Landley
set $HOME $PWD and $OLDPWD, fix prompt \w, shuffle some functions around to avoid prototypes, implement tilde expansion, add FORCE_COPY.
2020-01-03No, optflags gets cleared by toy_init(), use toys.rebound instead.Rob Landley
2020-01-03Add MAYFORK to "help", teach it to behave differently when called as aRob Landley
builtin, and add -u.
2020-01-01Use FLAG() macros.Rob Landley
2020-01-01Add MAYFORK to more pseudo-builtins.Rob Landley
This doesn't (yet) add shell builtin awareness to time, kill, or pwd, just lets them run in the shell process.
2020-01-01Factor out array_add(), replace argxtend().Rob Landley
2020-01-01If allocation update is done in blocks, initial allocation has to populateRob Landley
a full block.
2019-12-31toysh: start of <(echo hello) support.Rob Landley
2019-12-29Implement single command env assignments (abc=def command) and make debugRob Landley
output #definable.
2019-12-29Debug basic pipe support and I/O flush for builtins.Rob Landley
2019-12-28More sheer pedantry.Rob Landley
2019-12-28Rename get_chunk()/dump_chunk() to read_chunk()/write_chunk().Rob Landley
2019-12-28Cleanup, mostly whitespace.Rob Landley
2019-12-28Sheer pedantry.Rob Landley
2019-12-28Cleanup: use FLAG() macros and new argument variable names.Rob Landley
2019-12-28Next round of sh plumbing: more work on redirect and pipe, use CLOEXEC.Rob Landley
2019-12-28Change variable type to avoid typecast.Rob Landley
2019-12-28tar: fix memory write errorEmmanuel Nicolet
Clear the last byte of the allocated buffer.
2019-12-26Fix setsid with vfork, redo command line arguments.Rob Landley
Switch -t to -c (like man page says), add -w (wait) and -d (detach from tty)
2019-12-23Toysh passes two tests now! Woo! (Otherwise, does not remotely work right now.)Rob Landley
2019-12-22gzip: reject non-gzip files in zlib path.Elliott Hughes
It turns out that zlib defaults to just copying data verbatim if the input isn't in gzip format, rather than rejecting it. Explicitly add a check that zlib isn't doing that. (The toybox inflation path already errors out.) Also add the missing test.
2019-12-22Bugfix: tee with no arguments was writing to stdout twice.Rob Landley
Add basic smoketest while we're at it.
2019-12-21Add patch -F (fuzz factor)Rob Landley
2019-12-21Tighten up unquote_file()Rob Landley
2019-12-20patch: support [FILE [PATCH]] arguments.Elliott Hughes
POSIX only mentions -i/stdin, but GNU patch -- and Larry Wall's patch 1.3, found via https://en.wikipedia.org/wiki/Patch_(Unix) -- also support supplying the name of the file to patch and the name of the patch file as optional arguments. The AOSP build makes use of this syntax to patch snakeyaml to remove references to java.beans.* stuff.
2019-12-15Nothing in pending should default y.Rob Landley
2019-12-13fix loopback device mount failwayling
When we "losetup" success need mount loop device. Found this issue on AndroidQ
2019-12-12Next round of toysh work, with associated lib plumbing.Rob Landley
2019-12-06stat: fix filesystem type on macOS.Elliott Hughes
(Also show unknown values on Linux in hex rather than just "unknown".)
2019-12-04Fix getopt optstringE5ten
Move longopts after their corresponding shortopts instead of before
2019-11-24bc: fix a comparison bugGavin Howard
2019-11-23Fix iconv and tests on Mac.Elliott Hughes
The Mac iconv_open(3) doesn't follow Unicode TR#22 rules for charset alias matching that bionic and glibc do (and, strictly, POSIX doesn't say you have to even though it's obviously a good idea), so we have to say exactly "UTF-8" rather than "utf8". Additionally, the 2006-era bash 3.2 on current versions of macOS (because it was the last GPLv2 bash) seems to have bugs that cause it to mangle UTF-8 input, so we can't reliably echo a UTF-8 sequence into a file. Use \x in the tests to work around this.
2019-11-23du: use FLAG().Elliott Hughes
2019-11-22Add getopt(1).Elliott Hughes
Includes new tests.
2019-11-14xargs: distinguish the two "argument too long" error cases.Elliott Hughes
One is really "the command is too long for me to ever call it given other constraints", so leave "argument too long" for the case where it's actually an argument causing the issue.
2019-11-13Pedantic constant annotations to shut up older toolchains.Rob Landley
2019-11-12Don't rm prompt for nonexistent, just warn.Denys Nykula
2019-11-12Replace a test I took out last commit because it seemed impossible to trigger,Rob Landley
but the problem is some vertical sort arrangements are impossible, and that's what it was testing for. For example, showing 29 entries in 9 columns with horizontal sort requires 4 rows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 29 29 x x x x x x x But with vertical sort that would be: 1 5 9 13 17 21 25 29 x 2 6 10 14 18 22 26 x x 3 7 11 15 19 23 27 x x 4 8 12 16 20 24 28 x x It still doesn't fit in 3 rows (3x9=27) but with 4 rows the 7 leftover spaces eats a whole column, so you _can't_ have 9 columns with vertical sort.
2019-11-08ls cleanup: use FLAG() macros, simplify next_column(), fix off by one errorsRob Landley
in whitespace accounting, eliminate lastcol, same sort[next] in dt, don't count trailing whitespace on last entry in row.