[PATCH] top(1) inverse display of table header

Anonymous swell.k at gmail.com
Wed Nov 17 07:27:00 UTC 2010


Xin LI <delphij at delphij.net> writes:

> Hi,
>
> Here is a patch that makes top(1) to inverse its table header (PID
> USERNAME THR, etc).
>

That MAX_COLS change in it makes `top -b' produce too much extra
whitespace that's not trimmed and spans several lines, e.g.

  $ stty -a | sed 1q
  speed 38400 baud; 57 rows; 79 columns;
  $ top -b
  last pid: 54799;  load averages:  1.90,  2.16,  2.16  up 0+04:28:34    10:18:15
  91 processes:  4 running, 85 sleeping, 2 stopped

  Mem: 540M Active, 243M Inact, 2934M Wired, 79M Cache, 417M Buf, 136M Free
  Swap: 4097M Total, 8856K Used, 4088M Free


    PID USERNAME      THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND                                                                                                                                                                                                                                                                                                                                                                                                            
   1730 holo           14  46    0   358M   197M ucond   1   1:24  0.00% firefox-bin

FYI, using inverse color for header line can also be achieved on
top-3.8b1 without touching source at all

  $ export TOPCOLORS='header=,#7'

edwin@ planned to update top(1) but stalled, not sure why.

  http://docs.freebsd.org/cgi/mid.cgi?20080928054620.GA80250

And I for one still use his branch with below diff.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: top-3.8b1.diff
Type: text/x-patch
Size: 6927 bytes
Desc: local hacks for top-3.8b1
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20101117/5278bb01/top-3.8b1.bin


More information about the freebsd-current mailing list