aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2020-01-30Move TOYBOX_VERSION fallback definition to toys.h.Rob Landley
(A git build takes it from "git describe".)
2020-01-30Couple more tests and sh comment changes. (Mostly todo list tracking.)Rob Landley
2020-01-29Quick and dirty "echo $ABC" support, done totally the wrong way, but itRob Landley
makes those two remaining tests pass.
2020-01-28David Legault complained that dir/.* tells rm to delete dir/.. and we'd do it.Rob Landley
2020-01-26Add mayfork to printfRob Landley
2020-01-26Implement nommu subshell plumbing, <(command), and fix 2>&1Rob Landley
2020-01-25vi: Add testsJarno Mäkipää
Test file integrity after load, move, delete and save+exit. Drawing of buffer is not tested yet. Added -s script option, accept file that is run as startup script of commands. File is parsed byte at time and handled as you had typed it. If EOF has been reached without editor close command, editing is continued normally using keyboard. This functionality is in vim and neovim, but not in POSIX vi standard. nvi (vi used in some macs) has -s with different meaning... Some simple tests added, dw last line test fails, so test is disabled.
2020-01-24cp/mv: add -T.Elliott Hughes
The kernel script scripts/kconfig/merge_config.sh uses cp -T. (Also sort the options into alphabetical order while adding -T, so that eyeball binary search actually works when trying to find an option! Oddly, they all show in reverse order because there's a bug in the help text generator, but that's a problem for another day...)
2020-01-22lsattr/chattr: -p support.Elliott Hughes
Add support for setting projid in chattr, and dumping it in lsattr. Also fix the lsattr output formatting, and undo my well-intentioned sorting of the flags because that broke the ordering in the lsattr terse output.
2020-01-20lsattr/chattr: add missing flags.Elliott Hughes
Also update help to include flags that were already added. Remove useless duplicative comments. Swich to FLAG macros.
2020-01-20cal: highlight current day.Elliott Hughes
This isn't in POSIX, but Debian and macOS' cal(1)s both do this, and it's annoying to have to run date(1) separately.
2020-01-15vi: fixes and small cleanupJarno Mäkipää
fix: first line delete fix: delete with e move fix: statusline 1 row lower, remove eol cleanup: use dlist_pop on delete cleanup: move globals into GLOBALS
2020-01-14vi: don't exit on ^C or ^D.Elliott Hughes
^D is the opposite of ^U in vi (the ^D/^U pair is the half-screen version of ^F/^B). ^C is unbound in vi. It's pretty surprising for these to cause toybox vi to exit, and it's annoying as long as toybox vi unconditionally exits rather than checks whether there are unsaved modifications! (I'm tempted to implement ^D/^U and ^F/^B, but I don't want to make Jarno's rebase of his in-progress changes any harder.)
2020-01-11Fix a duplicate free() and a variable stomp, set s=s to fix "can never beRob Landley
used uninitalized" warning, move flow control character detection to the right place, change scratch zeroing to the same way main() does it.
2020-01-11sh.c: fix memory corruption due to uninitialized sh_function in sh_runRich Felker
2020-01-11find.c: don't assume time_t is the same as longRich Felker
This is false on ILP32 targets with 64-bit time_t.
2020-01-10setsid: document -w.Elliott Hughes
-w was added recently. The change in behavior so we now always fork means that it's needed in more cases too: other implementations of setsid(1) only fork if getpgrp() != getpid(). This broke a script, which is what made me notice the missing help. This seems to have been an accidental change, and is contrary to what the util-linux setsid(1) man page says: "The command calls fork(2) if already a process group leader. Otherwise, it executes a program in the current process", but whether we change our behavior or not, we should document the new option.
2020-01-10readelf.c: fix 32-bit.Elliott Hughes
All of this was fine on LP64 where `long` and `long long` are the same length, but breaks the LP32 build with -Wformat.
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.