1st 3.0.5 patch: wide top display
This commit is contained in:
parent
2de91e85be
commit
e7017ab912
21
top.1
21
top.1
@ -265,7 +265,12 @@ acknowledge \*(Us's default settings ...
|
|||||||
.Rje
|
.Rje
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
Within the following categories, \*(Us's startup defaults are documented
|
\*(NT the width of \*(Me's display will be limited to 512 positions.
|
||||||
|
Displaying all fields requires a minimum of 160 characters.
|
||||||
|
The remaining width could be used for the 'Command' column.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
Within the following categories, \*(Me's startup defaults are documented
|
||||||
assuming no \*(CF, thus no user customizations.
|
assuming no \*(CF, thus no user customizations.
|
||||||
However, items shown with an \*(AS could be overridden through the\fB
|
However, items shown with an \*(AS could be overridden through the\fB
|
||||||
command line\fR \*(EM a subject soon to be dealt with.
|
command line\fR \*(EM a subject soon to be dealt with.
|
||||||
@ -595,8 +600,9 @@ screen width.
|
|||||||
.in +4
|
.in +4
|
||||||
\*(NT The 'Command' field/column is\fB unique\fR, in that \fRit is not
|
\*(NT The 'Command' field/column is\fB unique\fR, in that \fRit is not
|
||||||
fixed-width, like all other fields.
|
fixed-width, like all other fields.
|
||||||
When displayed, this column will be allocated \fBall remaining screen width\fR
|
When displayed, this column will be allocated \fBall remaining screen width\fR,
|
||||||
to provide for the potential growth of program names into command lines!
|
up to the maximum 512 characters, so as to provide for the potential growth of
|
||||||
|
program names into command lines!
|
||||||
.in
|
.in
|
||||||
|
|
||||||
.TP 3
|
.TP 3
|
||||||
@ -942,8 +948,13 @@ affect the window's size, as all prior \*(TDs will have already been painted.
|
|||||||
You will be prompted to enter the number of tasks to display.
|
You will be prompted to enter the number of tasks to display.
|
||||||
The lessor of your number and available screen rows will be used.
|
The lessor of your number and available screen rows will be used.
|
||||||
|
|
||||||
This is the command that, when used in \*(AM, gives you precise control
|
When used in \*(AM, this is the command that gives you precise control over
|
||||||
over the size of each currently visible \*(TD.
|
the size of each currently visible \*(TD, except for the very last.
|
||||||
|
It will not affect the last window's size, as all prior \*(TDs will have
|
||||||
|
already been painted.
|
||||||
|
|
||||||
|
\*(NT If you wish to increase the size of the last visible \*(TD when in \*(AM,
|
||||||
|
simply decrease the size of the \*(TD(s) above it.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
.\" .........................
|
.\" .........................
|
||||||
|
38
top.c
38
top.c
@ -80,7 +80,6 @@ static char *Myname;
|
|||||||
|
|
||||||
/* The Name of the local config file, dynamically constructed */
|
/* The Name of the local config file, dynamically constructed */
|
||||||
static char RCfile [OURPATHSZ];
|
static char RCfile [OURPATHSZ];
|
||||||
|
|
||||||
/* The run-time acquired page size */
|
/* The run-time acquired page size */
|
||||||
static int Page_size;
|
static int Page_size;
|
||||||
#ifdef UGH_ITS_4_RH
|
#ifdef UGH_ITS_4_RH
|
||||||
@ -871,9 +870,6 @@ static proc_t **refreshprocs (proc_t **table, int flags)
|
|||||||
{
|
{
|
||||||
#define PTRsz sizeof(proc_t *) /* eyeball candy */
|
#define PTRsz sizeof(proc_t *) /* eyeball candy */
|
||||||
#define ENTsz sizeof(proc_t)
|
#define ENTsz sizeof(proc_t)
|
||||||
/* quick & dirty response to 2.5.xx RT */
|
|
||||||
#define RTx(p) { if (-99 > p->priority) p->priority = -99; \
|
|
||||||
if (+99 < p->priority) p->priority = +99; }
|
|
||||||
static unsigned savmax = 0; /* first time, Bypass: (i) */
|
static unsigned savmax = 0; /* first time, Bypass: (i) */
|
||||||
proc_t *ptsk = (proc_t *)-1; /* first time, Force: (ii) */
|
proc_t *ptsk = (proc_t *)-1; /* first time, Force: (ii) */
|
||||||
unsigned curmax = 0; /* every time (jeeze) */
|
unsigned curmax = 0; /* every time (jeeze) */
|
||||||
@ -893,7 +889,6 @@ static proc_t **refreshprocs (proc_t **table, int flags)
|
|||||||
table[curmax]->cmdline = NULL;
|
table[curmax]->cmdline = NULL;
|
||||||
}
|
}
|
||||||
if (!(ptsk = readproc(PT, table[curmax]))) break;
|
if (!(ptsk = readproc(PT, table[curmax]))) break;
|
||||||
RTx(ptsk)
|
|
||||||
++curmax;
|
++curmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,10 +897,8 @@ static proc_t **refreshprocs (proc_t **table, int flags)
|
|||||||
/* realloc as we go, keeping 'table' ahead of 'currmax++' */
|
/* realloc as we go, keeping 'table' ahead of 'currmax++' */
|
||||||
table = alloc_r(table, (curmax + 1) * PTRsz);
|
table = alloc_r(table, (curmax + 1) * PTRsz);
|
||||||
/* here, readproc will allocate the underlying proc_t stg */
|
/* here, readproc will allocate the underlying proc_t stg */
|
||||||
if ((ptsk = readproc(PT, NULL))) {
|
if ((ptsk = readproc(PT, NULL)))
|
||||||
RTx(ptsk)
|
|
||||||
table[curmax++] = ptsk;
|
table[curmax++] = ptsk;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
closeproc(PT);
|
closeproc(PT);
|
||||||
|
|
||||||
@ -922,7 +915,6 @@ static proc_t **refreshprocs (proc_t **table, int flags)
|
|||||||
|
|
||||||
#undef PTRsz
|
#undef PTRsz
|
||||||
#undef ENTsz
|
#undef ENTsz
|
||||||
#undef RTx
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -977,15 +969,15 @@ static void before (char *me)
|
|||||||
static void configs_read (void)
|
static void configs_read (void)
|
||||||
{
|
{
|
||||||
static const char err_rc[] = "bad rcfile, you should delete '%s'";
|
static const char err_rc[] = "bad rcfile, you should delete '%s'";
|
||||||
char fbuf[RCFBUFSIZ];
|
char fbuf[SMLBUFSIZ];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
float delay = DEF_DELAY;
|
float delay = DEF_DELAY;
|
||||||
char id;
|
char id;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
snprintf(RCfile, sizeof(RCfile), ".%src", Myname);
|
||||||
if (getenv("HOME"))
|
if (getenv("HOME"))
|
||||||
strcpy(RCfile, fmtmk("%s%c", getenv("HOME"), '/'));
|
snprintf(RCfile, sizeof(RCfile), "%s/.%src", getenv("HOME"), Myname);
|
||||||
strcat(RCfile, fmtmk(".%src", Myname));
|
|
||||||
|
|
||||||
fp = fopen(SYS_RCFILE, "r");
|
fp = fopen(SYS_RCFILE, "r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
@ -1277,7 +1269,7 @@ static void fields_reorder (void)
|
|||||||
putp(Cap_clr_scr);
|
putp(Cap_clr_scr);
|
||||||
putp(Cap_curs_huge);
|
putp(Cap_curs_huge);
|
||||||
display_fields(Curwin->fieldscur, FIELDS_xtra);
|
display_fields(Curwin->fieldscur, FIELDS_xtra);
|
||||||
do {
|
for (;;) {
|
||||||
show_special(fmtmk(FIELDS_current
|
show_special(fmtmk(FIELDS_current
|
||||||
, Cap_home, Curwin->fieldscur, Curwin->grpname, prompt));
|
, Cap_home, Curwin->fieldscur, Curwin->grpname, prompt));
|
||||||
chin(0, &c, 1);
|
chin(0, &c, 1);
|
||||||
@ -1292,7 +1284,7 @@ static void fields_reorder (void)
|
|||||||
p[1] = c;
|
p[1] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (1);
|
}
|
||||||
putp(Cap_curs_norm);
|
putp(Cap_curs_norm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1310,7 +1302,7 @@ static void fields_sort (void)
|
|||||||
x = i = Curwin->sortindx;
|
x = i = Curwin->sortindx;
|
||||||
putp(Cap_clr_scr);
|
putp(Cap_clr_scr);
|
||||||
putp(Cap_curs_huge);
|
putp(Cap_curs_huge);
|
||||||
do {
|
for (;;) {
|
||||||
p = phoney + i;
|
p = phoney + i;
|
||||||
*p = toupper(*p);
|
*p = toupper(*p);
|
||||||
display_fields(phoney, SORT_xtra);
|
display_fields(phoney, SORT_xtra);
|
||||||
@ -1321,7 +1313,7 @@ static void fields_sort (void)
|
|||||||
if (i < 0 || i >= MAXTBL(Fieldstab)) break;
|
if (i < 0 || i >= MAXTBL(Fieldstab)) break;
|
||||||
*p = tolower(*p);
|
*p = tolower(*p);
|
||||||
x = i;
|
x = i;
|
||||||
} while (1);
|
}
|
||||||
if ((p = strchr(Curwin->fieldscur, x + 'a')))
|
if ((p = strchr(Curwin->fieldscur, x + 'a')))
|
||||||
*p = x + 'A';
|
*p = x + 'A';
|
||||||
Curwin->sortindx = x;
|
Curwin->sortindx = x;
|
||||||
@ -1340,7 +1332,7 @@ static void fields_toggle (void)
|
|||||||
|
|
||||||
putp(Cap_clr_scr);
|
putp(Cap_clr_scr);
|
||||||
putp(Cap_curs_huge);
|
putp(Cap_curs_huge);
|
||||||
do {
|
for (;;) {
|
||||||
display_fields(Curwin->fieldscur, FIELDS_xtra);
|
display_fields(Curwin->fieldscur, FIELDS_xtra);
|
||||||
show_special(fmtmk(FIELDS_current
|
show_special(fmtmk(FIELDS_current
|
||||||
, Cap_home, Curwin->fieldscur, Curwin->grpname, prompt));
|
, Cap_home, Curwin->fieldscur, Curwin->grpname, prompt));
|
||||||
@ -1351,7 +1343,7 @@ static void fields_toggle (void)
|
|||||||
*p = i + 'a';
|
*p = i + 'a';
|
||||||
else if ((p = strchr(Curwin->fieldscur, i + 'a')))
|
else if ((p = strchr(Curwin->fieldscur, i + 'a')))
|
||||||
*p = i + 'A';
|
*p = i + 'A';
|
||||||
} while (1);
|
}
|
||||||
putp(Cap_curs_norm);
|
putp(Cap_curs_norm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1623,6 +1615,9 @@ static void wins_resize (int dont_care_sig)
|
|||||||
Screen_cols = wz.ws_col;
|
Screen_cols = wz.ws_col;
|
||||||
Screen_rows = wz.ws_row;
|
Screen_rows = wz.ws_row;
|
||||||
}
|
}
|
||||||
|
/* we might disappoint some folks (but they'll deserve it) */
|
||||||
|
if (SCREENMAX < Screen_cols) Screen_cols = SCREENMAX;
|
||||||
|
|
||||||
w = Curwin;
|
w = Curwin;
|
||||||
do {
|
do {
|
||||||
win_colsheads(w);
|
win_colsheads(w);
|
||||||
@ -2049,6 +2044,9 @@ static void show_a_task (WIN_t *q, proc_t *task)
|
|||||||
MKCOL(q, i, a, &pad, cbuf, task->ppid);
|
MKCOL(q, i, a, &pad, cbuf, task->ppid);
|
||||||
break;
|
break;
|
||||||
case P_PRI:
|
case P_PRI:
|
||||||
|
/* quick & dirty response to 2.5.xx RT priority */
|
||||||
|
if (-99 > task->priority) task->priority = -99;
|
||||||
|
else if (+99 < task->priority) task->priority = +99;
|
||||||
MKCOL(q, i, a, &pad, cbuf, (long)task->priority);
|
MKCOL(q, i, a, &pad, cbuf, (long)task->priority);
|
||||||
break;
|
break;
|
||||||
case P_RES:
|
case P_RES:
|
||||||
@ -2739,7 +2737,7 @@ int main (int dont_care_argc, char **argv)
|
|||||||
signal(SIGCONT, wins_resize);
|
signal(SIGCONT, wins_resize);
|
||||||
signal(SIGWINCH, wins_resize);
|
signal(SIGWINCH, wins_resize);
|
||||||
|
|
||||||
do {
|
for (;;) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
fd_set fs;
|
fd_set fs;
|
||||||
char c;
|
char c;
|
||||||
@ -2761,7 +2759,7 @@ int main (int dont_care_argc, char **argv)
|
|||||||
&& 0 < chin(0, &c, 1))
|
&& 0 < chin(0, &c, 1))
|
||||||
do_key((unsigned)c);
|
do_key((unsigned)c);
|
||||||
}
|
}
|
||||||
} while (1);
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
(listen before we return, aren't you sort of sad for 'so_lets_see-em'?)
|
(listen before we return, aren't you sort of sad for 'so_lets_see-em'?)
|
||||||
|
26
top.h
26
top.h
@ -59,20 +59,22 @@
|
|||||||
|
|
||||||
/* Miscellaneous buffer sizes with liberal values
|
/* Miscellaneous buffer sizes with liberal values
|
||||||
-- mostly just to pinpoint source code usage/dependancies */
|
-- mostly just to pinpoint source code usage/dependancies */
|
||||||
|
#define SCREENMAX 512
|
||||||
|
/* the above might seem pretty stingy, until you consider that with every
|
||||||
|
one of top's fields are displayed we're talking a 160 byte column header
|
||||||
|
-- so this will provide for all fields plus a 350+ byte command line */
|
||||||
#define PFLAGSSIZ 32
|
#define PFLAGSSIZ 32
|
||||||
#define CAPBUFSIZ 32
|
#define CAPBUFSIZ 32
|
||||||
#define CLRBUFSIZ 64
|
#define CLRBUFSIZ 64
|
||||||
#define GETBUFSIZ 32
|
#define GETBUFSIZ 32
|
||||||
#define TNYBUFSIZ 32
|
#define TNYBUFSIZ 32
|
||||||
#define SMLBUFSIZ 256
|
#define SMLBUFSIZ 256
|
||||||
#define MEDBUFSIZ 512
|
|
||||||
#define OURPATHSZ 1024
|
#define OURPATHSZ 1024
|
||||||
#define STATBUFSZ 1024
|
|
||||||
#define BIGBUFSIZ 2048
|
#define BIGBUFSIZ 2048
|
||||||
#define RCFBUFSIZ SMLBUFSIZ
|
|
||||||
#define USRNAMSIZ GETBUFSIZ
|
#define USRNAMSIZ GETBUFSIZ
|
||||||
|
/* colbufsz does NOT apply to command lines - that field uses rowbufsz */
|
||||||
#define COLBUFSIZ SMLBUFSIZ + CLRBUFSIZ
|
#define COLBUFSIZ SMLBUFSIZ + CLRBUFSIZ
|
||||||
#define ROWBUFSIZ MEDBUFSIZ + CLRBUFSIZ
|
#define ROWBUFSIZ SCREENMAX + CLRBUFSIZ
|
||||||
|
|
||||||
|
|
||||||
/*###### Some Miscellaneous Macro definitions ##########################*/
|
/*###### Some Miscellaneous Macro definitions ##########################*/
|
||||||
@ -169,16 +171,10 @@ typedef struct {
|
|||||||
calculations. It exists primarily for SMP support but serves
|
calculations. It exists primarily for SMP support but serves
|
||||||
all environments. */
|
all environments. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TICS_t u, /* ticks count as represented in /proc/stat */
|
/* ticks count as represented in /proc/stat */
|
||||||
n, /* (not in the order of our display) */
|
TICS_t u, n, s, i, w;
|
||||||
s,
|
/* tics count in the order of our display */
|
||||||
i,
|
TICS_t u_sav, s_sav, n_sav, i_sav, w_sav;
|
||||||
w;
|
|
||||||
TICS_t u_sav, /* tics count in the order of our display */
|
|
||||||
s_sav,
|
|
||||||
n_sav,
|
|
||||||
i_sav,
|
|
||||||
w_sav;
|
|
||||||
} CPUS_t;
|
} CPUS_t;
|
||||||
|
|
||||||
/* The scaling 'type' used with scale_num() -- this is how
|
/* The scaling 'type' used with scale_num() -- this is how
|
||||||
@ -286,7 +282,7 @@ typedef struct win {
|
|||||||
char grpname [GRPNAMSIZ], /* window number:name, printable */
|
char grpname [GRPNAMSIZ], /* window number:name, printable */
|
||||||
winname [WINNAMSIZ], /* window name, user changeable */
|
winname [WINNAMSIZ], /* window name, user changeable */
|
||||||
fieldscur [PFLAGSSIZ], /* fields displayed and ordered */
|
fieldscur [PFLAGSSIZ], /* fields displayed and ordered */
|
||||||
columnhdr [SMLBUFSIZ], /* column headings for procflags */
|
columnhdr [SCREENMAX], /* column headings for procflags */
|
||||||
colusrnam [USRNAMSIZ]; /* if selected by the 'u' command */
|
colusrnam [USRNAMSIZ]; /* if selected by the 'u' command */
|
||||||
} WIN_t;
|
} WIN_t;
|
||||||
/* ////////////////////////////////////////////////////////////// */
|
/* ////////////////////////////////////////////////////////////// */
|
||||||
|
Loading…
Reference in New Issue
Block a user