aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
AgeCommit message (Collapse)Author
2019-02-13top: hide the cursor in interactive mode.Elliott Hughes
Matches traditional top.
2019-02-13find: fix -path/-ipath and add -wholename/-iwholename synonyms.Elliott Hughes
Plus new tests.
2019-02-13sed: fix endless loop in "b loop" test.Elliott Hughes
Very few places actually check for errors from emit, and I actually see the same endless loop from "sed (GNU sed) 4.4" on current Debian, so I'm not sure this isn't Broken As Designed, but an endless loop spewing "short write" (or saying nothing, in the case of GNU sed) really doesn't feel like useful behavior in face of EPIPE, which really isn't going to fix itself. Certainly not being able to run the sed tests to completion is pretty annoying --- which is why, unless we remove this test as invalid, we should probably also add a SKIP_HOST=1 to the "b loop" test. Note that even with this fix you'll see the error twice: sed: short write: Broken pipe sed: short write: Broken pipe Once from the first = command to fail, and then another from the !FLAG(n) flush of the pattern space.
2019-02-12sed: fix substitution of empty capturing groups.Elliott Hughes
The test for \N where N was larger than the number of capturing groups in the regular expression was incorrect, and firing for cases such as matching __(ARM_)?NR_([a-z]*) against __NR_read, where the first group is empty (because it failed to match) but the second group did match "read". Use regex_t's re_nsub for the error check, and treat rm_so == -1 as a signal to just copy nothing into the result. (Found trying to build minijail in AOSP.)
2019-02-11date: some fixes.Elliott Hughes
Add support for more input formats, primarily the ISO formats used by the AOSP build. I've improved/added to the tests a bit to cover these changes, and to explain the reasons for the various remaining test failures (none of which are regressions caused by this patch).
2019-02-07ps, top: fix VIRT and SHR fields.Elliott Hughes
2019-02-04sort -o: fix behavior when output file is one of the input files.Elliott Hughes
Bug: http://b/123902291
2019-02-04who: make the output more like coreutils who.Elliott Hughes
Also add a TODO for the (undocumented, half-finished) -a option.
2019-01-31Sed assumed FLAG(r) was 1 but didn't document it above the NEWTOY line. (oops)Rob Landley
2019-01-25OpenEmbedded needs commands installed in specific places.Rob Landley
2019-01-24grep: "tried" should track arguments (not files) that existed, move -o "" testRob Landley
into display function, use unsigned length so output lines can be up to 4g each.
2019-01-22Whitespace: remove tabs from indentation.Elliott Hughes
I accidentally added a tab in xargs.c, so as penance I'll clean up all the tabs.
2019-01-21Add more comments to ps.c and replace hardcoded value with a macro.Rob Landley
If table grows >64 entries XX needs to change, but it can't be 128 yet because the slot value is a signed char. Currently 59 entries in table...
2019-01-18xargs: make --help match reality.Elliott Hughes
Implement -p, -t, and -r. Add some missing tests. Move -L and -x back to TODO since they're not implemented and I haven't yet even understood what they're supposed to do.
2019-01-14Minor cleanups to patch. (Mostly whitespace and brackets.)Rob Landley
2019-01-13Better support patching files with tabs in the name.Rob Landley
Patch dates are optional these days, and I should properly work back from the end and only peel off properly formatted tab+date, but "tab followed by digit" is probably good enough and nobody's ever complained about just tab. And we still don't support patching filenames with newlines in them...)
2019-01-12Fix cp permissions when copying symlink contents, and add test.Rob Landley
2019-01-12sed: add -z.Elliott Hughes
Used to construct SELinux policies in the AOSP build. I left loopfiles_lines with its hard-coded '\n' because although cut(1) also has a -z option, I can't find any case where it's used in any of the codebases searchable by me. (And fmt(1), the other user, doesn't even have the option.) YAGNI. Bug: http://b/122744241
2019-01-12patch: add -s to the synopsis line and fix typos.Elliott Hughes
2019-01-11Fix b ending with }Rob Landley
For a definition of "fix" that's even _more_ of a deviation from posix, but matches what debian does...
2019-01-11patch: add -s/--quiet.Elliott Hughes
Used by AOSP build. Also switch to new FLAG macro. Bug: http://b/122739027
2019-01-08ls: Fix -t to also sort by st_mtim.tv_nsec.Peter Collingbourne
2019-01-08file: add riscv ELF machine.Elliott Hughes
It's in the Linux 4.20 kernel headers.
2018-12-29Use FLAG() macros in ps.Rob Landley
2018-12-23Add grep --colorRob Landley
2018-12-19First stab at sort -VRob Landley
2018-12-19Fix sort -x attached to a key.Rob Landley
2018-12-17Use FLAG() macros in grep.Rob Landley
2018-12-17A couple more grep tests, and slightly use dlist_terminate() for the loops.Rob Landley
2018-12-17Fix remaining grep_tests.Rob Landley
Handling -e by gluing together multiple regexes with | wasn't portable, break down and do a linked list with for loops.
2018-12-15Add sed -iEXT to keep backup files.Rob Landley
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