Age | Commit message (Collapse) | Author |
|
--quiet is used 3x more than --silent in my corpus, but they're both
used surprisingly often. (Surprising to someone who thinks -q is part of
the core set of grep options that "everybody knows".)
|
|
Linux has more states than we were giving it credit for, which led to
our numbers not adding up. Since the exact details seem to change
between versions, and since having code specific to each kernel version
is unattractive, go with the heuristic that there are relatively fewer
"stopped" states (and they change less frequently), so all unknowns are
"sleeping".
|
|
|
|
|
|
This also makes everything more readable by separating out the -b no
formatting case.
The whitespace trimming for -b isn't strictly necessary, but it looks
weird if we output unnecessary spaces at the end of the line in -b mode,
and we've fixed it before, so let's not regress here. It also seems more
logical to do this in the one place where it actually happens.
|
|
|
|
|
|
Both refresh the display in the traditional implementation.
|
|
Even phones have enough RAM these days that KiB is not a reasonable
unit. Traditional top always uses MiB instead of always using KiB, but
we may as well just let human_readable pick a unit (that way if KiB is
reasonable on your box, that's what you'll get).
Before:
Tasks: 967 total, 1 running, 581 sleeping, 0 stopped, 0 zombie
Mem: 196734820k total,183891564k used, 12843256k free, 5805008k buffers
Swap:199888892k total, 719104k used,199169788k free,130367280k cached
After:
Tasks: 965 total, 2 running, 577 sleeping, 0 stopped, 0 zombie
Mem: 188G total, 175G used, 13G free, 5.5G buffers
Swap: 191G total, 702M used, 190G free, 124G cached
|
|
Matches traditional top.
|
|
Plus new tests.
|
|
Very few places actually check for errors from emit, and I actually see
the same endless loop from "sed (GNU sed) 4.4" on current Debian, so I'm
not sure this isn't Broken As Designed, but an endless loop spewing
"short write" (or saying nothing, in the case of GNU sed) really doesn't
feel like useful behavior in face of EPIPE, which really isn't going to
fix itself. Certainly not being able to run the sed tests to completion
is pretty annoying --- which is why, unless we remove this test as
invalid, we should probably also add a SKIP_HOST=1 to the "b loop" test.
Note that even with this fix you'll see the error twice:
sed: short write: Broken pipe
sed: short write: Broken pipe
Once from the first = command to fail, and then another from the !FLAG(n)
flush of the pattern space.
|
|
The test for \N where N was larger than the number of capturing groups
in the regular expression was incorrect, and firing for cases such as
matching __(ARM_)?NR_([a-z]*) against __NR_read, where the first group is
empty (because it failed to match) but the second group did match "read".
Use regex_t's re_nsub for the error check, and treat rm_so == -1 as a
signal to just copy nothing into the result.
(Found trying to build minijail in AOSP.)
|
|
Add support for more input formats, primarily the ISO formats used by
the AOSP build.
I've improved/added to the tests a bit to cover these changes, and to
explain the reasons for the various remaining test failures (none of
which are regressions caused by this patch).
|
|
|
|
Bug: http://b/123902291
|
|
Also add a TODO for the (undocumented, half-finished) -a option.
|
|
|
|
|
|
into display function, use unsigned length so output lines can be up to 4g each.
|
|
I accidentally added a tab in xargs.c, so as penance I'll clean up all
the tabs.
|
|
If table grows >64 entries XX needs to change, but it can't be 128 yet
because the slot value is a signed char. Currently 59 entries in table...
|
|
Implement -p, -t, and -r.
Add some missing tests.
Move -L and -x back to TODO since they're not implemented and I haven't
yet even understood what they're supposed to do.
|
|
|
|
Patch dates are optional these days, and I should properly work back from the
end and only peel off properly formatted tab+date, but "tab followed by
digit" is probably good enough and nobody's ever complained about just tab.
And we still don't support patching filenames with newlines in them...)
|
|
|
|
Used to construct SELinux policies in the AOSP build.
I left loopfiles_lines with its hard-coded '\n' because although cut(1)
also has a -z option, I can't find any case where it's used in any of
the codebases searchable by me. (And fmt(1), the other user, doesn't
even have the option.) YAGNI.
Bug: http://b/122744241
|
|
|
|
For a definition of "fix" that's even _more_ of a deviation from posix, but
matches what debian does...
|
|
Used by AOSP build.
Also switch to new FLAG macro.
Bug: http://b/122739027
|
|
|
|
It's in the Linux 4.20 kernel headers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
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".
|
|
|
|
|