aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2019-03-27Skip file contents in error case.Rob Landley
2019-03-27Silence another broken gcc "tar is never used uninitialized" warning.Rob Landley
2019-03-27Cleanup extract_to_disk(), enforce "file creation must be under cwd),Rob Landley
implement deferred utime updates (so directory timestamps correct).
2019-03-27Change fileunderdir() to return abspath to file.Rob Landley
2019-03-26Make touch use xparsedate() (result: -t and -d the same, autodetects format),Rob Landley
and fix tests to pass on host too.
2019-03-25Fix bc_vec_concatDaniel Rosenberg
BcVec contains the null at the end, so v->len is greater than strlen(v->v) by one.
2019-03-25Add rm -v.makepost@firemail.cc
Gentoo removes verbosely when building packages, for example vim-core: https://github.com/gentoo/gentoo/blob/665eaa8/app-editors/vim-core/vim-core-8.1.0648.ebuild#L120 Implement like toy cp, without prepending an escape sign to quotation marks in filenames. Document in a test this difference from coreutils but similarity to busybox. How do other implementations handle such escapes? If it matters, would you approach it with a loop and multiple prints or somehow else? Short help description follows 141a075, consistent with other commands.
2019-03-25find: fix inverted -exec exit statusVidar Holen
The return value of -exec was the command's exit code, which did not account for the fact that an exit code of zero means success, while in C, zero means failure. From POSIX: > the primary shall evaluate as true if the utility returns a zero > value as exit status This commit flips the return value, and adds two tests.
2019-03-24Factor out xparsedate() and xvali_date() into lib.Rob Landley
2019-03-24vi: Code style cleanupJarno Mäkipää
Variable initialization to start of blocks Space after if,for,while: if() -> if () Space after comma on function calls: write(fd,buf,count); -> write(fd, buf, count); Spaces surrounding variable initialization Pointer * binding to variable instead of type: int* i -> int *i Spaces surrounding compare operators No spaces surrounding arimetic operators Some aligntment whitespace fixes Still messy and needs more cleanup, but there is bigger issues to solve first.
2019-03-23vi: Removed C99/GNU99 style for loop initializersJarno Mäkipää
Removed for(int i = 0;....) style loop initializers to be consistant with project style. Removed few unused global variables Added 2 empty white space lines back to CONFIG comment section.
2019-03-23vi.c double_list based implementation.Jarno Mäkipää
Has beginnings of reading file, saving file, hjkl movement, insert, ex (only w, wq, q!), search with /, some other normal mode actions (dd, w, b, e), some utf8 support Everything is still very unfinished and partly behaves wrongly comparing to original vi. But simple tasks like modifying short config files should be possible. Some things like draw_page needs serious refactor since it now writes whole screen after every keypress. Didint bother to refactor yet if linked list needs to be replaced with something else...
2019-03-23login: clear environment when -p is absentWilliam Djupström
2019-03-22Silence stupid, pointless warnings.Rob Landley
Two "is never used uninitialized" and one "we don't trust you to get clearly documented operator precedence right". (The compiler may not "suggest". Every time I go "abc && def || exit 1" in the shell it means I know the operator precedence _and_ the short-circuit rules, which are the same as C here. This is a warning aimed at C++ developers, it should not be enabled for C.)
2019-03-22My todo entries were bothering people.Rob Landley
2019-03-22More tar cleanup, add --owner and --group, and start of new tests.Rob Landley
2019-03-20Next round of tar cleanup.Rob Landley
2019-03-18cmp/env/nice/nohup/sort: use TOYFLAG_ARGFAIL.Elliott Hughes
Also be a bit more consistent about `COMMAND [ARG...]` in usage text.
2019-03-18Document the -k2.3,4.5 syntax and make it behave closer to the other one.Rob Landley
2019-03-18diff: use TOYFLAG_ARGFAIL.Elliott Hughes
This one with a little cleanup of unnecessary duplication.
2019-03-17More tar cleanup.Rob Landley
2019-03-17More tar cleanup.Rob Landley
2019-03-16bc: fix an overflow bug in bc_num_ulong()Gavin Howard
2019-03-16Next round of tar cleanup.Rob Landley
2019-03-14grep: use TOYFLAG_ARGFAIL for grep too.Elliott Hughes
Also add a test, and add a test for timeout now it's been fixed.
2019-03-14load_policy: mention SELinux in the help.Elliott Hughes
2019-03-13timeout: remove bogus depends-on.Elliott Hughes
2019-03-13date: fix various time zone/daylight time issues.Elliott Hughes
Sunday's transition in the US broke a bunch of the tests. Worse, it broke some of the QA folks' scripts. Finally, the boil that is date's handling of time zones and daylight time has come to a head... This patch fixes the newly-failing tests *and* the other tests that were checked in failing to serve as TODOs. I've resolved the test TODOs about whether implied year/century in POSIX format should mean the current year or 1900 in favor of the current year. Both busybox and coreutils agree, and Rob fixed the code recently so toybox agrees too, but without fixing the tests. I've switched tests from Europe/London to Europe/Berlin to avoid disagreements between C libraries about whether to say "GMT" or "UTC" when daylight savings is not in force. The majority of this patch implements what I'd been unsuccessfully trying to explain on the list: that to correctly implement the distinct input and output time zones (as demonstrated in the three failing tests we've been carrying around for a while), we should switch to working with time_t internally rather than struct tm. I've also added the code to temporarily switch to the input time zone (and back again). All the tests now pass.
2019-03-13More tar cleanup.Rob Landley
2019-03-13Use defined constants for mkpathat.Hadrian Węgrzynowski
2019-03-11More tar cleanup.Rob Landley
2019-03-10Add TOYFLAG_ARGFAIL() to allow argument parsing failures to exit with value.Rob Landley
2019-03-10timeout: --foreground, --preserve-status, and --signal.Elliott Hughes
--signal is simply a synonym for the exiting -s. --foreground disables functionality we didn't yet have: putting the child into a new process group. I've added the functionality and the flag to disable it. --preserve-status also makes it clear that our exit statuses didn't match the coreutils version. In addition to callers that use --preserve-status to get away from this madness, I also have callers that check for specific exit values. This patch implements --preserve-status but also fixes all the other exit statuses. (The "125" exit value is broken for toybox in the same way that `toybox grep --whoops ; echo $?` is. To fix this, we'd need some way to signal that command-line parsing failures should exit with a different value than the usual 1 --- 2 for grep, 125 for timeout. I've done as much as grep manages, and left a TODO.) Also add timeout tests. I couldn't think of an easy test for --foreground, so I tested that manually with strace. Also add some newlines to the `toybox --help` output to make it easier to find the different sections, and expand the section on durations to call out that fractions are supported as a matter of policy. As long as timeout and sleep have text describing the duration syntax, make them the same. (Personally I'd remove both in favor of the `toybox --help` output, but as long as they're duplicated, keep them consistent.) Also remove the SLEEP_FLOAT variant --- xparsetime means that sleep no longer requires floating point to support sub-second resolution.
2019-03-10find: minor whitespace cleanup.Elliott Hughes
2019-03-10find: improve -context behavior on failure.Elliott Hughes
2019-03-10Make multiple sendfile variants, and teach xpopen_both() to use existingRob Landley
stdin/stdout filehandles.
2019-03-09find: add -context.Elliott Hughes
Tested manually on an Android device with: adb shell find /system -context u:object_r:wait_for_keymaster_exec:s0 adb shell find /system/bin -context '"*key*"' adb shell find /system/bin -context '"*tool*"'
2019-03-09file: add c-sky ELF machine.Elliott Hughes
It's in the Linux 5 kernel headers. If, like me, you'd never heard of it: https://www.phoronix.com/scan.php?page=news_item&px=C-SKY-Approved-Last-Arch
2019-03-09Half-finished su change checked in, sorry.Rob Landley
2019-03-07Add reset_env() and make su and login use it. Do long-delayed login cleanup.Rob Landley
2019-03-06More tar cleanup.Rob Landley
Dear gcc: if (i || node=blah) x = i ? blah : node; Don't complain "node may be used uninitialied", it can't be. That warning is a gcc bug. (I should add a node = node to the initialiation to shut up the warning, but gcc has failed to emit "may be used uninitialized" reliably for 15 years and it still does.)
2019-03-04More tar cleanup.Rob Landley
2019-03-04Don't print (null) in error messages.Rob Landley
2019-03-04Consistently use ARRAY_LEN.Elliott Hughes
2019-03-03Cleanup pass on tar.Rob Landley
2019-03-02Make top -H show TID instead of PID, not collate %CPU into parent threadRob Landley
(resulting in 400% CPU with 4 threads), and add a couple comments.
2019-03-02Promote devmem.Rob Landley
2019-03-02Improve help consistency.Elliott Hughes
More consistent tense, capitalization, and punctuation. A few commands were missing an introductory line, so I copied those from the first comment line.
2019-03-02Fix instances of "Usage:" rather than "usage:".Elliott Hughes
2019-03-02devmem: new command.Elliott Hughes
Intended to replace Android's toolbox `r`, but behaving more like a drop-in replacement for busybox's `devmem`.