.Rje
.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.
However, items shown with an \*(AS could be overridden through the\fB
command line\fR \*(EM a subject soon to be dealt with.
.in +4
\*(NT The 'Command' field/column is\fB unique\fR, in that \fRit is not
fixed-width, like all other fields.
-When displayed, this column will be allocated \fBall remaining screen width\fR
-to provide for the potential growth of program names into command lines!
+When displayed, this column will be allocated \fBall remaining screen width\fR,
+up to the maximum 512 characters, so as to provide for the potential growth of
+program names into command lines!
.in
.TP 3
You will be prompted to enter the number of tasks to display.
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
-over the size of each currently visible \*(TD.
+When used in \*(AM, this is the command that gives you precise control over
+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
.\" .........................
/* The Name of the local config file, dynamically constructed */
static char RCfile [OURPATHSZ];
-
/* The run-time acquired page size */
static int Page_size;
#ifdef UGH_ITS_4_RH
{
#define PTRsz sizeof(proc_t *) /* eyeball candy */
#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) */
proc_t *ptsk = (proc_t *)-1; /* first time, Force: (ii) */
unsigned curmax = 0; /* every time (jeeze) */
table[curmax]->cmdline = NULL;
}
if (!(ptsk = readproc(PT, table[curmax]))) break;
- RTx(ptsk)
++curmax;
}
/* realloc as we go, keeping 'table' ahead of 'currmax++' */
table = alloc_r(table, (curmax + 1) * PTRsz);
/* here, readproc will allocate the underlying proc_t stg */
- if ((ptsk = readproc(PT, NULL))) {
- RTx(ptsk)
+ if ((ptsk = readproc(PT, NULL)))
table[curmax++] = ptsk;
- }
}
closeproc(PT);
#undef PTRsz
#undef ENTsz
-#undef RTx
}
\f
static void configs_read (void)
{
static const char err_rc[] = "bad rcfile, you should delete '%s'";
- char fbuf[RCFBUFSIZ];
+ char fbuf[SMLBUFSIZ];
FILE *fp;
float delay = DEF_DELAY;
char id;
int i;
+ snprintf(RCfile, sizeof(RCfile), ".%src", Myname);
if (getenv("HOME"))
- strcpy(RCfile, fmtmk("%s%c", getenv("HOME"), '/'));
- strcat(RCfile, fmtmk(".%src", Myname));
+ snprintf(RCfile, sizeof(RCfile), "%s/.%src", getenv("HOME"), Myname);
fp = fopen(SYS_RCFILE, "r");
if (fp) {
putp(Cap_clr_scr);
putp(Cap_curs_huge);
display_fields(Curwin->fieldscur, FIELDS_xtra);
- do {
+ for (;;) {
show_special(fmtmk(FIELDS_current
, Cap_home, Curwin->fieldscur, Curwin->grpname, prompt));
chin(0, &c, 1);
p[1] = c;
}
}
- } while (1);
+ }
putp(Cap_curs_norm);
}
x = i = Curwin->sortindx;
putp(Cap_clr_scr);
putp(Cap_curs_huge);
- do {
+ for (;;) {
p = phoney + i;
*p = toupper(*p);
display_fields(phoney, SORT_xtra);
if (i < 0 || i >= MAXTBL(Fieldstab)) break;
*p = tolower(*p);
x = i;
- } while (1);
+ }
if ((p = strchr(Curwin->fieldscur, x + 'a')))
*p = x + 'A';
Curwin->sortindx = x;
putp(Cap_clr_scr);
putp(Cap_curs_huge);
- do {
+ for (;;) {
display_fields(Curwin->fieldscur, FIELDS_xtra);
show_special(fmtmk(FIELDS_current
, Cap_home, Curwin->fieldscur, Curwin->grpname, prompt));
*p = i + 'a';
else if ((p = strchr(Curwin->fieldscur, i + 'a')))
*p = i + 'A';
- } while (1);
+ }
putp(Cap_curs_norm);
}
Screen_cols = wz.ws_col;
Screen_rows = wz.ws_row;
}
+ /* we might disappoint some folks (but they'll deserve it) */
+ if (SCREENMAX < Screen_cols) Screen_cols = SCREENMAX;
+
w = Curwin;
do {
win_colsheads(w);
MKCOL(q, i, a, &pad, cbuf, task->ppid);
break;
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);
break;
case P_RES:
signal(SIGCONT, wins_resize);
signal(SIGWINCH, wins_resize);
- do {
+ for (;;) {
struct timeval tv;
fd_set fs;
char c;
&& 0 < chin(0, &c, 1))
do_key((unsigned)c);
}
- } while (1);
+ }
/*
(listen before we return, aren't you sort of sad for 'so_lets_see-em'?)
/* Miscellaneous buffer sizes with liberal values
-- 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 CAPBUFSIZ 32
#define CLRBUFSIZ 64
#define GETBUFSIZ 32
#define TNYBUFSIZ 32
#define SMLBUFSIZ 256
-#define MEDBUFSIZ 512
#define OURPATHSZ 1024
-#define STATBUFSZ 1024
#define BIGBUFSIZ 2048
-#define RCFBUFSIZ SMLBUFSIZ
#define USRNAMSIZ GETBUFSIZ
+ /* colbufsz does NOT apply to command lines - that field uses rowbufsz */
#define COLBUFSIZ SMLBUFSIZ + CLRBUFSIZ
-#define ROWBUFSIZ MEDBUFSIZ + CLRBUFSIZ
+#define ROWBUFSIZ SCREENMAX + CLRBUFSIZ
/*###### Some Miscellaneous Macro definitions ##########################*/
calculations. It exists primarily for SMP support but serves
all environments. */
typedef struct {
- TICS_t u, /* ticks count as represented in /proc/stat */
- n, /* (not in the order of our display) */
- s,
- i,
- w;
- TICS_t u_sav, /* tics count in the order of our display */
- s_sav,
- n_sav,
- i_sav,
- w_sav;
+ /* ticks count as represented in /proc/stat */
+ TICS_t u, n, s, i, w;
+ /* tics count in the order of our display */
+ TICS_t u_sav, s_sav, n_sav, i_sav, w_sav;
} CPUS_t;
/* The scaling 'type' used with scale_num() -- this is how
char grpname [GRPNAMSIZ], /* window number:name, printable */
winname [WINNAMSIZ], /* window name, user changeable */
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 */
} WIN_t;
/* ////////////////////////////////////////////////////////////// */