aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
AgeCommit message (Collapse)Author
2020-01-08Implement readelf(1).Elliott Hughes
Basic readelf(1) implementation, with output close enough to the binutils version to be usable with scripts that expect the binutils version. This started as an implementation of nm(1) until I realized that I almost always want readelf instead, and that you actually have to do much of the work needed for readelf just to implement nm. Arguably nm (being part of POSIX) belongs in toybox while readelf doesn't. An argument could also be made that neither really belongs in toybox, belonging in a separate set of development tools (such as binutils or the LLVM binutils). Doesn't support most of the architecture-specific stuff, most notably relocations, but is aware of things like ARM exidx sections and the common register state notes in core dumps for the "big four" architectures: arm, arm64, x86, and x86-64. Doesn't support symbol versions (but probably should). Doesn't support section groups or the -t "section details" (which is a long form of -S "section headers" that I've never seen used in practice and which isn't part of -a). Doesn't support dumping unwind info or the hash table bucket histograms. Reuses the table of ELF architectures from file(1). Not fuzzed, but successfully parses all the ELF files in my Ubuntu 18.04 system's lib directories. Attempts to exit with an error when presented with an invalid ELF file rather than struggle on as binutils seems to.
2020-01-08Remove lots of debugging dprintf()s.Rob Landley
2020-01-08Fix commaless brace discard.Rob Landley
2020-01-08Implement quote removal and fix unterminated bracket expansion.Rob Landley
2020-01-07Bracket support in progress. Mind the dprintf()s.Rob Landley
2020-01-03Add local variables support.Rob Landley
2020-01-03Finish cd, make help -ahu unconditional, fix expand memory cleanup path,Rob Landley
set $HOME $PWD and $OLDPWD, fix prompt \w, shuffle some functions around to avoid prototypes, implement tilde expansion, add FORCE_COPY.
2020-01-01Factor out array_add(), replace argxtend().Rob Landley
2020-01-01If allocation update is done in blocks, initial allocation has to populateRob Landley
a full block.
2019-12-31toysh: start of <(echo hello) support.Rob Landley
2019-12-29Implement single command env assignments (abc=def command) and make debugRob Landley
output #definable.
2019-12-29Debug basic pipe support and I/O flush for builtins.Rob Landley
2019-12-28Next round of sh plumbing: more work on redirect and pipe, use CLOEXEC.Rob Landley
2019-12-23Toysh passes two tests now! Woo! (Otherwise, does not remotely work right now.)Rob Landley
2019-12-15Nothing in pending should default y.Rob Landley
2019-12-12Next round of toysh work, with associated lib plumbing.Rob Landley
2019-12-04Fix getopt optstringE5ten
Move longopts after their corresponding shortopts instead of before
2019-11-24bc: fix a comparison bugGavin Howard
2019-11-22Add getopt(1).Elliott Hughes
Includes new tests.
2019-11-03ip: remove get_line().Elliott Hughes
2019-10-21vi: unalloc used memory, cleanups, fixesJarno Mäkipää
add: linelist unload fix: proper utf8 handling on insert mode backspace fix: free allocated data at exit cleanup: rename some variables to be describive but short cleanup: reorganize some variables in main
2019-10-19wget: Added support for HTTP 301 and 302 redirectsJarno Mäkipää
Added: parsing of redirectation responses, will now follow redirectation path until maximum of 10 jumps. This will probably lead to server advertising user the https url.
2019-10-09vi: fixesJarno Mäkipää
fix: force redraw after :set (no)list fix: force redraw after insert fix: split on zero cursor position fix: yank and push with utf-8 content
2019-10-04vi: Scroll unmodified lines using escape codesJarno Mäkipää
Scroll visual buffer up and down using standard escapes when content has not changed, instead of redrawing every keypress. Sidescroll now moves all the lines instead of only cursor one. Side scrolling long lines unfortunately causes redraw to whole screen. -Jarno
2019-09-23Call ftpget from wgetDenys Nykula
Branch wget to xexec ftpget given an ftp url. Rename the output flag -O like in other wgets. Add mock wget --no-check-certificate to satisfy pkgsrc. Ifdef the version output in wget because the nonexistent constant fails single builds and mkroot.
2019-09-22vi: Added yankJarno Mäkipää
Added: yank and push Rewrote: delete operations Minor cleanups: Rewrote delete operations to use one delete function instead of having separate behavior here and there. Now delete and yank both always move cursor and then clip the whole cursor area into yank register. For example x is just ld or jd depeding are we right edge or not, and dd is jd with some special flags etc. Now only default yank register is implemented, but implemeting yank register list should be trivial since cmd execution already passes register char.
2019-09-19vi: changes to buffer drawingJarno Mäkipää
Replaced: draw_str_until with lib/crunch_str() where possible Removed: Unused char draw functions. Implemented: crunch_nstr() which is crunch_str with additional check for byte length, this can be used to draw substrings or non null terminated strings. (This can be moved to lib/ if its useful for others) Reimplemented: Buffer drawing without line wrapping. Now too long lines are drawn with @ in end. And cursor line scrolls left and right when hitting right margin point. This will simplify buffer handling alot. Linewrapping can be reimplemented later if needed but will add complexity Implemented: set list and set nolist ex commands, set list will show escape codes such as tabs Fix: Bug on splitting 2 lines, split was 1 byte off.
2019-09-09vi: added support for tabsJarno Mäkipää
Add: tabs, follows tabstop variable currently hardcoded to 8. Should be adjustable with :set tabstop N according to man page fix: search, issue with searching substring that is more left than cursor position on following lines.
2019-09-08make "for i in" work.Rob Landley
2019-09-07host: cope with large DNS responses.Elliott Hughes
DNS responses were limited to 512 bytes back when they were UDP only, but if you have a TCP connection you can get up to 64KiB. Also use the existing constant for the size of rrname. Also update the help text. Also consistently use `sizeof(T)` rather than `sizeof T`. Also use consistently use `ARRAY_LEN`. Fixes #56. Test: `toybox host value.testing.express`
2019-09-07vi: small fixes.Elliott Hughes
I really needed to be able to edit a file on the device, and this was the nearest thing handy, and it turns out to be more or less usable for basic editing, so... Support cursor keys. Support :q (since there's currently no record of whether the file's modified or not, :q is the same as :q!). Add 'A' to insert at end of line. Add 'n' to find next after '/'. Fix backspace all the way to get out of ex command mode. Fix escape sequences to not hard-code assumptions about the terminal's default background and foreground colors. Fix 'spesial' typo for 'special', and remove explicit array sizes.
2019-08-29diff and patch: support special characters in filenames with quoting as well ↵William Haddon
as unusual timestamp formats After further research and testing, I've produced a patch which handles all filenames with special characters by copying the GNU quoting behavior, and also treats anything following a tab as a timestamp. This increases both ability to handle possible filenames and ability to apply patches found in the field. In diff, quote and escape filenames according to the following rules. * Surround the filename with quotes if it contains a byte less than 0x20, a byte greater than or equal to 0x80, space, backslash, or quote. * Replace alert, backspace, form feed, newline, carriage return, tab, vertical tab, backslash, and quote with \a, \b, \f, \n, \r, \t, \v, \\, and \", respectively. * Replace other bytes less than 0x20 or greater than or equal to 0x80 with a backslash followed by the three octal digits representing the value of the byte. * Treat valid UTF-8 characters involving sequences of bytes greater than or equal to 0x80 the same as other sequences of such bytes. In patch, process quoted and escaped filenames according to the following rules. * If the filename does not begin with a quote, do not modify the filename. * Remove quotes surrounding the filename. * In quoted filenames, replace \a, \b, \f, \n, \r, \t, \v, \\, and \" with alert, backspace, form feed, newline, carriage return, tab, vertical tab, backslash, and quote, respectively. * In quoted filenames, replace a backslash followed by octal digits with the byte with that value in octal. Also, in patch, treat anything on a +++ or --- line following a tab character after the beginning of the filename as a timestamp, rather than part of the filename.
2019-08-29Fix sh handling nested if/else/elif statements alaRob Landley
if true; then if false; then echo one; elif echo two; then echo three; else echo four; fi; fi
2019-08-23man: fix help, align -k output, and fix double close.Elliott Hughes
The "info" pages are something very different from the "intro" pages :-) do_lines already closes the fd. Also improve the error message for `man`.
2019-08-18Next round of shell plumbing.Rob Landley
You can now run: echo hello; if true; then echo hello; fi; while true; do echo hello; done It's got the start of for loops but needs environment variable resolver to do much with them.
2019-08-15dd: fix skip= with short reads.Elliott Hughes
Subtract the amount we actually read, not what we asked for.
2019-08-09lsof: simplify octal mode display.Elliott Hughes
Since this masks, it doesn't actually have the same bug as e5942a8c90c2f52550496fdf08efddb564d8e5a3, but we may as well fix the other example of that questionable idiom while we're thinking about it...
2019-08-09Split out run_function() and free_function(), add start of _TOYSH_LOCALSRob Landley
marshalling for vforked subshells, fix rc returned from run_pipeline for variable assignment. (Well, sort of: X=$(false) still needs rc = 1.)
2019-08-04Make "if true; then echo hello; fi" work. More work on redirection.Rob Landley
2019-08-02Next round of infrastructure. Start of redirect logic and runtime flow control.Rob Landley
2019-07-31man: switch to xregcomp.Elliott Hughes
All regcomp callers are now going through xregcomp.
2019-07-24crontab: switch to getline().Elliott Hughes
2019-07-22Next round of plumbing evolution. Left in the todo and debug code this time.Rob Landley
2019-07-16ip.c route change support for extended attributes.Mike Bennett
This fixes the extended attribute settings for the ip route change command; extended attributes are collected in a separate buffer and added to the RTM message in a specific RTA_METRICS attribute. Only added setter support for the RTAX_MTU (per-route MTU), as that was the only option currently parsed. Also added support for displaying extended attributes, even those not currently settable.
2019-07-12diff: implement --strip-trailing-cr.Elliott Hughes
Used by some ART tests and also some LLVM tests. (The motivating example is the latter, but I noticed the former when looking for other users.) Bug: http://b/137298656
2019-07-12pidof: fix default behavior, add -x.Elliott Hughes
Before this patch, we're effectively doing `pidof -x` all the time. This patch changes names_to_pid() to allow us to say whether or not we want to include scripts, and adjusts the callers appropriately. Also add tests for `pidof` versus `pidof -x` which pass after this patch, without regressing the existing killall tests.
2019-07-11Next sh checkpoint. Not remotely load bearing yet.Rob Landley
2019-07-11bind/connect cleanup.Elliott Hughes
Rename the existing xbind/xconnect to xbindany/xconnectany, to make room for new xbind/xconnect that are more like 'x' versions of the regular bind and connect. Move explicit bind/connect callers over to xbind/xconnect. Of the affected commands, only netcat is actually used by Android. It was the most recent patch to netcat that made the lack of a more traditional xbind/xconnect apparent.
2019-07-10dd: iflags, oflags, fix ^C, fix the fundamental loop.Elliott Hughes
Investigating why the toybox tar tests fail on Android with toybox dd, I realized I was rewriting a part of dd I'd rewritten before! This is a re-send of my 2019-02-22 patch, rebased against the current ToT... This patch was originally motivated because after suggesting to the author of https://stackoverflow.com/questions/17157820/access-vdsolinux/54797221#54797221 that he could tell dd to work in bytes rather than blocks, I realized that our dd doesn't actually support that. But the rewrite of the main loop is necessary to fix the incorrect output from the dd calls in the tar test. Without this patch, `yes | dd bs=65536 count=1 > fweep` basically gives random output, based on how many bytes the pipe feels like giving you in your first read. (As far as I know, dd *without* bs= was fine, but I can't guarantee that that's true, just that I haven't seen it fail.) Also switch to TAGGED_ARRAY and comma_* for conv rather than add two more copies of an undesired idiom. It turned out -- contrary to the belief of cp(1) -- that comma_scan isn't suitable for this because of its magic handling of "no" prefixes. (It's actually harmless in cp because none of the --preserve options begin with "no", but some dd options do.) To this end, comma_remove is a less-magic comma_scan. I've also changed an `if` to a `while` because other implementations allow things like `--preserve=mode,mode` or `conv=sync,sync`. (If we decide this is a bug rather than a feature, we should at least fix the error message to be clear that we're rejecting the *duplication*, not the option itself.) I've also fixed the ^C behavior by simply adding a direct SIGINT handler rather than trying to be clever inside the read loop (which is why we weren't handling the SIGINT until the read returned). I've also removed `strstarteq` and just added the '=' to each literal when calling regular `strstart`. Plus basic tests.
2019-07-09dd: fix seek= on stdout.Elliott Hughes