aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2016-05-05Fix static linkage of toybox binary.Alistair Strachan
If toybox was compiled statically e.g. for use in a recovery ramdisk, it would not build after b66a29a. This is because libselinux already exports a selinux_log_callback() function which getprop.c is trying to override. This change simply makes the second symbol static, since it is only used in a function table so we do not actually need to export it from toybox. Change-Id: I603258877ae2286660df35738bbf4f4285df5b54 Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
2016-05-05Add top -H.Elliott Hughes
Also enable the same behavior we have with ps, where adding a thread-related field implies that you're interested in threads. Also clean up the help text slightly --- we're still not including the TOP_COMMON help, but at least when we do, we'll have each option covered with no duplicates.
2016-05-05"top -b -n1" should end with a newline.Elliott Hughes
The use of TT.time to determine whether to use \r or \n is a little odd, but let's stick with that for now. Correct the spelling of millitime and add a test.
2016-05-04Elliott says -T should fetch threads even when not displaying thread fields.Rob Landley
2016-05-04Simplify ps android scheduling policy fetch slightly.Rob Landley
2016-05-04Hostname cleanup, as described on the list.Rob Landley
2016-05-03Add -b and -F arguments to hostnamePaul Barker
These arguments are required to correctly set the hostname at boot time. They are used by the '/etc/init.d/hostname.sh' init script in an OpenEmbedded system.
2016-04-30Add a ps "PCY" field for Android scheduling policy.Elliott Hughes
2016-04-29First guess at showing thread names properly.Rob Landley
2016-04-29Show "-" rather 0 if we don't know whether a process is 32- or 64-bit.Elliott Hughes
2016-04-29Fix ps -O help output alignment.Elliott Hughes
2016-04-25ps thread supportand 32/64 bit detection.Rob Landley
Add ps -o BIT,TID,TCNT, and make -T display "PID,TID" for default output types (adding TCNT to -f)
2016-04-25Fix find bug reported by Tom Marshall, add test for it, and while we're at itRob Landley
fix two tests looking for a too-specific error message (so TEST_HOST failed).
2016-04-23Fix more to not append an extra newline.Elliott Hughes
More's sigatexit handler needs to distinguish between normal exit and exit due to receipt of a signal. Change tty_sigreset to look at the signal number too, so that pressing 'q' to exit top doesn't cause its exit status to be 128.
2016-04-23Fix more to a non-tty.Elliott Hughes
And add a test.
2016-04-23Fiz bzcat segfault reported by John Regehr (bad crc didn't set error message).Rob Landley
2016-04-21Have dirtree_recurse() take the new dirfd as an argument.Rob Landley
2016-04-21Fix touch -t seconds parsingDavis Mosenkovs
2016-04-17Dust off toysh, remove ancient config debris, add start of prompt logic.Rob Landley
2016-04-16Fix tail -NUM again.Elliott Hughes
This time with a test.
2016-04-16Fix "ssh top".Elliott Hughes
The ps.c change allows us to start. The interestingtimes.c change allows us to clean up properly afterwards if you ^C out (which you usually do). Tested with both ssh and "adb shell" (the latter being where I noticed the problem).
2016-04-16Fix top -b.Elliott Hughes
Batch mode should never output terminal escape sequences, should ignore the keyboard, and should include a gap between datasets.
2016-04-16Rename gratuitous references to Roger Zelazny's amber series, add comments.Rob Landley
2016-04-14Fix a buffer overflow in diff -r.Andy Chu
We were doing two 32-byte memset()s instead of two 16-byte memset()s. 'dir' referred to the instance (array of 2) and not the struct type. Add some test coverage for diff, including a case that hit this bug. The bug was found by running cp.test under AddressSanitizer, since it happens to use diff.
2016-04-14Andy Chu pointed out an out of bounds access for zero length lines.Rob Landley
While we're at it, use unsigned for the line length.
2016-04-11sed -f - should read from stdin.Rob Landley
2016-04-08Redefining basename_r to mean something random seems popular (bionic and freebsdRob Landley
both did it) so use getbasename instead.
2016-03-30Whitespace and comment.Rob Landley
2016-03-30Implement mv -n / cp -n (no clobber).Andy Chu
This fixes a failing test case in mv.test. Test changes: - Add coverage for -i (interactive). - Better descriptions, better formatting, and removed some redundant cases.
2016-03-25basename: fix segfault on null input; add testsSamuel Holland
When passed an empty string, glibc's basename() returns a pointer to the string "." in read-only memory. If an empty suffix is given, it fits the condition of being shorter than the path, so we try to overwrite the null byte and crash. Fix this by just ignoring empty suffixes; they don't do anything anyway.
2016-03-25Add od -w.Elliott Hughes
I'm not an od user myself, but I copy & pasted an 'od' invocation from a bug and it didn't work. Which was embarrassing because I'd just claimed that the od user didn't need to run od on their desktop (as they had done) and could have run it on the device instead...
2016-03-24Debian bug 635570 did something horribly nonstandard (depending on a sideRob Landley
effect of "sed -e 'a\'" with no trailing line). But there's an actual user, and it's not hard to implement, and it's not hard to implement, and there isn't an obvious _other_ way to do it, so add the behavior and a test for it. Fix some bad/missing comments while I was there, and add a couple TODOs.
2016-03-23Minor blkid cleanup. (There was a while(ptr[-1]==' ') ptr--; that could fallRob Landley
off the start of the string. I pulled on the thread...)
2016-03-22blkid: Handle short/empty vfat labels; update testsSamuel Holland
vfat labels have a fixed space allocated for them. In the case of a shorter label, the remaining bytes are padded with spaces. A vfat filesystem with no label (i.e. that will show up in Windows as "Local Disk (X:)" or "Removable Disk (X:)") is stored as "NO NAME ". Both of these changes match behavior from util-linux.
2016-03-20Posix requires "" to be false, and 00 should be false, and -0 should be false.Rob Landley
Fix memory leaks in regex. Simplify regex check (if we matched, subexpression had to match). Don't exit() from a command, set exitval and return.
2016-03-19Make lsof 10x faster by caching /proc/net socket info.Elliott Hughes
I deliberately didn't do this first time round because for me our lsof is already 10x faster than traditional lsof, and caching means we potentially give less information about a socket that's created while we're running. It turns out that traditional lsof caches anyway, so I guess nobody cares. This also fixes a mistake where lsof used CFG_FREE instead of CFG_TOYBOX_FREE.
2016-03-18Fix last commit (had newline before first ==> name <==) and add -f tests.Rob Landley
2016-03-18Fix "tail -f single_file".Josh Gao
TT.file_no was being incorrectly calculated as 0 when tail -f was passed a single argument.
2016-03-17expr cleanup: simplify get_str() and free returned allocations.Rob Landley
2016-03-16expr cleanup: traverse optargs with tok instead of incrementing optargs andRob Landley
copying itinto a second variable. Also add error message for empty ( )
2016-03-16Move whitespace and curly brackets around, move reference URLs to top of file,Rob Landley
eliminate syntax_error() function (just call error_exit() directly), eliminate advance() wrapper, pipe expected error messages in test to /dev/null
2016-03-16Fix type coercion bugs in expr.Andy Chu
All tests pass now; this fixes the 2 remaining failures, including a segfault. The structure of the code has changed a lot -- instead of having a tiny function per operator, we have eval_op() which does common type coercion and then evaluates the operator. I tried writing it a couple different ways, and this was the cleanest. The OPS table now contains the operator string, precedence level, signature for type coercion, and operator ID.
2016-03-16Fix the operator precedence in expr.Andy Chu
expr now uses the precedence table specified by POSIX, implemented using the "precedence climbing" algorithm. See the references at the top of eval_expr(). This fixes 3 of 4 failing tests. I also added more tests for correct behavior and for syntax errors. This includes a new test exposing a segfault, related to type coercion.
2016-03-15Add base64.test, and Izabera pointed out that -w0 should disable wrapping.Rob Landley
2016-03-15Add ls -b and make ls -q work with utf8.Rob Landley
2016-03-13factor: use long long math (64 bit on 32 bit platforms) and handle negativeRob Landley
numbers even though we use unsigned math now.
2016-03-12Update scripts/single.sh and cp.c so "make mv" isn't actually building cp.Rob Landley
2016-03-12The xattr functions were added during the 2.5 kernel, lsm.h can #include theRob Landley
header unconditionally. (This fixes the warning when CP_PRESERVE disabled.)
2016-03-10Fix segfault in sed -e 'c\'.Andy Chu
Found by afl-fuzz.
2016-03-08Add depends on TOYBOX_FORK for various commands that need nommu conversion.Rob Landley
(This should fix allyesconfig.)