old sort keys, etc.

This commit is contained in:
albert 2002-11-29 16:01:04 +00:00
parent d614bf02e6
commit f165d14c56
2 changed files with 32 additions and 16 deletions

40
top.c
View File

@ -1051,7 +1051,7 @@ static void before (char *me)
* line c: contains w->summclr, msgsclr, headclr, taskclr */ * line c: contains w->summclr, msgsclr, headclr, taskclr */
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[] = "rcfile now incompatible, you should delete '%s'";
char fbuf[SMLBUFSIZ]; char fbuf[SMLBUFSIZ];
FILE *fp; FILE *fp;
float delay = DEF_DELAY; float delay = DEF_DELAY;
@ -2132,8 +2132,29 @@ static void do_key (unsigned c)
} }
break; break;
case '\n': /* just ignore these, they'll have the effect */ case 'M': // these keys represent old-top compatability
case ' ': /* of refreshing display after waking us up ! */ case 'N': // -- grouped here so that if users could ever
case 'P': // be weaned, we would just whack this part...
case 'T':
{ static struct {
const unsigned xkey;
const char *xmsg;
const PFLG_t sort;
} xtab[] = {
{ 'M', "Memory", P_MEM, }, { 'N', "Numerical", P_PID, },
{ 'P', "CPU", P_CPU, }, { 'T', "Time", P_TM2 }, };
int i;
for (i = 0; i < MAXTBL(xtab); ++i)
if (c == xtab[i].xkey) {
Curwin->sortindx = xtab[i].sort;
show_msg(fmtmk("%s sort compatibility key honored", xtab[i].xmsg));
break;
}
}
break;
case '\n': // just ignore these, they'll have the effect
case ' ': // of refreshing display after waking us up !
break; break;
default: default:
@ -2316,22 +2337,23 @@ static void task_show (const WIN_t *q, const proc_t *p)
switch (i) { switch (i) {
case P_CMD: case P_CMD:
{ char *cp; { const char *cp;
if (CHKw(q, Show_CMDLIN)) { if (CHKw(q, Show_CMDLIN)) {
char tmp[ROWBUFSIZ]; char tmp[ROWBUFSIZ];
char *tp;
if (p->cmdline) { if (p->cmdline) {
j = 0; j = 0;
*(cp = tmp) = '\0'; *(tp = tmp) = '\0';
do { do {
cp = scat(cp, fmtmk("%.*s ", q->maxcmdln, p->cmdline[j])); tp = scat(tp, fmtmk("%.*s ", q->maxcmdln, p->cmdline[j]));
if (q->maxcmdln < (cp - tmp)) break; if (q->maxcmdln < (tp - tmp)) break;
} while (p->cmdline[++j]); } while (p->cmdline[++j]);
strim(1, tmp); strim(1, tmp);
} else } else
strcpy(tmp, fmtmk(CMDLINE_FMTS, p->cmd)); strcpy(tmp, fmtmk(CMDLINE_FMTS, p->cmd));
cp = tmp; cp = tmp;
} else } else
cp = (char *)p->cmd; cp = p->cmd;
MKCOL(q->maxcmdln, q->maxcmdln, cp); MKCOL(q->maxcmdln, q->maxcmdln, cp);
} }
break; break;
@ -2383,7 +2405,7 @@ static void task_show (const WIN_t *q, const proc_t *p)
MKCOL((unsigned)p->ppid); MKCOL((unsigned)p->ppid);
break; break;
case P_PRI: case P_PRI:
if (-99 > p->priority || +99 < p->priority) { if (-99 > p->priority || 999 < p->priority) {
f = " RT "; f = " RT ";
MKCOL(); MKCOL();
} else } else

8
top.h
View File

@ -510,18 +510,12 @@ typedef struct win {
"" ""
/*###### For Piece of mind and/or backward compatability ################*/ /*###### For Piece of mind #############################################*/
/* just sanity check(s)... */ /* just sanity check(s)... */
#if USRNAMSIZ < GETBUFSIZ #if USRNAMSIZ < GETBUFSIZ
# error "Jeeze, USRNAMSIZ Must NOT be less than GETBUFSIZ !" # error "Jeeze, USRNAMSIZ Must NOT be less than GETBUFSIZ !"
#endif #endif
#ifndef MALLOC
# define MALLOC
#endif
#ifndef restrict
# define restrict
#endif
/*###### Some Prototypes (ha!) #########################################*/ /*###### Some Prototypes (ha!) #########################################*/