aboutsummaryrefslogtreecommitdiff
path: root/toys
AgeCommit message (Collapse)Author
2016-02-21lsof cleanupRob Landley
Accept multiple -p, inline filter_matches, convert misleading "char* a, b" to "char *a, b", use readfile() to read a file, use DIRTREE_SHUTUP, don't need { } around a single line, don't modify command line environment space (which changes what ps/pgrep sees).
2016-02-19Implement "insmod -".Elliott Hughes
Also use finit_module if available. Given that "insmod -" requires init_module, maybe this isn't a worthwhile optimization. Given that "insmod /actual/file.ko" is the common use case, maybe it is. Fix a bug in readfileat where *plen would be corrupted if you didn't supply your own buffer (because ibuf is 0 in that case, not a pointer to the start of the allocated space).
2016-02-19Help text update from Isaac Dunham, tweaked slightly.Rob Landley
2016-02-19Add xxd -p and -r.Elliott Hughes
SELinux denials include hex-encoded paths in the log messages; xxd -r -p is a convenient way to decode them. The heuristics are a little weird to my mind, but match the documentation and observed behavior.
2016-02-17The perl build's attempt to escape spaces and such in LD_LIBRARY_PATH is _SAD_.Rob Landley
It uses a sed expression that assumes you can escape - to use it as a literal (you can't, it has to be first or last char of the range), and assumes you have to escape delimiters in sed [] context (you don't), and/or that non-printf escapes become the literal character (they don't, the backslash is preserved as a literal), meaning it winds up doing "s/[\-\]//" which is a length 1 range, which is officially undefined behavior according to posix, and regcomp errors out. But if we don't accept it (like other implementations do) the perl build breaks. So collapse [A-A] into just [A]. Testcae taken from perl 5.22.0 file Makefile.SH line 8. (While we're at it, remove an unused argument from a function.)
2016-02-17Add support for getprop -ZTom Cherry
Add support for a -Z option to getprop that will either print the SELabel of a given property if one is provided or print all properties that have been set along with their SELabel. Also, correct a memory leak when freeing TT.nv.
2016-02-17Fix remounting /system on Android.Elliott Hughes
This adds the missing "relatime" option, fixes error handling logic (mount returns 0/-1, not an errno value, and I at least get EACCES rather than EROFS in the case where the underlying block device is read-only; we should also probably only try again if the ioctl actually succeeded), and adds the missing newline in case where we go around and try again read-only. The test case was "mount -o rw,remount /system" on Android.
2016-02-17Add dynamic/static checking to file (printing dynamic linker if found).Rob Landley
2016-02-15Cleanup pass on file.c, and add detection of different ELF architectures.Rob Landley
2016-02-14Implement file(1).Elliott Hughes
Unlike the POSIX file(1), there's no magic file here, just hard-coded common (non-obsolete) file formats. Personally most of my use of file(1) is as a one-line readelf(1) summarizer, so although I assume a full POSIX file(1) is out of scope (because just the database would likely be larger than all the rest of toybox), a subset that only supports in-use file types actually covers most of the use cases I encounter personally. Also fix peek_be/peek_le.
2016-02-14Fix wc -c optimization.Elliott Hughes
Check the fstat(2) return value rather than read uninitialized memory if it failed, and add a special case for files that claim to be zero-length but aren't (as is common in /proc on Linux).
2016-02-11removed unread assignment in sed.clovelycuppatea
clang scan-build flags up this line as being unread, so clearing from code.
2016-02-10toybox: tar: Fix support for long namesTom Marshall
Pathnames may be longer than the name field in the header, so use strncpy() instead of xstrncpy() to avoid bailing out. Also add unit tests to ensure proper handling of short and long pathnames. Change-Id: Id025891993746889564b479e5185cf9721b54a55
2016-02-10Add seq -w, suggested by izabera.Rob Landley
2016-02-10Factor out strnstr() since posix hasn't got it, and add a config option forRob Landley
the deeply sad passwd heuristics that don't even check numbers and punctuation.
2016-02-10make wc -c fasterizabera
2016-02-10use unsigned long with factorizabera
2016-02-10Although printf("%.*s", INT_MAX, s) works fine on ubuntu 12.04, it broke since.Rob Landley
2016-02-10implement env -uizabera
2016-02-09Add ulimit.Rob Landley
This isn't a shell builtin, it uses prlimit to target any pid (without -P it defaults to $PPID, so acts like historical ulimit by default).
2016-02-08Add xpipe() to lib.Rob Landley
2016-02-05Another fix from Josh Gao to avoid a null pointer dereference, andRob Landley
minor cleanup of previous commit.
2016-02-05Fix segfault when `find -iname` gets no argument.Josh Gao
2016-02-04Fix -H and -n with -ABC, and add tests.Rob Landley
2016-02-01Fix directory test in cp.Elliott Hughes
Commit 3d33dd80f8cb931e293d7f64c44bc357fec11120 fixed a use of S_ISDIR on st_dev rather than st_mode in find, but there was another instance of the same error in cp.
2016-02-01Add find -deleteRob Landley
2016-01-31Fix blkid typo (label wasn't detected in murderfs).Rob Landley
2016-01-30Add grep -B -CRob Landley
2016-01-30Add grep -ARob Landley
2016-01-28Add SIGWINCH support to top, and implement -o and -n in pgrep/pkill.Rob Landley
2016-01-28Adding -M broke ps -k header printing without -M.Rob Landley
2016-01-28Bugfix I forgot to checkin, plus a wrapper function.Rob Landley
2016-01-27Don't resort or recalculate headers for cursor up/down, do PGUP PGDN, andRob Landley
down move way down past end of list.
2016-01-27Add cpu line to top, and fix a bug initializing upticks slot.Rob Landley
2016-01-27long opts and -f for unshareizabera
2016-01-27Don't try to be fancy with top headers, just hardwired the standardish ones.Rob Landley
Still need to do the cpu(s) line in top.
2016-01-26Add ps -M to measure/expand field widths if they don't fit.Rob Landley
(Still truncates at the right edge to fit terminal width, but last commit made -w the default when no terminal width detected.)
2016-01-26Add ps -O (inserts extra args before last field), and make -w the defaultRob Landley
when we haven't got a terminal width. Replace top CMDLINE with ARGS. More ps infrastructure genericization: parse reverse unconditionally. Break out get_headers() with global references moved to caller. change quick_ko() to default_ko() (dlist_terminate is now caller's job).
2016-01-25Fix compiler warnings in traceroute.Elliott Hughes
If we're fixing warnings in pending...
2016-01-25Next lump of top work. Add -o DISPLAY_FIELDS -k FALLBACK_SORTS -s SORT_BY plusRob Landley
the start of -h HEADER (mostly parses text, but doesn't display %ESCAPES yet). Added UP, DOWN, and R keys. Made only iotop STAYROOT (not top), added comment explaining why. Bumped iotop's historical -O and -K to capital letters. Added quick_ko() to add argument list from string instead of arg_list.
2016-01-22Factor out insanitize() from seq.c to next_printf() in lib.Rob Landley
2016-01-21Replace slot[] constants with SLOT_blah, fix some that weren't displaying right.Rob Landley
Make fallback sort do string sort after numeric tie, retain absolute uptime even though relative is needed for %CPU (hence utime2).
2016-01-21I cleaned up the code in 'netstat.c' as belows.Lipi Lee
- Adjust to 80 columns - remove a useless function(strchr_nul), variable, type casting and compile warnings(fgets) - clean up netstat command option condition - change useless double pointer to single point and dynamic memory allocation to static one - fix a ambiguous return type and typo
2016-01-20Correct units of %MEM and %VSZ.Rob Landley
2016-01-20Add basic top support to ps.c, delete toys/pending/top.c.Rob Landley
While I'm there, pack the ps help text, break out TOP_COMMON (todo: update config2help to collate that properly), add -o CPU showing which processor this pid is running on, implement -o C (it's %cpu without the fractional part), add -o %MEM, fix header padding.
2016-01-19runcon needs to exec, not recurse.Rob Landley
2016-01-18Implement pgrep -clv (and remove some accidentally checked in debug code).Rob Landley
Still need to do -n and -o.
2016-01-18Implement basic pkill plumbing, and fix FORCE_FLAGS on flag context switch.Rob Landley
2016-01-17Extend utf8 fontmetrics so ps can use them.Rob Landley
Also, I forgot to check in uuid_show() last time.
2016-01-17Add -L label and UUID support to mkswap.Rob Landley