aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2019-04-30echo: add -E.Elliott Hughes
POSIX finally gave us a way to use echo in a portable way despite differences of opinion about whether to default interpretation of escape sequences to on or off: -e enables and -E disables (as already implemented by busybox and coreutils). http://austingroupbugs.net/view.php?id=1222
2019-04-29Search name and first line with man -k regex.makepost
Exec -k value as regex on basename, and on the first content line outside a tag or on a referenced see-other, whichever appears earlier. Reuse zcat choice as a function when looping over files. Fix \-\- and glob.h include leftover. Handle man-pages example newlines. Clarify the todos, naming package and issue. Remaining items are more of a wishlist than a plan. Remove `<1>2` because it doesn't let `-k .` work, please look into that.
2019-04-26gzip: fix permissions perservation despite umask.Elliott Hughes
2019-04-26Add -M and switch test suite to use it (so test doesn't need to run as root).Rob Landley
2019-04-26Read .gz/.xz man pages and check sections in "man man" order.Rob Landley
2019-04-26gzip: fix regressions caused by 7964e1f78b58d9c365361cc36b0422d9d56cd204.Elliott Hughes
The permissions preservation test still fails for me, but that seems to be because my environment changed: it's failing because of my umask. I'll fix that in a separate patch, since it's unrelated.
2019-04-26more: better behavior with directories.Elliott Hughes
Also fix the non-tty output. Also tweak our output so the tests pass with TEST_HOST=1 too.
2019-04-26file: fix ELF note parsing.Elliott Hughes
Commit 9448c33944651c1644ffbd0f52cf9d43cae19599 broke ELF note parsing, because the bounds checking was off. Fix that but also generalize it so that we won't need note-specific bounds checking in future.
2019-04-22vi.c changes to vi cmd executionJarno Mäkipää
Reimplemented to command mode execution to follow vi cmd pattern. (REG)[COUNT0]{CMD}[COUNT1]<MOV>(SYM) Most of the moves can be executed intependently or before command, some require character after. (possibly with utf8) Some of the commands do not require move, such as D, J, dd, yy, x... There is also tons of special cases where move behaves differently depending on command. For example 1cw and 1ce appear to be the same but 1dw and 1de are not... Most of the operations still need reimplementing and lots of cleanup in order them to behave correctly refactored word move to work with utf-8
2019-04-22Ahem: _decompression_ is ready, compression isn't yet. Change defconfig y/n.Rob Landley
2019-04-21Promote gzip/zcat but keep gunzip default n until lib/deflate.c finished.Rob Landley
2019-04-21A little more cleanup on gzip.Rob Landley
2019-04-21Promote tar.Rob Landley
There's probably more to do, but it seems usable at this point.
2019-04-21Switch --to-command to use xsetenv() and fix a typo with -JRob Landley
2019-04-21man: WhitespaceRob Landley
2019-04-20Implement man.makepost@firemail.cc
To look up docs on my netbook and server. Practically deroff.1, with heuristic for where to put spaces and newlines. How would you simplify file resolution and bzcat? What have I got wrong when escaping slashes, because while \-\^\- is -- ok, \-\- becomes -\-, e.g. in git-pull.1?
2019-04-20Add xunsetenv() for the error checking.Rob Landley
2019-04-20New xsetenv() plumbing (repeatedly set same environment variables withoutRob Landley
leaking memory), and mod env command to test it.
2019-04-18Remove a line that's already in toys.h.Rob Landley
2019-04-18Add -J support for xzRob Landley
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.