Age | Commit message (Collapse) | Author |
|
We're not going to USE_BLAH("a")"(longopt)" or similarly crazy corner cases,
so don't try to support them.
|
|
|
|
From RFC 768, if UDP packet checksum computation yields a result of
zero, change it to hex 0xFFFF. The current udhcpc checksum verification
would yield false positive for this case. A better way is to compute the
checksum with the original checksum field and the result should be zero
for good udp packet.
Signed-off-by: Yangchun Fu <yangchun@google.com>
|
|
|
|
|
|
Internally, Google uses all the longopts; Android currently only uses
this one. I was tempted to add the others, but went with "add them when a
toybox user needs them" rather than "add them when you've seen them used".
|
|
Annoyingly coreutils and busybox both have the --status functionality,
but coreutils only accepts --status and busybox only accepts -s. Although
all extant users known to me use --status I've supported both (a) for
maximum compatibility and (b) because Rob hates longopts :-)
Also, -c/--check don't take argument(s): they alter the interpretation
of all the FILE... arguments.
I removed a bunch of dead code here, but I couldn't switch us over to
loopfiles_lines because I didn't want to regress on the "warn if any
check file contains no hashes", and loopfiles_lines doesn't give you
any way to recognize that you've moved on to the next file.
|
|
|
|
|
|
|
|
This (eventually) lets "ps ax" and "ps -ax" behave differently.
|
|
Handling -e by gluing together multiple regexes with | wasn't portable,
break down and do a linked list with for loops.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When necessary, realloc() the line to add 4 aligned bytes of storage at
the end, stick the unsigned offset in there, and then fish it back out for
display (and add 1 because offset is 0 based and display is 1 based).
|
|
|
|
Several parameters common on Linux are missing on macOS.
|
|
Hopefully they'll fix this properly at some point, but until then...
|
|
|
|
|
|
|
|
|
|
|
|
Be consistent about upper versus lower case. (Upper seems to have the
majority, so I went with that, though I'm happy to provide the opposite
patch as long as we're consistent!)
Be consistent about using \t. (Though saving a few bytes seems like it
might be better done in the code that generates help.h rather than
directly in the source, since tabs make careful ASCII art layout hard
enough that we regularly have things misaligned.)
Remove trailing periods (most of which seem to have been added by me).
Always use the US "human readable" rather than my British
"human-readable", and be more consistent about declaring whether we're
showing multiples of 1000 or 1024.
Just say "verbose" rather than adding a useless "mode" or "output".
|
|
I think this was the preferred option for this code that turns out
to be very different on Linux vs BSD. I don't yet have a BSD
implementation, and I'm not likely to have chance to work on one
in the near future, so this just #ifdefs it out for macOS right
now.
With this (and a suitably minimal .config), toybox builds for macOS
out of the box.
|
|
I realized (after being questioned about my motivation) that I hadn't
added a test for the -u behavior. Adding the missing test confirmed the
usual "if there isn't a test, the code is broken", but now I think I
actually understand how we're supposed to choose between DIR, $TMPDIR,
and /tmp. I've added more tests to back this up, and rewritten the code
one more time so that we pass all the tests.
|
|
|
|
|
|
|
|
Old versions of glibc had warn_unused_result on mktemp(3), despite it
always returning its argument. Still, we can silence the warning and
save a line, so...
|
|
|
|
|
|
|
|
|
|
These were added in macOS 10.7 in 2011-07, so the seven year rule applies...
|
|
Don't hard-code Linux's buffer size.
|
|
|
|
|
|
|
|
Even if we don't build ps, we can't have a Linux-only struct in GLOBALS.
The obvious alternative to this would be to have a fake struct sysinfo
in lib/portability.h. Since having a real macOS replacement for
sysinfo(2) seems unlikely at this point, I went this route instead.
|
|
I've also flipped the `#if` because `#ifdef` feels more naturally readable
than #ifndef when there's also a `#else`.
(I've preserved the oddness of the clearenv declaration being here,
because there isn't currently a more suitable `#ifdef __APPLE__` to move
it too. Later...)
|
|
|
|
|
|
The only part of this I actually need for macOS is to remove __APPLE__
from the getdelim/getline workaround, but if we're following the usual
"seven year rule", glibc 2.10 is dead to us anyway, and we should just
remove all of this.
|
|
The new tests pass on the host (coreutils 8.28) and with toybox after
this patch is applied.
|