aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
AgeCommit message (Collapse)Author
2018-12-11Implement --preserve default = mot behavior (fixes segfault when no argument).Rob Landley
2018-12-09Support embedded NUL bytes in grep output, and free memory leaked per-file.Rob Landley
2018-12-09More grep.tests: make exit code 2 happen when it should.Rob Landley
2018-12-09Fix first grep.test failure (-B + -b not producing middle field).Rob Landley
When necessary, realloc() the line to add 4 aligned bytes of storage at the end, stick the unsigned offset in there, and then fish it back out for display (and add 1 because offset is 0 based and display is 1 based).
2018-12-08Rikk on github asked for the examples back.Rob Landley
2018-12-07macOS: fix getconf(1) build.Elliott Hughes
Several parameters common on Linux are missing on macOS.
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-04Remove CFG_SORT_BIG, just always do that.Rob Landley
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-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-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-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-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-07Fix getconf build for musl.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-09-16file: remove %s with no corresponding argument.Rob Landley
I've had added the argument, but I don't know what it wants? Ubuntu's file calls a bmp file "data".
2018-09-15Add .bmp supoprt to file(1).Elliott Hughes
2018-09-15Add .wav support to file(1).Elliott Hughes
2018-08-31Convert option style.Rob Landley
2018-08-26Add binary file detection to grep.Rob Landley
2018-08-26Convert more commands to the new option/GLOBALS code style.Rob Landley
2018-08-26Remove ls sub-option: always support --color.Rob Landley
(Well, when you say --color or "alias ls='ls --color=auto'" in your shell.)
2018-08-25Convert more argument variables in GLOBALS() to new style.Rob Landley
2018-08-25Coding style change: 1) Use argument letter for variable names filled out byRob Landley
that argument (so "t:" fills out TT.t), 2) go ahead and collate arguments of same type on same line. (Order's guaranteed by C99 either way.)
2018-08-19Comment tweak.Rob Landley
2018-08-17Make microcom use set_terminal() and move speed setting into set_terminal().Rob Landley
2018-08-04wc: fix the column width heuristics even further.Elliott Hughes
This was found by https://kernel.googlesource.com/pub/scm/linux/kernel/git/shuah/linux-kselftest/+/master/tools/testing/selftests/splice/default_file_splice_read.sh which broke after the recent change. Plus this actually fixes another of our existing test failures on the host. I'm assuming we don't want to try the "exact fit" heuristics until we have a concrete need for them. (I haven't fully understood the circumstances under which they're used, though the two remaining host test failures appear to be because of them.) Bug: http://b/111891791 Test: ran tests
2018-08-04file: slightly improve .class, add .dex.Elliott Hughes
2018-07-28Check for integer overflow in pathologically broken elf files by moving theRob Landley
sh_size>file length test inside the loop and changing the vars to unsigned.
2018-07-18ps.c cleanups after help text reshuffle.Rob Landley