aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.h
AgeCommit message (Collapse)Author
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-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
2017-05-24Add and use xmmap.Elliott Hughes
Everyone forgets that mmap returns MAP_FAILED rather than NULL on failure. Every use of mmap in toybox was either doing the wrong check, or no check at all (including the two I personally added).
2017-05-23Add minof/maxof macros that autodetect type. Make xzcat use them.Rob Landley
2017-05-21Cleaup chrtRob Landley
2017-05-08Move strend() to lib/lib.cRob Landley
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-04Some lib fixes: mark xvfork() noinline, make xsendfile() return bytes copied,Rob Landley
make xsocket()'s returned fd CLOEXEC.
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-11Make netcat work with nommu and factor out poll() loop into net/net.c.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-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-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-07-26Move regexec0 into lib (regexec that takes length and matches after NUL).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-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-20Add bufgetgrgid()Rob Landley
2016-05-17Add bufgetpwuid. (Repeated calls to getpwuid() are really expensive.)Rob Landley
2016-04-21Have dirtree_recurse() take the new dirfd as an argument.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-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-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-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-09Fix xpipe. (thinko.)Rob Landley
2016-02-08Add xpipe() to lib.Rob Landley
2016-01-28Bugfix I forgot to checkin, plus a wrapper function.Rob Landley
2016-01-22Factor out insanitize() from seq.c to next_printf() in lib.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-17Update draw_str() and friends to do standard escaping for ^X <AB> U+ABCD.Rob Landley
2016-01-16Move create_uuid() to lib and xpoll() to lib/net.c.Rob Landley
2016-01-10Make cursor left/right change sort type in iotop.Rob Landley
2016-01-07Make scan_key() specify timeout in miliseconds, split out terminal_probesize(),Rob Landley
add function key definitions and shift/ctrl/alt cursor keys.
2016-01-05Add error_msg_raw() and friends, replace error_msg("%s", s) uses, enable formatRob Landley
checking, and fix up format checking complaints. Added out(type, value) function to stat to avoid a zillion printf typecasts.
2015-12-29Add strafter() to lib.Rob Landley
2015-12-27Add scan_key_getsize() doing the ANSI probe, switch scan_key() to TAGGED_ARRAY,Rob Landley
and add test_scankey.
2015-12-24Move get_line() header to pending.h because posix has FILE * versions.Rob Landley