2681 Commits

Author SHA1 Message Date
Rob Landley
ba185f6985 Add stat to index. 2017-10-22 11:52:32 -05:00
Rob Landley
d4c890c1f7 I ended up writing a new find from scratch, so remove old unfinished cleanup log. 2017-10-22 11:42:59 -05:00
Rob Landley
da07ae22d3 Typo. 2017-10-22 11:41:27 -05:00
Rob Landley
19ebdb7d87 Use char for exitval and wasroot (first capped at 8 bits and second's a flag). 2017-10-21 09:53:14 -05:00
Rob Landley
b5e405ce44 Use setlocale(LC_CTYPE, "C.UTF-8") for more targeted locale enable:
(only enable character parsing, force utf8, "C" semantics otherwise.)
2017-10-21 09:48:24 -05:00
Rob Landley
5af26a03df Elliott wants to add TOYBOX_VENDOR. 2017-10-19 16:49:52 -05:00
Elliott Hughes
b93630f5a1 Fix groups(1) and id -G.
Both should only output the groups.
2017-10-17 18:34:52 -05:00
Tom Cherry
11c385314a 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
2017-10-17 12:27:05 -05:00
Rob Landley
46d2cda500 Tweak help_exit() to show "See %s --help" message on the same line. 2017-10-10 18:16:08 -05:00
Rob Landley
3eb69d412e 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.
2017-10-10 11:24:11 -05:00
Rob Landley
7828920303 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.)
0.7.5
2017-10-03 03:29:38 -05:00
Elliott Hughes
b89af5ed5c 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
2017-10-01 16:55:06 -05:00
Elliott Hughes
b542295cd8 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
2017-09-25 13:24:58 -05:00
Rob Landley
eb95221609 Add #warning about musl intentionally breaking chrt. 2017-09-21 15:33:01 -05:00
Zach Riggle
d3e6814912 Fix URL typo 2017-09-16 11:53:49 -05:00
Rob Landley
f900298d79 Last commit used xstrtod(), forgot to check it in. 2017-09-09 22:05:10 -05:00
Rob Landley
7f2b0ceabd 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.
2017-09-09 21:35:19 -05:00
Rob Landley
5f6850fa5e Tighten up wc -m tests (which no longer depend on $LANG). 2017-09-06 06:12:09 -05:00
Rob Landley
b9613842c3 Replace remaining mb*towc() calls with utf8towc(). 2017-09-05 21:04:43 -05:00
Rob Landley
b3e70932b6 Tweak utf8towc() to return -1 earlier sometimes (instead of -2), and add test
program to compare against libc output.
2017-09-05 02:36:24 -05:00
Rob Landley
6e76693639 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.
2017-09-02 20:40:24 -05:00
Rob Landley
67ddade337 In wc, replace mbrtowc() with new utf8towc() which doesn't have a context struct
or care about locale.
2017-09-02 18:15:09 -05:00
Rob Landley
bebf14cc29 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.
2017-08-31 16:50:27 -05:00
Elliott Hughes
709a442464 Fix iconv build and add trivial test. 2017-08-23 02:21:54 -05:00
Rob Landley
138915a0d7 lsof cleanup. 2017-08-17 21:50:27 -05:00
Rob Landley
9bde245202 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.
2017-08-06 20:42:34 -05:00
Rob Landley
ec306e9244 Allow GITHASH to be set on the command line, to work around a yocto bug. 2017-08-05 20:12:57 -05:00
Elliott Hughes
94a898150d 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.)
2017-08-04 03:01:22 -05:00
Rob Landley
105595524e Test that our rm -rf can zap chmod 000 directories. (Skip test on host
because ubuntu's can't.)
2017-07-25 15:13:16 -05:00
Rob Landley
cd64fbd192 Add basic env.test 2017-07-23 14:32:27 -05:00
Rob Landley
6e2ef60264 testcmd should only use absolute path to command when not doing TEST_HOST. 2017-07-22 17:00:11 -05:00
Rob Landley
da230831ca Typo (env -0 was checking the flag wrong). 2017-07-22 16:44:00 -05:00
Josh Gao
67bf48c1cb netcat: make -l exit after handling a request.
Bug: http://b/62305466
2017-07-21 13:43:29 -05:00
Rob Landley
8d6d9bf4f1 typo 2017-07-17 05:37:05 -05:00
Rob Landley
e3993eb9ed Redo ping plumbing. Actual ping part isn't there yet because kernel weirdness. 2017-07-17 05:24:34 -05:00
Rob Landley
92b6026fa5 Split out xgetaddrinfo() from xconnect() 2017-07-17 05:23:45 -05:00
Rob Landley
d4adb3f8e2 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.
2017-07-11 05:17:35 -05:00
Rob Landley
58fea0ea98 comma_scan()'s clean option wasn't removing entry at end of list. 2017-07-11 05:16:09 -05:00
Rob Landley
d1e85b9c46 dd cleanup: binary search is overkill, eliminate struct pair,
simplify strstarteq, use local variable "conv" instead of toys.optargs.
2017-07-09 02:13:00 -05:00
Elliott Hughes
352efdf18d 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);
                         ~~^~   ~~~~~~~~~~~~~~~~~~~~~
2017-07-09 01:55:17 -05:00
Rob Landley
61d0115171 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.
2017-07-07 16:36:45 -05:00
Ilya Kuzmich
1ae3703a9f strings -t oxd tests 2017-07-07 16:27:56 -05:00
Rob Landley
a0e2e7d305 Make dd use atolx_range(), and teach atolx_range() about "w" suffix (word, *2). 2017-07-07 03:51:47 -05:00
Rob Landley
7450ecd568 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.)
2017-07-07 03:43:24 -05:00
Rob Landley
557ca7e55b Add -t, deviations from posix, redo loop to have fewer duplicate tests. 2017-07-02 21:39:32 -05:00
Ilya Kuzmich
24dfc14647 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>
2017-07-02 20:28:47 -05:00
Rob Landley
b8e0920c18 whitespace/comment tweaks. 2017-06-27 14:57:28 -05:00
Ilya Kuzmich
77997b8e77 teach head -c
Not POSIX, but implemented in coreutils, busybox and freebsd.
2017-06-27 14:55:29 -05:00
Rob Landley
f30035e88b 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.)
2017-06-26 15:32:27 -05:00
Rob Landley
279eb227c5 Past time for 0.7.4. 0.7.4 2017-06-19 12:34:50 -05:00