* line 2 : an id, Mode_altcsr, Mode_irixps, Delay_time, Curwin.
* For each of the 4 windows:
* line a: contains w->winname, fieldscur
- * line b: contains w->winflags, sortindx, maxtasks
+ * line b: contains w->winflags, sortindx, maxtasks, graph modes
* line c: contains w->summclr, msgsclr, headclr, taskclr
* line 15 : miscellaneous additional global settings
* Any remaining lines are devoted to the 'Inspect Other' feature */
// too bad fscanf is not as flexible with his format string as snprintf
# error Hey, fix the above fscanf 'PFLAGSSIZ' dependency !
#endif
- if (3 != fscanf(fp, "\twinflags=%d, sortindx=%d, maxtasks=%d\n"
- , &w->rc.winflags, &w->rc.sortindx, &w->rc.maxtasks))
+ // be tolerant of missing release 3.3.10 graph modes additions
+ if (3 > fscanf(fp, "\twinflags=%d, sortindx=%d, maxtasks=%d, graph_cpus=%d, graph_mems=%d\n"
+ , &w->rc.winflags, &w->rc.sortindx, &w->rc.maxtasks, &w->rc.graph_cpus, &w->rc.graph_mems))
goto default_or_error;
if (4 != fscanf(fp, "\tsummclr=%d, msgsclr=%d, headclr=%d, taskclr=%d\n"
, &w->rc.summclr, &w->rc.msgsclr
switch (Rc.id) {
case 'a': // 3.2.8 (former procps)
if (config_cvt(w))
- goto default_or_error; // fall through !
- case 'f': // 3.3.0 thru 3.3.3 (procps-ng)
- SETw(w, Show_JRNUMS); // fall through !
- case 'g': // 3.3.4 thru 3.3.8
- scat(w->rc.fieldscur, RCF_PLUS_H); // fall through !
- case 'h': // current RCF_VERSION_ID
- default: // and future versions?
+ goto default_or_error;
+ case 'f': // 3.3.0 thru 3.3.3 (ng)
+ SETw(w, Show_JRNUMS);
+ case 'g': // from 3.3.4 thru 3.3.8
+ scat(w->rc.fieldscur, RCF_PLUS_H);
+ case 'h': // this is release 3.3.9
+ /* w->rc.graph_cpus = 0; */// for documentation only, since
+ /* w->rc.graph_mems = 0; */// DEF_RCFILE zeroes them for us
+ case 'i': // actual RCF_VERSION_ID
+ default: // and a future version?
if (strlen(w->rc.fieldscur) != sizeof(DEF_FIELDS) - 1)
goto default_or_error;
for (x = 0; x < EU_MAXPFLGS; ++x)
} // end: for (GROUPSMAX)
// any new addition(s) last, for older rcfiles compatibility...
- if (fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d, Graph_cpus=%d, Graph_mems=%d\n"
- , &Rc.fixed_widest, &Rc.summ_mscale, &Rc.task_mscale, &Rc.zero_suppress
- , &Rc.graph_cpus, &Rc.graph_mems))
+ if (fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n"
+ , &Rc.fixed_widest, &Rc.summ_mscale, &Rc.task_mscale, &Rc.zero_suppress))
; // avoid -Wunused-result
try_inspect_entries:
for (i = 0 ; i < GROUPSMAX; i++) {
fprintf(fp, "%s\tfieldscur=%s\n"
, Winstk[i].rc.winname, Winstk[i].rc.fieldscur);
- fprintf(fp, "\twinflags=%d, sortindx=%d, maxtasks=%d\n"
- , Winstk[i].rc.winflags, Winstk[i].rc.sortindx
- , Winstk[i].rc.maxtasks);
+ fprintf(fp, "\twinflags=%d, sortindx=%d, maxtasks=%d, graph_cpus=%d, graph_mems=%d\n"
+ , Winstk[i].rc.winflags, Winstk[i].rc.sortindx, Winstk[i].rc.maxtasks
+ , Winstk[i].rc.graph_cpus, Winstk[i].rc.graph_mems);
fprintf(fp, "\tsummclr=%d, msgsclr=%d, headclr=%d, taskclr=%d\n"
, Winstk[i].rc.summclr, Winstk[i].rc.msgsclr
, Winstk[i].rc.headclr, Winstk[i].rc.taskclr);
}
// any new addition(s) last, for older rcfiles compatibility...
- fprintf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d, Graph_cpus=%d, Graph_mems=%d\n"
- , Rc.fixed_widest, Rc.summ_mscale, Rc.task_mscale, Rc.zero_suppress
- , Rc.graph_cpus, Rc.graph_mems);
+ fprintf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n"
+ , Rc.fixed_widest, Rc.summ_mscale, Rc.task_mscale, Rc.zero_suppress);
if (Inspect.raw)
fputs(Inspect.raw, fp);
case 'm':
if (!CHKw(w, View_MEMORY))
SETw(w, View_MEMORY);
- else if (++Rc.graph_mems > 2) {
- Rc.graph_mems = 0;;
+ else if (++w->rc.graph_mems > 2) {
+ w->rc.graph_mems = 0;;
OFFw(w, View_MEMORY);
}
break;
case 't':
if (!CHKw(w, View_STATES))
SETw(w, View_STATES);
- else if (++Rc.graph_cpus > 2) {
- Rc.graph_cpus = 0;;
+ else if (++w->rc.graph_cpus > 2) {
+ w->rc.graph_cpus = 0;;
OFFw(w, View_STATES);
}
break;
/* display some kinda' cpu state percentages
(who or what is explained by the passed prefix) */
- if (Rc.graph_cpus) {
+ if (Curwin->rc.graph_cpus) {
static struct {
const char *user, *syst, *type;
} gtab[] = {
{ "%-.*s~4", "%-.*s~6", Graph_blks }
};
char user[SMLBUFSIZ], syst[SMLBUFSIZ], dual[MEDBUFSIZ];
- int ix = Rc.graph_cpus - 1;
+ int ix = Curwin->rc.graph_cpus - 1;
float pct_user = (float)(u_frme + n_frme) * scale,
pct_syst = (float)s_frme * scale;
snprintf(user, sizeof(user), gtab[ix].user, (int)((pct_user * Graph_adj) + .5), gtab[ix].type);
}
kb_main_my_used = kb_main_used - kb_main_buffers - kb_main_cached;
- if (Rc.graph_mems) {
+ if (w->rc.graph_mems) {
static struct {
const char *used, *misc, *swap, *type;
} gtab[] = {
{ "%-.*s~4", "%-.*s~6", "%-.*s~6", Graph_blks }
};
char used[SMLBUFSIZ], util[SMLBUFSIZ], dual[MEDBUFSIZ];
- int ix = Rc.graph_mems - 1;
+ int ix = w->rc.graph_mems - 1;
float pct_used = (float)kb_main_my_used * (100.0 / (float)kb_main_total),
pct_misc = (float)(kb_main_buffers + kb_main_cached) * (100.0 / (float)kb_main_total),
pct_swap = (float)kb_swap_used * (100.0 / (float)kb_swap_total);
/* This type helps support both a window AND the rcfile */
typedef struct RCW_t { // the 'window' portion of an rcfile
- int sortindx, // sort field, represented as a procflag
- winflags, // 'view', 'show' and 'sort' mode flags
- maxtasks, // user requested maximum, 0 equals all
- summclr, // color num used in summ info
- msgsclr, // " in msgs/pmts
- headclr, // " in cols head
- taskclr; // " in task rows
- char winname [WINNAMSIZ], // window name, user changeable
- fieldscur [PFLAGSSIZ]; // fields displayed and ordered
+ int sortindx, // sort field (represented as procflag)
+ winflags, // 'view', 'show' and 'sort' mode flags
+ maxtasks, // user requested maximum, 0 equals all
+ graph_cpus, // 't' - View_STATES supplementary vals
+ graph_mems, // 'm' - View_MEMORY supplememtary vals
+ summclr, // a colors 'number' used for summ info
+ msgsclr, // " in msgs/pmts
+ headclr, // " in cols head
+ taskclr; // " in task rows
+ char winname [WINNAMSIZ], // name for the window, user changeable
+ fieldscur [PFLAGSSIZ]; // the fields for display & their order
} RCW_t;
/* This represents the complete rcfile */
int summ_mscale; // 'E' - scaling of summary memory values
int task_mscale; // 'e' - scaling of process memory values
int zero_suppress; // '0' - suppress scaled zeros toggle
- int graph_cpus; // 't' - View_STATES supplementary values
- int graph_mems; // 'm' - View_MEMORY supplememtary values
} RCF_t;
/* This structure stores configurable information for each window.
/* Configuration files support */
#define SYS_RCFILESPEC "/etc/toprc"
#define RCF_EYECATCHER "Config File (Linux processes with windows)\n"
-#define RCF_VERSION_ID 'h'
+#define RCF_VERSION_ID 'i'
#define RCF_PLUS_H "\\]^_`abcdefghij"
/* The default fields displayed and their order, if nothing is
/* The default values for the local config file */
#define DEF_RCFILE { \
RCF_VERSION_ID, 0, 1, DEF_DELAY, 0, { \
- { EU_CPU, DEF_WINFLGS, 0, \
+ { EU_CPU, DEF_WINFLGS, 0, 0, 0, \
COLOR_RED, COLOR_RED, COLOR_YELLOW, COLOR_RED, \
"Def", DEF_FIELDS }, \
- { EU_PID, DEF_WINFLGS, 0, \
+ { EU_PID, DEF_WINFLGS, 0, 0, 0, \
COLOR_CYAN, COLOR_CYAN, COLOR_WHITE, COLOR_CYAN, \
"Job", JOB_FIELDS }, \
- { EU_MEM, DEF_WINFLGS, 0, \
+ { EU_MEM, DEF_WINFLGS, 0, 0, 0, \
COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLUE, COLOR_MAGENTA, \
"Mem", MEM_FIELDS }, \
- { EU_UEN, DEF_WINFLGS, 0, \
+ { EU_UEN, DEF_WINFLGS, 0, 0, 0, \
COLOR_YELLOW, COLOR_YELLOW, COLOR_GREEN, COLOR_YELLOW, \
"Usr", USR_FIELDS } \
- }, 0, SK_Kb, SK_Kb, 0, 0, 0 }
+ }, 0, SK_Kb, SK_Kb, 0 }
/* Summary Lines specially formatted string(s) --
see 'show_special' for syntax details + other cautions. */