aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-10-04Make it possible to build the AOSP .config against glibc.Elliott Hughes
It's possible that we should just pull setprop back out of toybox to live with getprop in system/core/, but this lets us build the same toybox configuration for device and host in AOSP. (Longer term we'd like to use host bionic, but if we enable this we can start experimenting on the tobyox side before the bionic side is finished.)
2018-09-16Nommu systems want to _exit() after vfork when exec fails, but should do ↵Rob Landley
cleanup ala fflush(0) after a normal exec() failure.
2018-09-15Fix glibc build after 013876f067a11ebfcf47789921b376e7bf3bf5b8.Elliott Hughes
/usr/include/unistd.h:626:15: error: conflicting types for 'confstr'
2018-09-09Variable data needs to go at the end.Rob Landley
2018-09-08Tweaks to make building with Android NDK's llvm happier.Rob Landley
2018-08-21Use \033 instead of \e gcc extension.Rob Landley
2018-08-17Make microcom use set_terminal() and move speed setting into set_terminal().Rob Landley
2018-08-07Forgot to check in the deflate header change, and pending shouldn't default y.Rob Landley
2018-08-03xgetrandom: use getrandom result if it succeedsPatrick Oppenlander
2018-08-02Move pending/compress.c to lib/deflate.c, first pass at genericizing it.Rob Landley
2018-07-19Tweak/add some comments.Rob Landley
2018-07-13Fix typo in a macro nameKonst Mayer
2018-07-08Fix division by zero errors and double summary in ping.Rob Landley
2018-07-06Bionic ships newer libc with older kernels, so Android needs to fallback atRob Landley
runtime for ENOSYS.
2018-07-04Add xgetrandom() with probe for new system call (else open/read /dev/{,u}random)Rob Landley
2018-07-04diff: add timestamps to the ---/+++ lines and --color.Elliott Hughes
(My apologies for mixing these two unrelated changes up.)
2018-07-02Fix bugs in yesterday's bufgetgrgid() work (reported by Elliott).Rob Landley
2018-06-30Loop retrying larger allocation sizes for bufgetpwuid/bufgetgrgid.Rob Landley
Slightly tweaked version of Elliott's patch. We probably only need to do this for groups (struct group * has a list of users that belong to it, but struct passwd doesn't, getgrouplist() is separate) but keeping the code of the two similar in case there's a way to merge them later.
2018-06-14Change do_lines() semantics to end with a callback(0,0) to indicate EOF,Rob Landley
adjusting existing users.
2018-05-06Support fractional seconds (and other time units) in `top -d`.Elliott Hughes
LTP uses `top -d 0.1`, which isn't convincingly useful, but general support for other time units might be useful, and switching to xparsetime addresses both at once. Also fix 3169d948c049664bcf7216d4c4ae751881099d3e where I mistakenly treated `rev` and `toys.optflags&FLAG_b` as interchangeable. (Without this second fix, `top -b` looks fine but `top` is broken!) Also fix xparsetime to reject input such as "monkey" or "1monkey".
2018-05-03Add uuidgen.Elliott Hughes
Reuse create_uuid, but make it match the current RFC.
2018-04-08Add cp --parentsRob Landley
2018-04-08Add mkpath() for common case of mkpathat(), and #define magic constants.Rob Landley
2018-04-08Add readlink -m to show where a missing path would be.Rob Landley
Note: ubuntu will show -m through a file, this treat that as error.
2018-04-03Factor out xtempfile()Rob Landley
2018-03-31Remove semicolon from WOULD_EXIT() macro (screws up if statement levels).Rob Landley
2018-03-22atolx should use tolower instead of toupperMinghui Liu
2018-03-20Fix atolx not integer error when used with suffix *dMinghui Liu
2018-03-20Minghui Liu pointed out that the b and c suffixes were reported as errors.Rob Landley
2018-03-14Fix last uninitialized warning.Elliott Hughes
clang is fine with the noreturn nature of error_exit, but only if we don't `if (false)` it out for non-debug builds. lib/args.c:304:18: error: variable 'temp' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] } else if (CFG_TOYBOX_FLOAT && new->type == '.') { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ external/toybox/generated/config.h:11:26: note: expanded from macro 'CFG_TOYBOX_FLOAT' ^ external/toybox/lib/args.c:308:19: note: uninitialized use occurs here options = --temp; ^~~~ external/toybox/lib/args.c:304:14: note: remove the 'if' if its condition is always true } else if (CFG_TOYBOX_FLOAT && new->type == '.') { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ external/toybox/lib/args.c:255:15: note: initialize the variable 'temp' to silence this warning char *temp; ^ = NULL
2018-03-12Fix bug in names_to_pid.Elliott Hughes
Found by the compiler, not me: lib/lib.c:1053:30: warning: 'st2.st_dev' may be used uninitialized in this function [-Wmaybe-uninitialized] if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino) continue; ~~~^~~~~~~
2018-03-10Split "comma separated values" parsing from mntent.h plumbing.Rob Landley
2018-03-10Add a way for commands to distinguish "ps -ax" from "ps ax".Rob Landley
2018-02-09Fix the pidof comm and cmdline tests.Elliott Hughes
If we have a 15-byte name, we don't know whether comm actually matches or is a truncated form of a longer name that has a common prefix. For example, with "this-is-a-very-long-name-that-is-too-long", we shouldn't match "this-is-a-very-" (but the old code would). The cmdline code was also broken on Android because it used basename(3) rather than getbasename. This doesn't affect glibc because there's a workaround in portability.h to ensure that we get the non-POSIX basename(3) with glibc but then a non-glibc section that ensures everyone else gets POSIX basename(3). That should probably be removed (and maybe `basename` poisoned) to prevent similar mistakes in future. Bug: http://b/73123244
2018-01-30Basic ping support.Rob Landley
Requires echo 0 $((1<<30)) > /proc/sys/net/ipv4/ping_group_range (as root)
2018-01-14Switch xgettty() -> tty_fd() (returning -1 instead of erroring out if none).Rob Landley
2018-01-06Move millitime() into lib.c.Rob Landley
2018-01-01Cleanup logger.c, and move the facilitynames/prioritynames SYSLOG_NAMESRob Landley
stuff syslog.h does into lib.c and portability.h
2018-01-01xphung on github said: "config2help currently doesn't work on OS X, itRob Landley
terminates parsing of Config.in at first blank line. This is because getdelim() in portability.c returns -1 whenever the line comprises only a single linefeed character. Fixing this was a trivial change to two lines (see below), and config2help now works on OS X but I haven't regression tested this on any other commands which rely on getdelim()"
2017-12-22Redo namestopid to handle more cases.Rob Landley
2017-12-19killall should kill scripts too.Elliott Hughes
Found running LTP file system tests on Android. Bug: http://b/70627145
2017-12-03Don't capitalize in the middle of a sentence.Elliott Hughes
Before: toy: Unknown option p (See "toy --help") After: toy: Unknown option p (see "toy --help")
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-09Last commit used xstrtod(), forgot to check it in.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-02utf8towc() has to be in lib.c if strlower() is going to use it, becauseRob Landley
scripts/*.c builds against lib.c but not linestack.c.
2017-09-02In wc, replace mbrtowc() with new utf8towc() which doesn't have a context structRob Landley
or care about locale.
2017-07-17Split out xgetaddrinfo() from xconnect()Rob Landley