aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2017-12-29Cleanup iconv.Rob Landley
Implement -c, fix endless loop when illegal char happens with !outleft (don't need to check errno, just in == toybuf), refill buffer each time (less efficient handling of illegal chars but never have to worry about how long constitutes a valid sequence in unknown encoding). Fix input longer than 2k (memmove() has src/dest switched, second time through loop in starts at offset inleft...) Made it start at beginning every time. Switch iconv_open() error msg to show to/from and errno (rather than hardwired english text).
2017-12-27Promote setfattrRob Landley
2017-12-27Minor cleanup on setfattr.cRob Landley
2017-12-26Add xxd -i (and xxd -ri).Elliott Hughes
The original xxd doesn't support -r with -i. The original also outputs "unsigned char name[] = { ... };" for input other than stdin, but that actually makes it less useful --- many languages support array initializers, but far fewer support that exact declaration syntax. Also fix the -c range checking and defaulting: ><= in the argument string only works for floating point arguments. Bug: http://b/64711851
2017-12-26Fix xargs -0 with -n.Elliott Hughes
Also make -0 and -E mutually exclusive (rather than just ignore -E with -0). Bug: https://github.com/landley/toybox/issues/78
2017-12-24Add fmt.Elliott Hughes
A very simple implementation of fmt, good enough for my daily use of !!fmt in vi to reflow checkin comments like this.
2017-12-11An incomplete list of deviations from posix (it's a start).Rob Landley
2017-12-10Cleanup pass on stty: collate do_stty() calls for future inlining,Rob Landley
collapse flag arrays to fewer lines, factor out xtcgetattr(), strip curly brackets around single lines, don't have a separate error message for tcsetattr() return code if more thorough check is on next line, take advantage of O_RDONLY being zero, document -F.
2017-12-05Use NULL rather than 0 in vargs.Elliott Hughes
Top bits count too!
2017-12-03Commands in pending should default n.Rob Landley
2017-12-03Add stty(1).Elliott Hughes
Full POSIX stty with Linux extensions. Output and behavior match coreutils 8.26 as far as I can tell. For some reason busybox 1.22 stty always shows all the special characters, even when they match "sane". I've matched coreutils, since "shows differences from sane" is easy to describe and obviously useful. Flags in the various arrays are not in the order they're introduced in POSIX or in the Linux header file: they're in the order that they're output by coreutils' stty. The -g output matches coreutils and busybox. I implemented iuclc, xcase, and olcuc even though they've been removed from POSIX because the others implement them, and "man stty" defines "raw" and "sane" in terms of them (where POSIX doesn't define "sane" in any useful sense). This builds fine against glibc 2.24, and as far as I can tell all the constants used were in Linux 2.6 so I'm assuming that there shouldn't be any #ifdef nonsense needed for any reasonable vintage of C library.
2017-12-03Add uptime -p.Elliott Hughes
We (Android) give up trying to teach folks what "up 142 days, 1:45" means... Bug: http://b/65205261
2017-12-03Gaël PORTAY wants mdev to work when Linux has the block layer configured out.Rob Landley
2017-12-02Android has its loop devices under "block" as Elliott says "by reason ofRob Landley
historical accident", so fall back to check there. Also remove an obsolete comment TODO block, check !parent for dirtree top of tree instead of '/' in the filename, and typecast some printf arguments for 32-bit systems.
2017-11-26Recognize sh/frv fdpic, and add types for bpf and new microblaze.Rob Landley
2017-11-26Use endianness info to read executable type.Rob Landley
2017-11-23Add "time -v".Elliott Hughes
This shows the other fields in getrusage. I've chosen to only show the ones actually maintained by Linux.
2017-11-21Make find -exec + obey ARG_MAX just like xargs.Elliott Hughes
This isn't ideal, but it matches xargs and none of us is likely to have time to do the best possible thing any time soon. Bug: http://b/65818597 Test: ./toybox find /usr/local/google/ndkports/ -exec echo {} +
2017-11-16Minor tweaks.Rob Landley
2017-11-16Add "df -i".Elliott Hughes
Also switch to u64 for calculations. Some FUSE file systems have inode counts large enough to overflow s64.
2017-11-03file(1): add ogg, TrueType font, LLVM bitcode, PEM certs, and PE executables.Elliott Hughes
More of the files encountered on the Android system image (plus PE executables, which we build but which shouldn't actually make it to the system image!).
2017-10-31Add top -m, fix width truncating for narrow screens (off by one), and add ↵Rob Landley
iotop -H
2017-10-31Rename test_*.c to demo_*.c (because "make test_$CMD" means something already),Rob Landley
fluff out README, and add a comment to hostid explaining its deprecation.
2017-10-31Only show LABEL= when there is one.Rob Landley
2017-10-31Fix cut -s and -f when delimiter not found (posix says print whole line).Rob Landley
2017-10-25Make -c work with unicode chars, and first stab at -C measuring columns.Rob Landley
2017-10-17Fix groups(1) and id -G.Elliott Hughes
Both should only output the groups.
2017-10-17Allow ro. properties to have arbitrary lengthsTom Cherry
Android now allows ro. properties to have arbitrary lengths. Two changes need to happen to support this: 1) The length check in setprop.c before attempting to set a property needs to be removed for ro. properties 2) __system_property_read_callback() must be used in place of __system_property_get() in getprop.c as only the former is capable of reading properties with size > 92 characters. Bug: 23102347 Bug: 34954705 Change-Id: Ib8565a3e6d987dd5e6a5fe790e804ecf8ad1e020
2017-10-10Tweak help_exit() to show "See %s --help" message on the same line.Rob Landley
2017-10-10Complete rewrite of cut. Handle multipe ranges, add -DFO options, startRob Landley
of utf8 support (not finished yet)... Adds new loopfiles_lines() wrapper to lib.c that calls do_lines from loopfiles.
2017-10-01Fix xargs to obey POSIX's ARG_MAX restrictions.Elliott Hughes
This avoids "xargs: exec echo: Argument list too long" errors in practice. find(1) needs to be fixed too, but that's a bit more complicated and a working xargs provides a workaround. Bug: http://b/65818597 Test: find /proc | strace -f -e execve ./toybox xargs echo > /dev/null
2017-09-25Basic Mach-O support in file(1).Elliott Hughes
The Nexus Player build was subtly broken in that it assumed that the host was using ELF. No-one noticed until a Mac user tried to flash their build, which contained a Mach-O x86 binary instead of an ELF x86 binary. Hilarity ensued. (On the same day, file(1) was able to explain a mixup with an ELF hexagon binary. Next time we see a Mach-O binary on an Android device, we'll be ready!) Bug: http://b/66741960
2017-09-21Add #warning about musl intentionally breaking chrt.Rob Landley
2017-09-09Redo/add seq precision logic.Rob Landley
Josh Gao hit a case where "seq 1000000 1000001" output 1e+06, and while he was there changed several things to work like existing seq implementations. I changed a couple back (commenting out the test cases) until somebody came come up with a reason (or existing use case) to do it that way.
2017-09-05Replace remaining mb*towc() calls with utf8towc().Rob Landley
2017-09-05Tweak utf8towc() to return -1 earlier sometimes (instead of -2), and add testRob Landley
program to compare against libc output.
2017-09-02In wc, replace mbrtowc() with new utf8towc() which doesn't have a context structRob Landley
or care about locale.
2017-08-31Another try at fixing the ps segfault resulting from /proc entries vanishingRob Landley
out from under us due to asyncronous process exit. The directory we're traversing vanishing can result in DIRTREE_ABORTVAL being returned, which we turn into a NUL entry, but then we were trying to look at that null entry's children. Oops.
2017-08-23Fix iconv build and add trivial test.Elliott Hughes
2017-08-17lsof cleanup.Rob Landley
2017-07-22Typo (env -0 was checking the flag wrong).Rob Landley
2017-07-21netcat: make -l exit after handling a request.Josh Gao
Bug: http://b/62305466
2017-07-17typoRob Landley
2017-07-17Redo ping plumbing. Actual ping part isn't there yet because kernel weirdness.Rob Landley
2017-07-17Split out xgetaddrinfo() from xconnect()Rob Landley
2017-07-11Don't remove "remount" from the option list during early parsing, the mountRob Landley
flag doesn't get set right otherwise and it tries to overmount instead.
2017-07-09dd cleanup: binary search is overkill, eliminate struct pair,Rob Landley
simplify strstarteq, use local variable "conv" instead of toys.optargs.
2017-07-09Fix -Wformat compiler warning in expr.c.Elliott Hughes
Android forces -Wformat on for all source. toys/pending/expr.c:116:28: warning: field precision should have type 'int', but argument has type 'long' [-Wformat] ret->s = xmprintf("%.*s", m[1].rm_eo-m[1].rm_so, target+m[1].rm_so); ~~^~ ~~~~~~~~~~~~~~~~~~~~~
2017-07-07Make dd use atolx_range(), and teach atolx_range() about "w" suffix (word, *2).Rob Landley
2017-07-02Add -t, deviations from posix, redo loop to have fewer duplicate tests.Rob Landley