top: retire old stale startup defaults in favor of new

For over a decade top has used a startup configuration
mimicking the original redhat top. This decision dates
back to when the forked Sourceforge version was trying
to win over users in battles with that ancient kludge.

Will anybody deny that those defaults are coyote ugly?

Well, it is time that top presented a more modern look
at startup, providing that no saved rcfile exists. But
just in case some distro prefers that old, comfortable
look, there's the '--disable-modern-top' build option.

[ Pssst. With the widened memory fields it turns out ]
[ the 'Mem' default window had become almost useless ]
[ on an 80x24 terminal since %CPU & COMMAND were out ]
[ of view. So some other defaults were tweaked a bit ]
[ whether or not --disable-modern-top was specified. ]

Reference(s)
http://www.freelists.org/post/procps/tops-graph-mode-saga-continues,3

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2014-06-29 00:00:00 -05:00
committed by Craig Small
parent 2199af404a
commit 8ef6cd91fc
4 changed files with 44 additions and 11 deletions

View File

@ -27,6 +27,7 @@
//#define NOBOOST_MEMS /* disable extra precision for mem fields */
//#define NUMA_DISABLE /* disable summary area NUMA/Nodes display */
//#define OOMEM_ENABLE /* enable the SuSE out-of-memory additions */
//#define ORIG_TOPDEFS /* with no rcfile retain original defaults */
//#define SIGNALS_LESS /* favor reduced signal load over response */
/* Development/Debugging defines ----------------------------------- */
@ -103,7 +104,11 @@ char *strcasestr(const char *haystack, const char *needle);
/*###### Some Miscellaneous constants ##################################*/
/* The default delay twix updates */
#ifdef ORIG_TOPDEFS
#define DEF_DELAY 3.0
#else
#define DEF_DELAY 1.5
#endif
/* Length of time a message is displayed and the duration
of a 'priming' wait during library startup (in microseconds) */
@ -327,9 +332,23 @@ typedef struct CPU_t {
#endif
// Default flags if there's no rcfile to provide user customizations
#ifdef ORIG_TOPDEFS
#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_CPUSUM | View_MEMORY \
| Show_HIBOLD | Show_HIROWS | Show_IDLEPS | Show_TASKON | Show_JRNUMS \
| Qsrt_NORMAL )
#define DEF_GRAPHS2 0, 0
#define DEF_SCALES2 SK_Kb, SK_Kb
#define ALT_WINFLGS DEF_WINFLGS
#define ALT_GRAPHS2 0, 0
#else
#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_MEMORY \
| Show_COLORS | Show_FOREST | Show_HIROWS | Show_IDLEPS | Show_JRNUMS | Show_TASKON \
| Qsrt_NORMAL )
#define DEF_GRAPHS2 1, 2
#define DEF_SCALES2 SK_Gb, SK_Mb
#define ALT_WINFLGS (DEF_WINFLGS | Show_HIBOLD) & ~Show_FOREST
#define ALT_GRAPHS2 2, 0
#endif
/* These are used to direct wins_reflag */
enum reflag_enum {
@ -581,10 +600,14 @@ typedef struct WIN_t {
( with just one escaped value, the '\' character ) */
#define FLD_OFFSET '%'
// seq_fields "%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghij"
#ifdef ORIG_TOPDEFS
#define DEF_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>&')*+,-./012568<>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#else
#define DEF_FIELDS "<22>&K<><4B><EFBFBD><EFBFBD><EFBFBD>@<40><><EFBFBD>56<35>F<EFBFBD>')*+,-./0128<>?ABCGHIJLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#endif
/* Pre-configured windows/field groups */
#define JOB_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>()*+,-./012568>?@ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#define MEM_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>&'()*+,-./0125689BFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#define JOB_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>Ļ<EFBFBD>@<<EFBFBD><EFBFBD>)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#define MEM_FIELDS "<22><><EFBFBD><<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MBN<EFBFBD>D34<EFBFBD><EFBFBD>&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[" RCF_PLUS_H
#define USR_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#ifdef OOMEM_ENABLE
// the suse old top fields ( 'a'-'z' + '{|' ) in positions 0-27
@ -600,19 +623,19 @@ typedef struct WIN_t {
/* The default values for the local config file */
#define DEF_RCFILE { \
RCF_VERSION_ID, 0, 1, DEF_DELAY, 0, { \
{ EU_CPU, DEF_WINFLGS, 0, 0, 0, \
{ EU_CPU, DEF_WINFLGS, 0, DEF_GRAPHS2, \
COLOR_RED, COLOR_RED, COLOR_YELLOW, COLOR_RED, \
"Def", DEF_FIELDS }, \
{ EU_PID, DEF_WINFLGS, 0, 0, 0, \
{ EU_PID, ALT_WINFLGS, 0, ALT_GRAPHS2, \
COLOR_CYAN, COLOR_CYAN, COLOR_WHITE, COLOR_CYAN, \
"Job", JOB_FIELDS }, \
{ EU_MEM, DEF_WINFLGS, 0, 0, 0, \
{ EU_MEM, ALT_WINFLGS, 0, ALT_GRAPHS2, \
COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLUE, COLOR_MAGENTA, \
"Mem", MEM_FIELDS }, \
{ EU_UEN, DEF_WINFLGS, 0, 0, 0, \
{ EU_UEN, ALT_WINFLGS, 0, ALT_GRAPHS2, \
COLOR_YELLOW, COLOR_YELLOW, COLOR_GREEN, COLOR_YELLOW, \
"Usr", USR_FIELDS } \
}, 0, SK_Kb, SK_Kb, 0 }
}, 0, DEF_SCALES2, 0 }
/* Summary Lines specially formatted string(s) --
see 'show_special' for syntax details + other cautions. */