aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2017-02-04Posix says stdio.h should define 'stdout' as a macro, and bionic turns it intoRob Landley
an array index, which doesn't work as a local variable name. So rename it.
2017-02-04Switch oneit to use xopen_stdio() for -c (oops) and switch XVFORK() to useRob Landley
__attribute__((returns_twice)) instead of noinline. Yes LLVM supports it: https://llvm.org/bugs/show_bug.cgi?id=6287
2017-01-28Fix padto in draw_trim_esc() so it behaves like printf %*.*s and matches theRob Landley
comment (I.E. negative first value _left_ justifies). This makes ps display the same truncated values with and without a tty. Also add a few comments to the rest of the file.
2017-01-04Some lib fixes: mark xvfork() noinline, make xsendfile() return bytes copied,Rob Landley
make xsocket()'s returned fd CLOEXEC.
2017-01-04An option can't exclude itself, so "abc[-ab][!abc]" with "command -a -b"Rob Landley
shouldn't segfault falling off the end of the list trying to report a nonexistent error condition.
2016-12-08Add DIRTREE_PROC to skip non-numeric entries and make ps/top etc use it.Rob Landley
2016-11-21Have dirtree_notdotdot() pass through !node->parent so . and .. on the commandRob Landley
line aren't filtered out. Audited all the callers and removed redundant calls, adjusted call sequence, etc. (And let rm _not_ do this, because posix.)
2016-10-20Allow out and escout to be NULL in crunch_str()Rob Landley
2016-10-11Make netcat work with nommu and factor out poll() loop into net/net.c.Rob Landley
2016-09-30sed -i run as root wasn't preserving ownership.Rob Landley
2016-09-05Replace loopfiles' failok with WARN_ONLY open flag.Rob Landley
2016-09-05Export notstdio() wrapper.Rob Landley
2016-09-04Add openro() and WARN_ONLY flag so xopen() and friends can warn without exiting.Rob Landley
2016-09-04Switch help.c from #ifdef to if()Rob Landley
2016-09-03Move genericish function to lib.Rob Landley
2016-08-18Change xgetpwnamid/xgetgrnamid to xgetuid/xgetgid returning the id numberRob Landley
instead of a struct. This means it can return "12345" even if that user/group doesn't exist in /etc/passwd and similar. All the users were immediately dereferencing it to get pw_uid or gr_gid anyway, so just return it directly and adjust the users. This fixes things like "chown 12345:23456 filename".
2016-08-13Add TOYFLAG_NOHELP to disable --help processing for individual commands,Rob Landley
apply it to "true" and "false".
2016-08-13Move getusername/getgroupname to lib. (Return name or string representationRob Landley
of number, but never NULL. Both returned in static buffer good through next call.)
2016-08-04Make xopen() skip stdin/stdout/stderr, add xopen_stdio() if you want stdout,Rob Landley
add xopenro() that takes one argument and understands "-" means stdin, and switch over lots of users.
2016-08-02Fix warning: 'XATTR_NAME_SMACK' macro redefined.Elliott Hughes
Recent Linux uapi <linux/xattr.h> headers define XATTR_NAME_SMACK. The <sys/xattr.h> include at the top of lib/lsm.h means that even though the direct include of <linux/xattr.h> is guarded, it may have already happened transitively anyway. (The alternative fixes would be to hard-code the correct value for XATTR_NAME_SMACK here instead, or #undef XATTR_NAME_SMACK.)
2016-07-26Move regexec0 into lib (regexec that takes length and matches after NUL).Rob Landley
2016-07-15Don't close stdin when loopfiles reads "-".Rob Landley
2016-07-13Bugfix: suffixless string was feeding terminating NUL to strchr() and matching.Rob Landley
2016-07-12Convert atolx() and friends to use long long internally. Update design.htmlRob Landley
to use this (and tail) as examples of simplicity of implementation winning and losing.
2016-07-08dd improvements.Elliott Hughes
Support hex (requested by users). Support status=noxfer and status=none (requested by users). Fix status output. Clarify large numbers in --help output. Use O_TRUNC rather than ftruncate unless we're also seeking. New tests. Also partial cleanup (reuse of existing code, removal of non-GLOBALS globals, and merge dd_main and do_dd).
2016-07-04Now that we're using the adjusted option string, need to skip placeholders ↵Rob Landley
in [groups].
2016-06-30Use libbuf instead of stack buffer.Rob Landley
2016-06-19Last commit depends on new lib code I forgot to check in. (Oops.)Rob Landley
2016-06-15Add readlink0() and readlinkat0() which null terminate the data.Rob Landley
2016-05-25Stand alone builds of OLDTOY should show help text for corresponding NEWTOY.Rob Landley
2016-05-20Add bufgetgrgid()Rob Landley
2016-05-17Add bufgetpwuid. (Repeated calls to getpwuid() are really expensive.)Rob Landley
2016-05-04Simplify ps android scheduling policy fetch slightly.Rob Landley
2016-04-30Add a ps "PCY" field for Android scheduling policy.Elliott Hughes
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-21Have dirtree_recurse() take the new dirfd as an argument.Rob Landley
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-10Didn't check in all my local basename_r->getbasename changes. (Oops.)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-29Fix build when wchar_t is unsigned.Elliott Hughes
external/toybox/lib/linestack.c:84:5: error: conflicting types for 'crunch_str' int crunch_str(char **str, int width, FILE *out, char *escmore, ^ external/toybox/lib/lib.h:228:5: note: previous declaration is here int crunch_str(char **str, int width, FILE *out, char *escmore, ^ I'm not sure whether the interface was intended to be wchar_t or int, but switching to int is the smaller change...
2016-03-29Fix exit code of things like sed -i that use tempfile_handler().Rob Landley
(The sigatexit() handler list code now calls the handlers on the normal exit path, so _exit(1) from the handler is wrong; exit_signal() modifies toys.exitval if necessary.)
2016-03-15Add ls -b and make ls -q work with utf8.Rob Landley
2016-03-13Split out _xexit() from xexit() and give sigatexit() multiple callbacks.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-07Cleanup pass on the dirtree infrastructure, in preparation for making rm -rRob Landley
handle infinite depth. Fix docs, tweak dirtree_handle_callback() semantics, remove dirtree_start() and don't export dirtree_handle_callback(), instead offer dirtree_flagread(). (dirtree_read() is a wrapper around dirtree_flagread passing 0 for flags.)
2016-03-02For years the man pages have said to #include <sys/types.h> to getRob Landley
major/minor/makedev, but glibc has vowed to break existing programs (https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html) and replace it with _another_ non-standard header (not in posix or lsb), so let's just add functions to lib/ that do the transform ourselves.
2016-03-01The last-ever release of uClibc didn't #define MS_RELATIME.Rob Landley
2016-02-25Typecast a printf argument because wchar_t isn't a rigidly defined size.Rob Landley
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-18RLIMIT_RTTIME was added to the kernel in 2008, you can't expect uClibc to ↵Rob Landley
have noticed yet.