Commit Graph

23 Commits

Author SHA1 Message Date
eadler
78480951cf top(1): Use warnx and errx instead of fprintf
This also makes make "-v" exit without error, since it isn't.
2018-08-22 10:07:15 +00:00
daichi
e550e6b727 top(1): fixed the empty output problem in non-interactive mode (-n, -b) regressed in r336028
PR:		229842
Reported by:	Ali Abdallah <aliovx@gmail.com>
Reviewed by:	eadler, cy
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16455
2018-07-27 01:20:34 +00:00
daichi
da197b8aac Changed to eliminate the upper limit of command length displayed
by "-a" and expand to match terminal width

Reviewed by:	eadler
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16083
2018-07-06 12:07:06 +00:00
eadler
1cba05ee8f top(1): remove special handling of load > 5
When the load is "high" (an arbitrary value) top(1) previously moved the
cursor to the top-left of the screen as an acknowledgment. In practice,
on modern machines, even relatively slow ones, it looked more like a
glitch. Remove the logic.
2018-06-22 09:45:18 +00:00
eadler
5246c095ce top(1): move command mapping to commands.c
This eliminates the difficult to follow mapping of a string list. It
moves numbers from "#define" into (more) debuggable enums. More
generally, it follows the trend of moving more data into a more central
mechanism.

The help output is a little worse: " " is not rendered well, and there
are duplicate entries, but that will be fixed in a followup.
2018-06-12 06:53:31 +00:00
eadler
7f99483fb2 top(1): Fix two speeling errors I introduced 2018-06-02 22:12:57 +00:00
eadler
0296b74c55 top(1): cleanup memory allocation and warnings
- Prefer calloc over malloc. This is more predicable and we're not in a
performance sensitive context. [1]
- Remove bogus comment (obsolete from prior commit). [2]
- Remove void casts and type casts of NULL
- Remove redundant declaration of 'quit'
- Add additional const

Reported by:	kib [1], vangyzen [2]
2018-06-02 21:40:45 +00:00
eadler
a8efb181f4 top(1): remove wrapper around putchar
This appears to have been written for portability which we no longer
need.
2018-06-02 07:44:53 +00:00
eadler
dfdbe4a30f top(1): clean up a bit
- remove unused defines
- use standard defines for STDOUT
- don't cast for memset
- avoid using (void) cast
2018-06-02 04:20:42 +00:00
eadler
d08be95677 top(1): Use uid_t for uid rather than 'int'
Remove unneeded define while here.
2018-06-02 03:54:50 +00:00
eadler
28565af2eb top(1): Use standard boolean rather than homegrown alternative 2018-06-02 03:25:15 +00:00
eadler
72a0a627b4 top(1): ansify, style(9). and nits
- Prefer using ansi prototypes rather than C prototypes
- Keep type on separate line from name of function
- Try to keep things const where possible. This will help get to WARNS=6
- switch to "bool" where it makes sense
2018-06-02 00:02:15 +00:00
eadler
23c360e23f top(1): modernize a bit; reduce warnings
- Replace caddr_t with "void *". This reduces
the number of warnings at WARNS=6
- use "static" where possible
- sprinkle const where possible

This leaves at WARNS=6:
35 warnings in top.c
88 warnings in machine.c
7 warnings in commands.c

all of which are either "incompatible-pointer-types-discards-qualifiers"
or "cast-qual"
2018-05-21 09:25:21 +00:00
eadler
aa50e2b923 Revert r333969 which contained one too many changes 2018-05-21 09:20:26 +00:00
eadler
be108636cd top(1): modernize a bit; reduce warnings
- Replace caddr_t with "void *". This reduces
the number of warnings at WARNS=6
- use "static" where possible
- sprinkle const where possible

This leaves at WARNS=6:
35 warnings in top.c
72 warnings in machine.c
5 warnings in commands.c

all of which are either "incompatible-pointer-types-discards-qualifiers"
or "cast-qual"
2018-05-21 09:18:01 +00:00
eadler
d2a857bf67 top(1): fix several more warnings 2018-05-21 03:36:16 +00:00
eadler
7f19e623fc top(1): clean much of WARNS=3 issues
There is still one glaring issue: new_message is not a protoype, but
can't be trivially converted since it uses K&R style var-args.
2018-05-21 00:53:42 +00:00
eadler
57dddde81f top(1): build with WARN=2 2018-05-21 00:32:48 +00:00
eadler
110b1a5330 top(1): unconditionally assume we are on FreeBSD (more unifdef)
Now that we're our own upstream, remove useless ifdefs.
2018-05-20 18:11:58 +00:00
eadler
01c70bcb4c Retry revert
I had a local modification before my revert. Try reverting one more time.
2018-05-20 18:03:40 +00:00
eadler
0dbbba9b1a revert r333928
I had missed a file when testing this, and it does not build. Will try again.
2018-05-20 18:02:40 +00:00
eadler
1a493866e2 top(1): unconditionally assume we are running on FreeBSD
This allows us to remove a special header and more specifically just the
system headers we want.
2018-05-19 23:19:24 +00:00
eadler
2ddbba1d82 top(1): Migrate top to usr.bin
We've been maintaining top(1) for a long time, and the upstream
hasn't existed/been used in similarly as long. Make it clear that we own
top(1)

Tested with 'make universe'. Everything passed except MIPS which failed
for unrelated reasons. Install also tested for amd64.

Reviewed by:		sbruno
No objections:		imp, mmacy
Differential Revision:	https://reviews.freebsd.org/D15387
2018-05-19 22:40:23 +00:00