aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2021-07-04Teach tail -F to work on file that doesn't initially exist (neededRob Landley
new lib/ flag), allow -s to be fraction of a second, inline (anonymous) struct so globals.h isn't using an incomplete type, blank line in GLOBALS() between option args and other variables, collate tail_continue() to one function, add test.
2021-07-01tail: implement -F (and its companion -s).Elliott Hughes
(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.
2021-06-27Add support for -n in splitElla-0
2021-06-22Add support for -d $'\n' (cut by line!) and posix -nb (wraps to start of -c)Rob Landley
2021-06-22Denys Vlasenko pointed out that other implementations use "t" as "total",Rob Landley
and not many systems need to know "free terabytes".
2021-06-22Update usage: line to include remaining options.Rob Landley
2021-06-21Switch to FLAG() macros and forbid -f -F at the same time.Rob Landley
2021-06-17Avoid division by 0 error and mmap(0) failure for missing or zero length files.Rob Landley
2021-06-09md5sum.c: simplify the table setup slightly.Elliott Hughes
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.)
2021-06-09netstat.c: fix bounds checks.Elliott Hughes
2021-06-09dmesg.c: fix off-by-one.Elliott Hughes
2021-06-04modprobe: fix parsing of short lines.Elliott Hughes
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.
2021-06-04More sha*sum cleanup.Rob Landley
Make everything an OLDTOY of md5sum (combining help text), remove enum, combine unions, actually track 128 bit count for sha384/512.
2021-06-02Fix big endian in new sha2 commands.Rob Landley
2021-06-02Cleanup.Rob Landley
2021-06-02date: add -s.Elliott Hughes
Used by someone's script.
2021-06-01fix USE declarationsDan Brown
2021-06-01clean up unsuccessful attempt to calculate constantsDan Brown
2021-06-01attempt to calculate round constants instead of using lookup table; doesn't ↵Dan Brown
work for SHA-512's 64-bit values
2021-06-01first rough version of built-in hash sumsDan Brown
2021-06-01add entry points for sha224,256,384,512Dan Brown
2021-06-01add sha256sum command which runs built-in sha1sum routineDan Brown
2021-05-29toysh: wchar_t->unsigned and turn "not" into a flag.Rob Landley
2021-05-29Dear gcc: no, it really can't be used uninitalized.Rob Landley
2021-05-26Add find -quitRob Landley
2021-05-19readelf: fix 32-bit build on Android.Elliott Hughes
2021-05-19Commands in pending do not default y.Rob Landley
2021-05-16Add black and white mode (x to toggle)Rob Landley
2021-05-15Promote readelf to other.Rob Landley
2021-05-15Cleanup readelf.Rob Landley
2021-05-15modprobe: don't stop on empty lines.Elliott Hughes
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!)
2021-05-15Missed a couple in the wchar_t -> unsigned conversion.Rob Landley
2021-05-15Convert utf8towc from wchar_t to unsigned (to match wctoutf8).Rob Landley
The maximum unicode code point is 0x10ffff which is 21 bits.
2021-05-15Promote unicode (merge into ascii.c)Rob Landley
2021-05-15Style cleanup.Rob Landley
2021-05-15The (insane) unicode consortium arbitrarily limited the codepoint spaceRob Landley
(utf8 can go to 7 bytes but unicode can't) so only test unicode range.
2021-05-11Add $BASHPID to show current process in () and such. ($$ is top level shell)Rob Landley
2021-05-10Tighten up echo help text.Rob Landley
2021-05-06Fix nohang wait.Rob Landley
2021-05-02More job control plumbing.Rob Landley
2021-05-01telnet: just use dprintf() for IAC sequences.Elliott Hughes
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.
2021-04-30Make && and || work on function calls.Rob Landley
2021-04-28Toysh don't free function arguments before function returns.Rob Landley
2021-04-27Make toysh function return properly and run next statement.Rob Landley
2021-04-27Make toysh actually run a shell function.Rob Landley
2021-04-27More line buffering.Elliott Hughes
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.)
2021-04-27Don't send reverse DNS lookups out into the world for something that'sRob Landley
mostly only safe to use behind a firewall or through a VPN these days.
2021-04-26More toysh function work.Rob Landley
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.
2021-04-26Bugfix: sed s command couldn't skip initial match.Rob Landley
2021-04-25First pass at toysh function() definition plumbing.Rob Landley