aboutsummaryrefslogtreecommitdiff
path: root/main.c
AgeCommit message (Collapse)Author
2021-06-18Second attempt at making --help work with alias ls="ls --color"Rob Landley
2021-06-10Revert the --help change, it breaks stuff like "echo -- --help".Rob Landley
2021-06-09Ryan Prichard pointed out --help and --version can't be first in aliases.Rob Landley
2021-04-27Use cheaper test that works with "toybox" name as a prefix.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-02-07Add lots of "static" annotations, make a couple things use FLAG() macros, etc.Rob Landley
2021-01-06main.c: construct a combination locale to add UTF-8.Elliott Hughes
We need <xlocale.h> for newlocale(3) on macOS, despite it being in POSIX 2008's <locale.h>. musl apparently doesn't have <xlocale.h>, so that's another trick to teach to portability.h...
2020-12-14main.c: fix UTF-8 on macOS.Elliott Hughes
Unfortunately neither "C.UTF-8" nor "UTF-8" works on *both* OSes...
2020-12-11Sigh, remove debug code checked in by mistake.Rob Landley
2020-12-11The "fall back to C.UTF-8" check was backwards, and make TOYFLAG_LINEBUFRob Landley
configurable.
2020-12-06Remove CONFIG_TOYBOX_I18N and just always support utf8.Rob Landley
2020-10-28Tweak help text again.Rob Landley
2020-08-13toybox: fit list of commands in terminal width.Elliott Hughes
This can still be pretty ragged because it just leaves space for the longest name at the end of each line rather than measuring the name that actually comes next, but at least with this change we never over-run. I noticed this because ConnectBot on my current device gives me a 60-column terminal. busybox seems to do this, though it seems to actually measure, judging by how close it gets to the margin. That doesn't seem worth the effort though?
2020-08-07People have been having trouble finding the toybox web page (despite beingRob Landley
the first google hit for "android toybox"), and want toybox --help to mention it. I was referred to https://github.com/landley/toybox/issues/50 So add a URL to toybox --help. While I was there, make unrecognized commands (like toybox -?) suggest "toybox --help", move the install instructions to the FAQ page (with a second link from toybox --help), and generally tighten up the help text. Also, "toybox -*" is no longer a synonym for --long. Oh, and I fixed some build dependencies when Config.in changes.
2020-06-08xexec() shouldn't call a builtin when it's given a path to a command, butRob Landley
adding symlink indirection support put the basename() in the wrong place.
2020-04-07Don't let NOFORK arguments run through the multiplexer.Rob Landley
2020-03-11Redo NOFORK plumbing so commands like eval/unset can access/edit shell state.Rob Landley
2020-02-06Don't recurse into multiplexer more than once.Rob Landley
Fixes make sh && ./sh -c 'toybox ls'
2020-02-05Fiddle with main() comments.Rob Landley
2020-01-30Move TOYBOX_VERSION fallback definition to toys.h.Rob Landley
(A git build takes it from "git describe".)
2020-01-03Add MAYFORK to "help", teach it to behave differently when called as aRob Landley
builtin, and add -u.
2019-12-22Streamline init for NOFORK (fewer unnecessary syscalls for shell builtins).Rob Landley
2019-12-06main.c: fall back to user's locale.Elliott Hughes
We still prefer C.UTF-8 for predictability, but macOS doesn't have that.
2019-10-18Release 0.8.20.8.2Rob Landley
2019-10-15Off by one error when you try to run a command through two symlinks.Rob Landley
2019-08-23Trivial style fixes while I was looking at main anyway.Rob Landley
2019-08-23Fix "ln -s toybox potato; ./potato" unknown command problem.Rob Landley
(Commit 7771e94e2a08 broke it.)
2019-05-29Release 0.8.1.0.8.1Rob Landley
2019-04-16Call setlinebuf(stdout) from singleinit, so automatic flush each \n of output.Rob Landley
Commands that want something different can override this, but it seems like a fairly minor optimization and write(1) exists if we want to micromanage...
2019-02-08Sigh. Update release version for non-git source builds.Rob Landley
2018-10-31Update version to 0.7.8.0.7.8Rob Landley
2018-09-21Stack can grow in either direction, so needs signed subtraction and abs().Rob Landley
Both positive and both negative should work, even crossing midpoint (which should never happen on linux) works in two's complement.
2018-09-16It should never matter on Linux (where the top half of virtual address spaceRob Landley
is reserved for the kernel), but technically a pointer is unsigned long.
2018-07-02Dereference one layer of symlink in multiplexer on lookup failure, so you canRob Landley
"ln -s gsed sed" or similar if you need to use nonstandard names for things.
2018-06-23News and version update for 0.7.7 release.0.7.7Rob Landley
2018-02-24Update version string to 0.7.6.0.7.6Rob Landley
2017-10-21Use setlocale(LC_CTYPE, "C.UTF-8") for more targeted locale enable:Rob Landley
(only enable character parsing, force utf8, "C" semantics otherwise.)
2017-10-19Elliott wants to add TOYBOX_VENDOR.Rob Landley
2017-06-19Past time for 0.7.4.0.7.4Rob Landley
2017-05-23fixup code styleJoyounger
Signed-off-by: Joyounger <aquanox@163.com>
2017-02-21It's past time for 0.7.3.0.7.3Rob Landley
2017-02-17Fix the comment about the Android SIGPIPE behavior.Elliott Hughes
2017-02-10Add back bionic SIGPIPE handler workaround accidentally removed in 3b51a07e478dRob Landley
2016-10-20Announce 0.7.2.0.7.2Rob Landley
2016-10-17The recent --help infrastructure fiddling made "toybox --help unknown" segfaultRob Landley
because lookup failure left this->which NULL and error_exit() dereferenced it. (Oops.)
2016-10-01Move --version handling next to --help handling, so it applies to all commands.Rob Landley
Say "toybox" before version string. Tweak sed to preserve lie-to-autoconf.
2016-08-13Add TOYFLAG_NOHELP to disable --help processing for individual commands,Rob Landley
apply it to "true" and "false".
2016-06-30Fix option parsing infrastructure bug.Rob Landley
In main.c: used adjusted string with placeholers for removed options (so flag values don't move based on config, allowing FORCE_FLAGS to work). In scripts/mkflags.c: test was wrong, a bare longopt never matches a single letter command, but it was treated as always matching when comparing allyesconfig vs current config to determine which options were disabled, so there was a corner case that got the flag values wrong.
2016-06-05Fix TOYBOX_VERSIONPaul Barker
The latest tagged version is 0.7.1.
2016-05-10Use CFG_TOYBOX_NORECURSE to avoidRob Landley
<strike>all that tedious mucking about with hyperspace</strike> stack measuring in ways that confuse security stuff.