OSDN Git Service
Rob Landley [Wed, 3 Jan 2018 18:53:46 +0000 (12:53 -0600)]
Cleanup pass on gzip.c.
Rob Landley [Mon, 1 Jan 2018 22:32:13 +0000 (16:32 -0600)]
Promote logger, and fluff up help text a bit.
Rob Landley [Mon, 1 Jan 2018 22:25:18 +0000 (16:25 -0600)]
Cleanup logger.c, and move the facilitynames/prioritynames SYSLOG_NAMES
stuff syslog.h does into lib.c and portability.h
Rob Landley [Mon, 1 Jan 2018 17:24:48 +0000 (11:24 -0600)]
xphung on github said: "config2help currently doesn't work on OS X, it
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()"
Rob Landley [Fri, 29 Dec 2017 23:19:02 +0000 (17:19 -0600)]
Promote iconv.
Rob Landley [Fri, 29 Dec 2017 22:43:38 +0000 (16:43 -0600)]
Cleanup iconv.
Implement -c, fix endless loop when illegal char happens with
!outleft (don't need to check errno, just in == toybuf), refill
buffer each time (less efficient handling of illegal chars but never
have to worry about how long constitutes a valid sequence in unknown
encoding).
Fix input longer than 2k (memmove() has src/dest switched, second time through
loop in starts at offset inleft...) Made it start at beginning every time.
Switch iconv_open() error msg to show to/from and errno (rather than
hardwired english text).
Rob Landley [Wed, 27 Dec 2017 17:23:43 +0000 (11:23 -0600)]
Promote setfattr
Rob Landley [Wed, 27 Dec 2017 17:21:21 +0000 (11:21 -0600)]
Minor cleanup on setfattr.c
Elliott Hughes [Sun, 24 Dec 2017 08:42:38 +0000 (00:42 -0800)]
Add xxd -i (and xxd -ri).
The original xxd doesn't support -r with -i. The original also outputs
"unsigned char name[] = { ... };" for input other than stdin, but that
actually makes it less useful --- many languages support array
initializers, but far fewer support that exact declaration syntax.
Also fix the -c range checking and defaulting: ><= in the argument string
only works for floating point arguments.
Bug: http://b/
64711851
Elliott Hughes [Tue, 26 Dec 2017 05:24:57 +0000 (21:24 -0800)]
Fix xargs -0 with -n.
Also make -0 and -E mutually exclusive (rather than just ignore -E
with -0).
Bug: https://github.com/landley/toybox/issues/78
Elliott Hughes [Sun, 24 Dec 2017 07:44:04 +0000 (23:44 -0800)]
Add fmt.
A very simple implementation of fmt, good enough for my daily use of !!fmt
in vi to reflow checkin comments like this.
Rob Landley [Fri, 22 Dec 2017 20:56:37 +0000 (14:56 -0600)]
Redo namestopid to handle more cases.
Rob Landley [Tue, 19 Dec 2017 22:16:31 +0000 (16:16 -0600)]
Fix make bloatcheck dependencies (pointed out by Patrick Oppenlander).
Elliott Hughes [Wed, 13 Dec 2017 19:47:08 +0000 (11:47 -0800)]
killall should kill scripts too.
Found running LTP file system tests on Android.
Bug: http://b/
70627145
Rob Landley [Mon, 11 Dec 2017 13:19:37 +0000 (07:19 -0600)]
An incomplete list of deviations from posix (it's a start).
Rob Landley [Sun, 10 Dec 2017 20:12:19 +0000 (14:12 -0600)]
Cleanup pass on stty: collate do_stty() calls for future inlining,
collapse flag arrays to fewer lines, factor out xtcgetattr(),
strip curly brackets around single lines, don't have a separate error
message for tcsetattr() return code if more thorough check is on next line,
take advantage of O_RDONLY being zero, document -F.
Elliott Hughes [Mon, 4 Dec 2017 20:31:53 +0000 (12:31 -0800)]
Use NULL rather than 0 in vargs.
Top bits count too!
Rob Landley [Sun, 3 Dec 2017 07:30:39 +0000 (01:30 -0600)]
Commands in pending should default n.
Elliott Hughes [Sat, 2 Dec 2017 06:43:38 +0000 (22:43 -0800)]
Add stty(1).
Full POSIX stty with Linux extensions. Output and behavior match coreutils
8.26 as far as I can tell. For some reason busybox 1.22 stty always
shows all the special characters, even when they match "sane". I've
matched coreutils, since "shows differences from sane" is easy to describe
and obviously useful.
Flags in the various arrays are not in the order they're introduced in
POSIX or in the Linux header file: they're in the order that they're
output by coreutils' stty.
The -g output matches coreutils and busybox.
I implemented iuclc, xcase, and olcuc even though they've been removed
from POSIX because the others implement them, and "man stty" defines "raw"
and "sane" in terms of them (where POSIX doesn't define "sane" in any
useful sense).
This builds fine against glibc 2.24, and as far as I can tell all the
constants used were in Linux 2.6 so I'm assuming that there shouldn't
be any #ifdef nonsense needed for any reasonable vintage of C library.
Elliott Hughes [Fri, 17 Nov 2017 00:16:12 +0000 (16:16 -0800)]
Don't capitalize in the middle of a sentence.
Before:
toy: Unknown option p (See "toy --help")
After:
toy: Unknown option p (see "toy --help")
Elliott Hughes [Fri, 17 Nov 2017 00:35:10 +0000 (16:35 -0800)]
Add uptime -p.
We (Android) give up trying to teach folks what "up 142 days, 1:45"
means...
Bug: http://b/
65205261
Rob Landley [Sun, 3 Dec 2017 07:20:42 +0000 (01:20 -0600)]
Gaël PORTAY wants mdev to work when Linux has the block layer configured out.
Rob Landley [Sun, 3 Dec 2017 03:18:52 +0000 (21:18 -0600)]
Android has its loop devices under "block" as Elliott says "by reason of
historical accident", so fall back to check there.
Also remove an obsolete comment TODO block, check !parent for dirtree
top of tree instead of '/' in the filename, and typecast some printf
arguments for 32-bit systems.
Rob Landley [Mon, 27 Nov 2017 05:40:20 +0000 (23:40 -0600)]
Recognize sh/frv fdpic, and add types for bpf and new microblaze.
Rob Landley [Sun, 26 Nov 2017 11:33:35 +0000 (05:33 -0600)]
Use endianness info to read executable type.
Elliott Hughes [Fri, 17 Nov 2017 20:10:36 +0000 (12:10 -0800)]
Add "time -v".
This shows the other fields in getrusage. I've chosen to only show the
ones actually maintained by Linux.
Elliott Hughes [Thu, 16 Nov 2017 21:59:37 +0000 (13:59 -0800)]
Make find -exec + obey ARG_MAX just like xargs.
This isn't ideal, but it matches xargs and none of us is likely to have
time to do the best possible thing any time soon.
Bug: http://b/
65818597
Test: ./toybox find /usr/local/google/ndkports/ -exec echo {} +
Rob Landley [Fri, 17 Nov 2017 03:04:31 +0000 (21:04 -0600)]
Minor tweaks.
Elliott Hughes [Wed, 15 Nov 2017 21:06:17 +0000 (13:06 -0800)]
Add "df -i".
Also switch to u64 for calculations. Some FUSE file systems have inode
counts large enough to overflow s64.
Elliott Hughes [Wed, 1 Nov 2017 18:09:42 +0000 (11:09 -0700)]
file(1): add ogg, TrueType font, LLVM bitcode, PEM certs, and PE executables.
More of the files encountered on the Android system image (plus PE
executables, which we build but which shouldn't actually make it to the
system image!).
Rob Landley [Wed, 1 Nov 2017 00:44:32 +0000 (19:44 -0500)]
Add top -m, fix width truncating for narrow screens (off by one), and add iotop -H
Rob Landley [Tue, 31 Oct 2017 20:51:02 +0000 (15:51 -0500)]
Rename test_*.c to demo_*.c (because "make test_$CMD" means something already),
fluff out README, and add a comment to hostid explaining its deprecation.
Rob Landley [Tue, 31 Oct 2017 20:43:38 +0000 (15:43 -0500)]
Only show LABEL= when there is one.
Rob Landley [Tue, 31 Oct 2017 20:30:04 +0000 (15:30 -0500)]
Fix cut -s and -f when delimiter not found (posix says print whole line).
Rob Landley [Sat, 28 Oct 2017 08:26:33 +0000 (03:26 -0500)]
Web page updates.
Rob Landley [Thu, 26 Oct 2017 01:27:33 +0000 (20:27 -0500)]
Make -c work with unicode chars, and first stab at -C measuring columns.
Rob Landley [Sun, 22 Oct 2017 18:36:02 +0000 (13:36 -0500)]
Insmod dummy for ifconfig tests, and "pointopoint" only has two t's.
Rob Landley [Sun, 22 Oct 2017 16:52:32 +0000 (11:52 -0500)]
Add stat to index.
Rob Landley [Sun, 22 Oct 2017 16:42:59 +0000 (11:42 -0500)]
I ended up writing a new find from scratch, so remove old unfinished cleanup log.
Rob Landley [Sun, 22 Oct 2017 16:41:27 +0000 (11:41 -0500)]
Typo.
Rob Landley [Sat, 21 Oct 2017 14:53:14 +0000 (09:53 -0500)]
Use char for exitval and wasroot (first capped at 8 bits and second's a flag).
Rob Landley [Sat, 21 Oct 2017 14:48:24 +0000 (09:48 -0500)]
Use setlocale(LC_CTYPE, "C.UTF-8") for more targeted locale enable:
(only enable character parsing, force utf8, "C" semantics otherwise.)
Rob Landley [Thu, 19 Oct 2017 21:49:52 +0000 (16:49 -0500)]
Elliott wants to add TOYBOX_VENDOR.
Elliott Hughes [Fri, 29 Sep 2017 22:20:26 +0000 (15:20 -0700)]
Fix groups(1) and id -G.
Both should only output the groups.
Tom Cherry [Thu, 12 Oct 2017 16:43:32 +0000 (09:43 -0700)]
Allow ro. properties to have arbitrary lengths
Android now allows ro. properties to have arbitrary lengths. Two
changes need to happen to support this:
1) The length check in setprop.c before attempting to set a property
needs to be removed for ro. properties
2) __system_property_read_callback() must be used in place of
__system_property_get() in getprop.c as only the former is capable
of reading properties with size > 92 characters.
Bug:
23102347
Bug:
34954705
Change-Id: Ib8565a3e6d987dd5e6a5fe790e804ecf8ad1e020
Rob Landley [Tue, 10 Oct 2017 23:16:08 +0000 (18:16 -0500)]
Tweak help_exit() to show "See %s --help" message on the same line.
Rob Landley [Tue, 10 Oct 2017 16:24:11 +0000 (11:24 -0500)]
Complete rewrite of cut. Handle multipe ranges, add -DFO options, start
of utf8 support (not finished yet)...
Adds new loopfiles_lines() wrapper to lib.c that calls do_lines from loopfiles.
Rob Landley [Tue, 3 Oct 2017 08:29:38 +0000 (03:29 -0500)]
Workaround from Patrick Oppenlander for a bug in config2help.h that resulted
in segfaults on newer toolchains. (That entire section is due for a rewrite.)
Elliott Hughes [Wed, 20 Sep 2017 20:53:23 +0000 (13:53 -0700)]
Fix xargs to obey POSIX's ARG_MAX restrictions.
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
Elliott Hughes [Mon, 25 Sep 2017 16:59:48 +0000 (09:59 -0700)]
Basic Mach-O support in file(1).
The Nexus Player build was subtly broken in that it assumed that the host was
using ELF. No-one noticed until a Mac user tried to flash their build, which
contained a Mach-O x86 binary instead of an ELF x86 binary. Hilarity ensued.
(On the same day, file(1) was able to explain a mixup with an ELF hexagon
binary. Next time we see a Mach-O binary on an Android device, we'll be ready!)
Bug: http://b/
66741960
Rob Landley [Thu, 21 Sep 2017 20:33:01 +0000 (15:33 -0500)]
Add #warning about musl intentionally breaking chrt.
Zach Riggle [Wed, 13 Sep 2017 17:15:45 +0000 (12:15 -0500)]
Fix URL typo
Rob Landley [Sun, 10 Sep 2017 03:05:10 +0000 (22:05 -0500)]
Last commit used xstrtod(), forgot to check it in.
Rob Landley [Sun, 10 Sep 2017 02:35:19 +0000 (21:35 -0500)]
Redo/add seq precision logic.
Josh Gao hit a case where "seq
1000000 1000001" output 1e+06, and while he
was there changed several things to work like existing seq implementations.
I changed a couple back (commenting out the test cases) until somebody
came come up with a reason (or existing use case) to do it that way.
Rob Landley [Wed, 6 Sep 2017 11:12:09 +0000 (06:12 -0500)]
Tighten up wc -m tests (which no longer depend on $LANG).
Rob Landley [Wed, 6 Sep 2017 02:04:43 +0000 (21:04 -0500)]
Replace remaining mb*towc() calls with utf8towc().
Rob Landley [Tue, 5 Sep 2017 07:36:24 +0000 (02:36 -0500)]
Tweak utf8towc() to return -1 earlier sometimes (instead of -2), and add test
program to compare against libc output.
Rob Landley [Sun, 3 Sep 2017 01:40:24 +0000 (20:40 -0500)]
utf8towc() has to be in lib.c if strlower() is going to use it, because
scripts/*.c builds against lib.c but not linestack.c.
Rob Landley [Sat, 2 Sep 2017 23:15:09 +0000 (18:15 -0500)]
In wc, replace mbrtowc() with new utf8towc() which doesn't have a context struct
or care about locale.
Rob Landley [Thu, 31 Aug 2017 21:50:27 +0000 (16:50 -0500)]
Another try at fixing the ps segfault resulting from /proc entries vanishing
out from under us due to asyncronous process exit.
The directory we're traversing vanishing can result in DIRTREE_ABORTVAL
being returned, which we turn into a NUL entry, but then we were trying to
look at that null entry's children. Oops.
Elliott Hughes [Tue, 22 Aug 2017 21:03:45 +0000 (14:03 -0700)]
Fix iconv build and add trivial test.
Rob Landley [Fri, 18 Aug 2017 02:50:27 +0000 (21:50 -0500)]
lsof cleanup.
Rob Landley [Mon, 7 Aug 2017 01:42:34 +0000 (20:42 -0500)]
Check for .git before setting GITHASH.
The GITHASH problem was building a tarball version under an existing git repo,
where git describe found ../../../../.git so only call git if we have a .git
directory in the source.
Rob Landley [Sun, 6 Aug 2017 01:12:57 +0000 (20:12 -0500)]
Allow GITHASH to be set on the command line, to work around a yocto bug.
Elliott Hughes [Fri, 4 Aug 2017 00:13:20 +0000 (17:13 -0700)]
Don't unnecessarily use printf in wc.test when echo will do.
(And is much faster if your shell doesn't have a builtin printf.)
Rob Landley [Tue, 25 Jul 2017 20:13:16 +0000 (15:13 -0500)]
Test that our rm -rf can zap chmod 000 directories. (Skip test on host
because ubuntu's can't.)
Rob Landley [Sun, 23 Jul 2017 19:32:27 +0000 (14:32 -0500)]
Add basic env.test
Rob Landley [Sat, 22 Jul 2017 22:00:11 +0000 (17:00 -0500)]
testcmd should only use absolute path to command when not doing TEST_HOST.
Rob Landley [Sat, 22 Jul 2017 21:44:00 +0000 (16:44 -0500)]
Typo (env -0 was checking the flag wrong).
Josh Gao [Fri, 9 Jun 2017 17:51:18 +0000 (10:51 -0700)]
netcat: make -l exit after handling a request.
Bug: http://b/
62305466
Rob Landley [Mon, 17 Jul 2017 10:37:05 +0000 (05:37 -0500)]
typo
Rob Landley [Mon, 17 Jul 2017 10:24:34 +0000 (05:24 -0500)]
Redo ping plumbing. Actual ping part isn't there yet because kernel weirdness.
Rob Landley [Mon, 17 Jul 2017 10:23:45 +0000 (05:23 -0500)]
Split out xgetaddrinfo() from xconnect()
Rob Landley [Tue, 11 Jul 2017 10:17:35 +0000 (05:17 -0500)]
Don't remove "remount" from the option list during early parsing, the mount
flag doesn't get set right otherwise and it tries to overmount instead.
Rob Landley [Tue, 11 Jul 2017 10:16:09 +0000 (05:16 -0500)]
comma_scan()'s clean option wasn't removing entry at end of list.
Rob Landley [Sun, 9 Jul 2017 07:13:00 +0000 (02:13 -0500)]
dd cleanup: binary search is overkill, eliminate struct pair,
simplify strstarteq, use local variable "conv" instead of toys.optargs.
Elliott Hughes [Fri, 7 Jul 2017 20:06:36 +0000 (13:06 -0700)]
Fix -Wformat compiler warning in expr.c.
Android forces -Wformat on for all source.
toys/pending/expr.c:116:28: warning: field precision should have type 'int',
but argument has type 'long' [-Wformat]
ret->s = xmprintf("%.*s", m[1].rm_eo-m[1].rm_so, target+m[1].rm_so);
~~^~ ~~~~~~~~~~~~~~~~~~~~~
Rob Landley [Fri, 7 Jul 2017 21:36:45 +0000 (16:36 -0500)]
Posix says strings should only output hits that end with NUL or newline.
We don't currently do that, but a test suite checking that we don't
do that is requiring us to violate posix to pass it.
Ilya Kuzmich [Mon, 29 May 2017 14:57:09 +0000 (17:57 +0300)]
strings -t oxd tests
Rob Landley [Fri, 7 Jul 2017 08:51:47 +0000 (03:51 -0500)]
Make dd use atolx_range(), and teach atolx_range() about "w" suffix (word, *2).
Rob Landley [Fri, 7 Jul 2017 08:43:24 +0000 (03:43 -0500)]
Fix dd tests so TEST_HOST passes. (Ubuntu's dd doesn't support hex values
and don't expect a specific error message, just that it errored.)
Rob Landley [Mon, 3 Jul 2017 02:39:32 +0000 (21:39 -0500)]
Add -t, deviations from posix, redo loop to have fewer duplicate tests.
Ilya Kuzmich [Mon, 29 May 2017 04:05:16 +0000 (07:05 +0300)]
strings tests and bugfixes
Fixes missing newline in output if last byte of the input is string.
Fixes one-off offset bug.
Adds strings tests.
Signed-off-by: Ilya Kuzmich <ilya.kuzmich@gmail.com>
Rob Landley [Tue, 27 Jun 2017 19:57:28 +0000 (14:57 -0500)]
whitespace/comment tweaks.
Ilya Kuzmich [Sun, 28 May 2017 15:29:19 +0000 (18:29 +0300)]
teach head -c
Not POSIX, but implemented in coreutils, busybox and freebsd.
Rob Landley [Mon, 26 Jun 2017 20:32:27 +0000 (15:32 -0500)]
Most things seem to want the "b" suffix to mean 512 instead of 1.
(According to the git history I added "b" for "od" but the man page says 512
there too.)
Rob Landley [Mon, 19 Jun 2017 17:34:50 +0000 (12:34 -0500)]
Past time for 0.7.4.
Rob Landley [Mon, 19 Jun 2017 12:51:58 +0000 (07:51 -0500)]
Manually inline TOP_COMMON and PGKILL_COMMON help text until I can teach
the help infrastructure to handle it.
(The lifetime rules are all wrong for hunks that get reused. Needs a largeish
rewrite.)
Rob Landley [Wed, 14 Jun 2017 16:23:01 +0000 (11:23 -0500)]
Grep exits with 2 for errors, which can happen at any time ( > /dev/full).
Rob Landley [Tue, 13 Jun 2017 21:33:13 +0000 (16:33 -0500)]
config2help.c: Rename trim() to skip_spaces(), fluff out comments a bit.
Rob Landley [Mon, 12 Jun 2017 16:26:07 +0000 (11:26 -0500)]
Add grep -M match and -S skip supporting wildcard patterns.
They don't imply -r because you might do find . -type f | xargs -S blah regex
Rob Landley [Sun, 11 Jun 2017 20:39:03 +0000 (15:39 -0500)]
Twitter's code of conduct page went down, so mirror the old archive.org version.
Move link from README to header.html menu bar.
Rob Landley [Sun, 11 Jun 2017 17:23:00 +0000 (12:23 -0500)]
Provide error messages for files we can open but not read (ala directories).
Rob Landley [Sat, 10 Jun 2017 18:17:31 +0000 (13:17 -0500)]
Fix bug where grep stopped at first dangling symlink and error_exited().
Rob Landley [Fri, 9 Jun 2017 20:01:07 +0000 (15:01 -0500)]
Promote dmesg back to lsb.
Rob Landley [Fri, 9 Jun 2017 19:59:51 +0000 (14:59 -0500)]
Cleanup dmesg (as posted to the list).
Rob Landley [Tue, 6 Jun 2017 18:21:03 +0000 (13:21 -0500)]
Add comment explaining strend()
Rob Landley [Tue, 6 Jun 2017 02:22:02 +0000 (21:22 -0500)]
Have help_exit() give a brief "See %s --help" message instead of the
full help text, and put it back in the args constraint failures.
Rob Landley [Sun, 4 Jun 2017 18:15:51 +0000 (13:15 -0500)]
Don't add cpio TRAILER!!! entry by default, add new --trailer option if you
want that. (This lets you concatenate cpio archives with "cat". Kernel's
initramfs extractor doesn't need it.)
Elliott Hughes [Wed, 31 May 2017 18:01:11 +0000 (11:01 -0700)]
Allow ':' in property names.
Bug: http://b/
62114389
Test: setprop
Change-Id: I165bcc01bb2422d991f746c5e6490cbdfb74472f