/* top.c - Source file: show Linux processes */
/*
- * Copyright (c) June, 2002 - James C. Warner
+ * Copyright (c) 2002, by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
* <warnerjc@worldnet.att.net>
/* now we can build the true run-time columns header and format the
command column heading if P_CMD is really being displayed --
show_a_task is aware of the addition of winnum to the header */
- sprintf(q->columnhdr, "%s", Show_altscr ? fmtmk("%d", mkWNO(q)) : "");
+ sprintf(q->columnhdr, "%s", Show_altscr ? fmtmk("%d", q->winnum) : "");
for (i = 0; i < q->maxpflgs; i++) {
/* are we gonna' need the kernel symbol table? */
if (P_WCHAN == q->procflags[i]) needpsdb = 1;
internal, they can be trusted -- it's those darn users that we
worry 'bout... */
sprintf(q->winname, "%.*s", WINNAMSIZ -1, name);
- sprintf(q->grpname, "%d:%.*s", mkWNO(q), WINNAMSIZ -1, name);
+ sprintf(q->grpname, "%d:%.*s", q->winnum, WINNAMSIZ -1, name);
}
}
switch (ch) {
case 'a': /* we don't carry 'a' / 'w' in our */
- Curwin = Curwin->next; /* user prompt - those case labels */
- break; /* are just here for a good friend */
- case 'w': /* of ours, wins_colors (however, */
- Curwin = Curwin->prev; /* those letters work via the pmt */
- break; /* too -- but really the end-loser */
- case '1': /* should just press the darn key */
- Curwin = Winstk[Def_WINDOW]; /* in the first place) */
- break;
- case '2':
- Curwin = Winstk[Job_WINDOW];
- break;
- case '3':
- Curwin = Winstk[Mem_WINDOW];
- break;
- case '4':
- Curwin = Winstk[Usr_WINDOW];
+ Curwin = Curwin->next; /* pmt - they're here for a good */
+ break; /* friend of ours -- wins_colors. */
+ case 'w': /* (however, those lettrs work via */
+ Curwin = Curwin->prev; /* the pmt too but gee, end-loser */
+ break; /* should just press the darn key) */
+ case '1': case '2':
+ case '3': case '4':
+ Curwin = Winstk[ch - '1'];
break;
}
}
static int win_warn (void)
{
show_msg(fmtmk("\aCommand disabled, activate window #%d with '-' or '_'"
- , mkWNO(Curwin)));
-
+ , Curwin->winnum));
/* we gotta' return false 'cause we're somewhat well known within
macro society, by way of that sassy little tertiary operator... */
return 0;
w = Curwin;
do {
switch (what) {
- case Flgs_TOG:
+ case Flags_TOG:
TOGw(w, flg);
break;
- case Flgs_SET:
- SETw(w, flg);
- break;
- case Flgs_OFF:
+ case Flags_SET: /* Ummmm, i can't find anybody */
+ SETw(w, flg); /* who uses Flags_set -- maybe */
+ break; /* ol' gcc will opt it away... */
+ case Flags_OFF:
OFFw(w, flg);
break;
}
for (i = 0; i < GROUPSMAX; i++) {
Winstk[i] = w;
- w->winnum = i;
+ w->winnum = i + 1;
strcpy(w->winname, wtab[i].name);
strcpy(w->fieldscur, wtab[i].flds);
w->sorttype = wtab[i].sort;
++w;
}
/* fixup the circular chains... */
- Winstk[Usr_WINDOW]->next = Winstk[0];
- Winstk[0]->prev = Winstk[Usr_WINDOW];
+ Winstk[3]->next = Winstk[0];
+ Winstk[0]->prev = Winstk[3];
Curwin = Winstk[0];
Show_altscr = 0;
}
* Process keyboard input during the main loop */
static void do_key (unsigned c)
{
-#ifndef QUIT_NORMALQ
-#define kbdESCAPE 27
-#endif
#define kbdCTRL_L 12
/* standardized 'secure mode' errors */
const char *err_secure = "\aCan't %s in secure mode";
case '_': /* 'Dash' upper case ----------------------- */
if (Show_altscr) /* switcharoo, all viz & inviz ............. */
- wins_reflag(Flgs_TOG, VISIBLE_tsk);
+ wins_reflag(Flags_TOG, VISIBLE_tsk);
break;
case '=': /* 'Equals' lower case --------------------- */
putp(Cap_clr_scr);
show_special(fmtmk(WINDOWS_help
, Myname, Curwin->grpname
- , Winstk[Def_WINDOW]->winname
- , Winstk[Job_WINDOW]->winname
- , Winstk[Mem_WINDOW]->winname
- , Winstk[Usr_WINDOW]->winname));
+ , Winstk[0]->winname
+ , Winstk[1]->winname
+ , Winstk[2]->winname
+ , Winstk[3]->winname));
chin(0, &ch, 1);
win_select(ch);
} while ('\n' != ch);
#ifdef QUIT_NORMALQ
case 'q':
#else
- case kbdESCAPE:
+ case 'Q':
#endif
stop(0);
show_msg("\aUnknown command - try 'h' for help");
}
-#ifndef QUIT_NORMALQ
-#undef kbdESCAPE
-#endif
#undef kbdCTRL_L
}
Max_lines = (Screen_rows - Msg_row) - 1;
if (CHKw(Curwin, EQUWINS_cwo))
- wins_reflag(Flgs_OFF, EQUWINS_cwo);
+ wins_reflag(Flags_OFF, EQUWINS_cwo);
+
/* sure hope each window's columns header begins with a newline... */
putp(tg2(0, Msg_row));
\---------------------------------------------------------------------/
Sheeesh, didn't that dufus know the return statement can't be executed,
- or a signal & stop() will do-us-in? Oh Lordy, I is DROWNING in morons;
- they done REACHED clear up to my OUTER braces. We's all DOOMED, I say!
+ or we end via that stop() function? Oh Lordy, I is DROWNING in morons;
+ they done REACHED clear up to my OUTER braces! We's surely DOOMED now!
/---------------------------------------------------------------------\
*/
return 0;
/* top.h - Header file: show Linux processes */
/*
- * Copyright (c) June, 2002 - James C. Warner
+ * Copyright (c) 2002, by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
* <warnerjc@worldnet.att.net>
//#define CASEUP_HEXES /* show any hex values in upper case */
//#define CASEUP_SCALE /* show scaled times & memory upper case */
//#define CASEUP_SUMMK /* show memory summary kilobytes with 'K' */
-//#define QUIT_NORMALQ /* use 'q' to quit, not new default <Esc> */
+//#define QUIT_NORMALQ /* use 'q' to quit, not new default 'Q' */
//#define SORT_SUPRESS /* *attempt* to reduce qsort overhead */
//#define USE_LIB_STA3 /* use lib status (3 ch) vs. proc_t (1 ch) */
//#define WARN_NOT_SMP /* restrict '1' & 'I' commands to true smp */
/*###### Some Miscellaneous constants ##################################*/
/* The default delay twix updates */
-#define DEF_DELAY 2.0
+#define DEF_DELAY 3.0
/* The length of time a 'message' is displayed */
#define MSG_SLEEP 2
#define GRPNAMSIZ 6 /* window's name + number as in: '#:...' */
#define CAPTABMAX 9 /* a window's captab used by show_special */
-#define Def_WINDOW 0 /* these represent the pre-allocated */
-#define Job_WINDOW 1 /* WIN_t's relative position in the */
-#define Mem_WINDOW 2 /* window stack pointer array... */
-#define Usr_WINDOW 3
-
-#define Flgs_TOG 1 /* these are used to direct wins_reflag */
-#define Flgs_SET 2
-#define Flgs_OFF 3
+#define Flags_TOG 1 /* these are used to direct wins_reflag */
+#define Flags_SET 2
+#define Flags_OFF 3
/* The Persistent 'Mode' flags!
All of these are preserved in the rc file, as a single integer.
#define VIZTOGc(f) (!Show_altscr || Curwin->winflags & VISIBLE_tsk) \
? TOGw(Curwin, f) : win_warn()
- /* Just create a printable window number -- represented here since
- we can't decide which to prefer (relative 0 or 1) */
-#define mkWNO(q) q->winnum + 1
-
/* This structure stores configurable information for each window.
By expending a little effort in its creation and user requested
maintainence, the only real additional per frame cost of having
typedef struct win {
struct win *next, /* next window in window stack */
*prev; /* prior window in window stack */
- int winnum, /* this window's num/array pos */
+ int winnum, /* window's num (array pos + 1) */
winlines; /* task window's rows (volatile) */
int winflags; /* 'view', 'show' and 'sort' mode flags */
char grpname [GRPNAMSIZ], /* window number:name, printable */
/*###### Display Support *Data* ########################################*/
/* An rcfile 'footprint' used to invalidate existing */
-#define RCF_FILEID 'c'
+#define RCF_FILEID 'd'
/* The default fields displayed and their order,
if nothing is specified by the loser, oops user */
/* Keyboard Help specially formatted string(s) --
see 'show_special' for syntax details + other cautions. */
#ifdef QUIT_NORMALQ
-#define HELP_STOPkey " q "
+#define HELP_QUITkey " q "
#else
-#define HELP_STOPkey " <Esc> "
+#define HELP_QUITkey " Q "
#endif
#define KEYS_help \
"%s's - \01Help for Interactive Commands\02 - %s\n" \
" u . Show specific user only\n" \
" # or n . Set maximum tasks displayed\n" \
" W Write configuration file\n" \
- HELP_STOPkey "Quit\n" \
+ HELP_QUITkey "Quit\n" \
" ( commands shown with '.' require a \01visible\02 task display \01window\02 ) \n" \
"Press '\01h\02' or '\01?\02' for help with \01Windows\02,\n" \
"any other key to continue " \