Age | Commit message (Collapse) | Author |
|
|
|
Replaced dlist linelist with continuous memory blocks. This will allow
editing huge files without billion mallocs. File is first opened with
mmap() and mapped region is fully described in block_list as one block.
Currently "valid" data is described as slices, when first loading file
there is only one slice that points to memory existing in block_list.
When cutting text, block_list is not freed or modified, but instead
slice_list is modified to have "hole" between 2 slices. when inserting
new mem_block is added, previos slices are cut in cursor position and
new slice is added...
Added functions to handling data inside block_list+slice_list
insert_str(), cut_str() are used for all delete and add operations
text_strrchr(), text_strchr() are used for searching lineendings
text_byte(), text_codepoint(), text_getline() are for simple data access
Implemented: more or less all previous functionality
Implemented more proper file write:
file is saved to .swp, blocks are unloaded, file permissions are copied,
and atomic rename is called, block is reloaded
chmod some defaults(rw-rw-r--) if original file could not be fstat (does
not exist)
FIX make all tests pass
Removed: Some unused functions
|
|
Fixed delete last word test. (script should not have \n since it is
cursor down in vim)
Added tests to check inserts
Added tests to check yank and push
|
|
This only touches 24 of the 68 toys/posix/ files --- the others were
already canonical.
Potentially contentious, so worth stating explicitly, is that there
were 8 matches for "COMMAND..." amongst all existing help output,
with 7 matches for various inconsistent variants involving something
with "ARG", so I resolved that in favor of using "COMMAND..." (which
is also shorter overall, and avoids nested []s).
|
|
Found by GCC 9:
toys/lsb/mount.c:188:22: warning: '%s' directive argument is null [-Wformat-overflow=]
|
|
|
|
The tests now pass on all the systems available to me (cloud Android
with encrypted f2fs, current AOSP with regular f2fs, and current Debian
testing with ext4).
|
|
|
|
|
|
Document all the attributes, and take less space doing so.
Switch to CAPITALS for user input in the synopses.
Don't imply that this is only for ext2 (but also don't try to list the
subset of file systems that do support which subset of attributes).
|
|
Cope with all the extra flags added recently, and ignore random stuff
from the environment like extents and encryption.
Tested on a cloud Android emulator with f2fs.
|
|
|
|
My previous attempt to fix this worked for ext-with-extents on the
desktop, but not for f2fs-with-encryption on cloud Android devices.
This feels quite a bit cleaner, and has the benefit of actually working
everywhere I've tried it.
I've also added perfunctory testing of -p too, which was missing before.
|
|
(A git build takes it from "git describe".)
|
|
|
|
|
|
|
|
makes those two remaining tests pass.
|
|
|
|
I'm trying to switch Android over to toybox chattr/lsattr from
e2fsprogs. Remove those tests that relied on being able to use
chattr(1), remove the duplication that tested both a bare name and a
full path, take into account all the flags that lsattr can now output,
and cope with the fact that the exact flags you'll see depend on your
file system. (Unfortunately this means trusting lsattr in the lsattr
tests, which isn't ideal, but without a known environment I don't think
we can do any better.)
|
|
|
|
|
|
Test file integrity after load, move, delete and save+exit. Drawing
of buffer is not tested yet.
Added -s script option, accept file that is run as startup script of
commands. File is parsed byte at time and handled as you had typed it.
If EOF has been reached without editor close command, editing is
continued normally using keyboard. This functionality is in vim and
neovim, but not in POSIX vi standard. nvi (vi used in some macs) has
-s with different meaning...
Some simple tests added, dw last line test fails, so test is disabled.
|
|
The kernel script scripts/kconfig/merge_config.sh uses cp -T.
(Also sort the options into alphabetical order while adding -T, so that
eyeball binary search actually works when trying to find an option! Oddly,
they all show in reverse order because there's a bug in the help text
generator, but that's a problem for another day...)
|
|
A 5.4 kernel returns EINVAL rather than ENOBUFS when you try to
configure an IPv6 address with the MTU set too small to support IPv6.
Rather than check for both errors, just check for generic failure for
now.
|
|
Add support for setting projid in chattr, and dumping it in lsattr.
Also fix the lsattr output formatting, and undo my well-intentioned
sorting of the flags because that broke the ordering in the lsattr terse
output.
|
|
Also update help to include flags that were already added. Remove
useless duplicative comments. Swich to FLAG macros.
|
|
This isn't in POSIX, but Debian and macOS' cal(1)s both do this, and
it's annoying to have to run date(1) separately.
|
|
HERE document into an echo ala group. (It wasn't easily coerced into 80 columns
and having it be multiple echoes was about as ugly as the HERE document, so
I undid it again and missed a bit.)
|
|
|
|
fix: first line delete
fix: delete with e move
fix: statusline 1 row lower, remove eol
cleanup: use dlist_pop on delete
cleanup: move globals into GLOBALS
|
|
^D is the opposite of ^U in vi (the ^D/^U pair is the half-screen
version of ^F/^B). ^C is unbound in vi. It's pretty surprising for these
to cause toybox vi to exit, and it's annoying as long as toybox vi
unconditionally exits rather than checks whether there are unsaved
modifications!
(I'm tempted to implement ^D/^U and ^F/^B, but I don't want to make
Jarno's rebase of his in-progress changes any harder.)
|
|
|
|
used uninitalized" warning, move flow control character detection to the
right place, change scratch zeroing to the same way main() does it.
|
|
|
|
This is false on ILP32 targets with 64-bit time_t.
|
|
-w was added recently. The change in behavior so we now always fork
means that it's needed in more cases too: other implementations of
setsid(1) only fork if getpgrp() != getpid(). This broke a script, which
is what made me notice the missing help.
This seems to have been an accidental change, and is contrary to what
the util-linux setsid(1) man page says: "The command calls fork(2) if
already a process group leader. Otherwise, it executes a program
in the current process", but whether we change our behavior or not, we
should document the new option.
|
|
All of this was fine on LP64 where `long` and `long long` are the same
length, but breaks the LP32 build with -Wformat.
|
|
The epoch was being defined as UL, which is fine for LP64, but too small
on LP32 for what we're trying to do.
toys/net/sntp.c:60:32: warning: left shift count >= width of type
return ((tv.tv_sec+SEVENTIES)<<32)+(((long long)tv.tv_nsec)<<32)/1000000000;
^~
(Android doesn't use this, I'm just fixing this too while I fix the
LP64isms I introduced in readelf...)
|
|
The "historical" variant is still the only one in use on Android right
now. We still need to switch to the numbers we agreed on with the other
System V ABI users.
See https://groups.google.com/g/generic-abi/c/bX460iggiKg for the
original discussion on RELR.
|
|
|
|
|
|
mbtowc(0, 0, 4) is weird, and ignoring the result is weird. Avoid all
this by just reusing the toybox lib utf8 functions.
Also fix the row/column display on the status line to count from 1 and
correctly distinguish bytes and characters in non-ASCII, and change the
mode output to only explicitly say when we're in insert mode, in the
same way that vim does. (Every time I saw the old blue-on-black text for
COMMAND I thought toybox vi had crashed!)
|
|
bionic works around the fact that you can't use an O_PATH fd with
fgetxattr(2), but glibc doesn't.
Fixes https://github.com/landley/toybox/issues/158.
|
|
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.
|
|
|
|
|
|
|
|
|
|
Odd (and un-toyboxy) that we advertise the locale-specific output
formats but not the ISO ones :-)
|