aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2019-04-18Ignore --line-buffered argument for script compatibility (it's the default).Rob Landley
2019-04-16Add argument to xflush() so it can test for stdout err without flushing.Rob Landley
2019-04-12Make help text spacing consistent.Rob Landley
2019-04-05Restore symlink times and add --restrictRob Landley
2019-04-05Minor tweaks and fix a bug with "tar cvzf tar.tgz" autodetecting when specified.Rob Landley
2019-04-05tar: Fix -ORob Landley
2019-04-05tar cleanup: Hook up --exclude to filter plumbingRob Landley
2019-04-04Tweak stat.Rob Landley
next_printf() shouldn't return null unless it never found the start of an escape sequence (it'll return a pointer to the null at the end of the string otherwise), and the only time we point it at a % and it doesn't is when it's %%. So handle that before calling. (Also, a single trailing % prints in other implementations, and while I'm there update to use FLAG() macros, add a couple comments, and only xflush() once per pattern.)
2019-04-04stat: avoid null dereference.liwugang
When the specified format string has odd '%' in the end, the next_printf function will return null. Checking the result value before using it. Signed-off-by: liwugang <liwugang@xiaomi.com>
2019-04-03More tar tests, and fix tar to pass them.Rob Landley
2019-04-03VI rewrote char delete and hjkl movementsJarno Mäkipää
Reimplemented basic cursor movements and char delete. In order to work more correctly with utf-8 data. x,h,j,k,l seems to work now with test data such as tests/files/utf8/test2.txt hjkl now accept count parameter so 1000j will scroll file 1000 lines relative move to bottom word movements w,e,b... still need to be still reimplemented in order to step correctly on utf-8 data
2019-04-03Autodetect gzip and bz2 for both compression and decompression.Rob Landley
2019-04-02Yeah, ok, that one can get used uninitialized.Rob Landley
2019-04-02More tar cleanup, more tests.Rob Landley
2019-04-02More tar cleanup and tests.Rob Landley
2019-04-02Help text tweak.Rob Landley
2019-04-01Silence spurious gcc "lnk cannot be used uninitialized" warning.Rob Landley
2019-04-01More tar cleanup.Rob Landley
2019-03-31More tar cleanup, some tests.Rob Landley
2019-03-31More tar cleanup.Rob Landley
2019-03-29vi: bug fixesJarno Mäkipää
Style cleanups: Removing whitespaces at end of lines, hopefully reduces git am warnings Bug fixes: fix segfault if file did not exist, now creates one empty line fix insert mode text not showing on start of line fix append on empty line fix cursor move right on empty line
2019-03-28vi.c improved utf-8 supportJarno Mäkipää
Now calculates utf-8 rune width properly before trying to print on screen. works with test1.txt and test2.txt on tests/files/utf8 folder with 0x0300-0x036F combining chars Uses mbtowc and wcwidth to calculate width of rune. These both should be implemented on c runtime that conforms POSIX-1.2001. Different c runtimes might have different level of support to combining char ranges etc... I think there is no standard way to calculate utf-8 rune width without converting it first to widechar. And i think conversion to widechar just to calculate width is silly, since all write calls can be done with utf8 directly (on utf8 locales ofc), but in order to calculate them yourself without pointless conversion, one would need to write variable byte lookup array for binary searching weird ranges and make sure it works with big-endian systems too... By the way running ./watch ./cat tests/files/utf8/japan.txt does not print the text for some reason, but other test data does... I was checking how well original crunch_str works and noticed it. -Jarno
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.