aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2018-12-04Add FLAG(x) macro, expanding to (toys.optflags & FLAG_##x)Rob Landley
2018-12-04Clean up some --help formatting.Elliott Hughes
Be consistent about upper versus lower case. (Upper seems to have the majority, so I went with that, though I'm happy to provide the opposite patch as long as we're consistent!) Be consistent about using \t. (Though saving a few bytes seems like it might be better done in the code that generates help.h rather than directly in the source, since tabs make careful ASCII art layout hard enough that we regularly have things misaligned.) Remove trailing periods (most of which seem to have been added by me). Always use the US "human readable" rather than my British "human-readable", and be more consistent about declaring whether we're showing multiples of 1000 or 1024. Just say "verbose" rather than adding a useless "mode" or "output".
2018-12-04mktemp: more tests, more fixes.Elliott Hughes
I realized (after being questioned about my motivation) that I hadn't added a test for the -u behavior. Adding the missing test confirmed the usual "if there isn't a test, the code is broken", but now I think I actually understand how we're supposed to choose between DIR, $TMPDIR, and /tmp. I've added more tests to back this up, and rewritten the code one more time so that we pass all the tests.
2018-12-04Remove CFG_SORT_BIG, just always do that.Rob Landley
2018-12-03mktemp: fix warning with glibc 2.15.Elliott Hughes
Old versions of glibc had warn_unused_result on mktemp(3), despite it always returning its argument. Still, we can silence the warning and save a line, so...
2018-12-02Fresh implementation of test.c.Rob Landley
2018-11-30macOS: fix uname.Elliott Hughes
Don't hard-code Linux's buffer size.
2018-11-30Tweak comments.Rob Landley
2018-11-30macOS: move struct sysinfo out of GLOBALS.Elliott Hughes
Even if we don't build ps, we can't have a Linux-only struct in GLOBALS. The obvious alternative to this would be to have a fake struct sysinfo in lib/portability.h. Since having a real macOS replacement for sysinfo(2) seems unlikely at this point, I went this route instead.
2018-11-29Marius Adaskevicius pointed out mdev -s should follow symlinks.Rob Landley
2018-11-28mktemp: add -t and fix behavior.Elliott Hughes
The new tests pass on the host (coreutils 8.28) and with toybox after this patch is applied.
2018-11-28macOS: replace local strnstr with strcasestr.Elliott Hughes
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.
2018-11-28head: add --bytes synonym for -c.Elliott Hughes
Used by OTA package scripts in AOSP, and quite widely inside Google. I've also added --lines because it seems crazy to support one and not the other, and --lines is also widly used inside Google too.
2018-11-26file: small do_regular_file optimizationReverend Homer
There are a bunch of if (!memcmp(s+28,...)) lines, let's make them "else if"
2018-11-20Eduardas Meile asked umount to ignore -c due to broken init systems.Rob Landley
2018-11-19A few more GLOBALS() single character argument style conversions.Rob Landley
2018-11-19Eduardas Meile reported "The -Werror=format-security flag is applied byRob Landley
default in Yocto 2.6 Thud release" and identified several error_exit() and friends that should use the _raw versions.
2018-11-17Convert more GLOBALS argument vars to the new single letter code style.Rob Landley
2018-11-17hostname: add -s/-f and -d.Elliott Hughes
At least the AOSP build doesn't try to _set_ the hostname...
2018-11-17cmp: add --quiet and --silent synonyms for -s.Elliott Hughes
I actually only need --quiet to build AOSP, but it seems weird to add --quiet as a synonym for -s but _not_ add the more obviously related --silent.
2018-11-17dirname: support multiple arguments.Elliott Hughes
2018-11-17Volodymyr Medvid reported that install -d doesn't honor -o or -g.Rob Landley
2018-11-17Remove the "const" and "restrict" nonsense so it compiles without tainting lib.cRob Landley
2018-11-17Update bc for 1.1 releaseGavin Howard
2018-11-13Instead of #warning about the musl bug, work around it (wrap syscalls ourselves)Rob Landley
2018-11-13basename: -s SUFFIX.Elliott Hughes
AOSP doesn't need -a specifically, but since it's needed for -s we may as well accept it too.
2018-11-13touch: ignore -f like everyone else.Elliott Hughes
I assume it's actually meaningful on BSD/macOS and makes them behave like us, but I don't have access to a Mac to test that theory.
2018-11-13mkdir: accept both --parent and --parents as synonyms for -p.Elliott Hughes
Both occur in AOSP. (Until I looked, I had no idea there were _two_ long versions of -p...)
2018-11-02Convert more option vars to the new (single letter) coding style.Rob Landley
2018-11-02Trivial cleanup of uniq.c.Rob Landley
2018-10-30Promote watch to other.Rob Landley
2018-10-30Use % for -n and shut up gcc's broken "may be used uninitialized" warnings.Rob Landley
(Alas, llvm doesn't understand -Wno-maybe-uninitialized yet.)
2018-10-30getconf: add -a, fix the LFS_ output, and blame bionic rather than musl for ↵Elliott Hughes
UIO_MAXIOV/_SC_UIO_MAXIOV.
2018-10-27Zach Van Rijn asked for "find -empty".Rob Landley
2018-10-21Add % to lib/args.c (long time in milliseconds), add xmillitime(), redoRob Landley
xparsetime() not to need floating point, adjust callers.
2018-10-21Move start_redraw() to lib/ and have ps.c (top) use it.Rob Landley
2018-10-20Some more --help consistency.Elliott Hughes
From eyeballing the output of for i in `./toybox | tr " " "\n"` ; do ./toybox $i --help ; done | \ grep '^-' | grep -v "\t"
2018-10-10Rewrite of watch.Rob Landley
2018-10-07Fix getconf build for musl.Rob Landley
2018-10-07Fix build break on x32 target.Rob Landley
2018-10-06getconf: add missing names used by AOSP.Rob Landley
2018-10-06Say undefined for sysconf/pathconf -1, remove goto, help text tweak,Rob Landley
remove curly brackets around single line if().
2018-10-06date: fix some tests.Elliott Hughes
`errno` isn't meaningful here.
2018-10-05getconf: add pathconf(3) variables.Elliott Hughes
Also improve the -l output to include sections (because you need to know whether you're dealing with a pathconf variable to supply the required path).
2018-10-05getconf: fix glibc NPROCESSORS_ONLN.Elliott Hughes
glibc doesn't have _XOPEN_UUCP (though bionic does), which meant that the generated array of values was out of sync with the hand-written array of names. This patch removes that by using a unified array and the preprocessor. A side benefit of this for me is that it makes toybox easier to integrate in the AOSP build system (the less shell script magic, the better).
2018-10-04Make it possible to build the AOSP .config against glibc.Elliott Hughes
It's possible that we should just pull setprop back out of toybox to live with getprop in system/core/, but this lets us build the same toybox configuration for device and host in AOSP. (Longer term we'd like to use host bionic, but if we enable this we can start experimenting on the tobyox side before the bionic side is finished.)
2018-10-04blockdev: BLKRAGET returns 512-byte sectors.Elliott Hughes
Bug: https://github.com/landley/toybox/issues/104
2018-09-29Command not in pending or example should probably default y.Rob Landley
2018-09-26Don't claim to have i2cget non-byte mode support yet.Rob Landley
2018-09-21Promote i2ctools.Rob Landley
(Fixed one declaration not at start of a block.)