bit of top hacking
This commit is contained in:
parent
a791f8034f
commit
1e73c7b8bc
7
top.c
7
top.c
@ -273,6 +273,7 @@ static int chin (int ech, char *buf, unsigned cnt)
|
|||||||
|
|
||||||
// This routine simply formats whatever the caller wants and
|
// This routine simply formats whatever the caller wants and
|
||||||
// returns a pointer to the resulting 'const char' string...
|
// returns a pointer to the resulting 'const char' string...
|
||||||
|
static const char *fmtmk (const char *fmts, ...) __attribute__((format(printf,1,2)));
|
||||||
static const char *fmtmk (const char *fmts, ...)
|
static const char *fmtmk (const char *fmts, ...)
|
||||||
{
|
{
|
||||||
static char buf[BIGBUFSIZ]; // with help stuff, our buffer
|
static char buf[BIGBUFSIZ]; // with help stuff, our buffer
|
||||||
@ -560,6 +561,7 @@ static void capsmk (WIN_t *q)
|
|||||||
// Due to the postponed opening of ksym, using open_psdb_message,
|
// Due to the postponed opening of ksym, using open_psdb_message,
|
||||||
// if P_WCH had been selected and the program is restarted, the
|
// if P_WCH had been selected and the program is restarted, the
|
||||||
// message would otherwise be displayed prematurely.
|
// message would otherwise be displayed prematurely.
|
||||||
|
static void msg_save (const char *fmts, ...) __attribute__((format(printf,1,2)));
|
||||||
static void msg_save (const char *fmts, ...)
|
static void msg_save (const char *fmts, ...)
|
||||||
{
|
{
|
||||||
char tmp[SMLBUFSIZ];
|
char tmp[SMLBUFSIZ];
|
||||||
@ -2470,6 +2472,7 @@ static void do_key (unsigned c)
|
|||||||
{
|
{
|
||||||
// standardized 'secure mode' errors
|
// standardized 'secure mode' errors
|
||||||
static const char err_secure[] = "\aUnavailable in secure mode";
|
static const char err_secure[] = "\aUnavailable in secure mode";
|
||||||
|
static const char err_num_cpus[] = "\aSorry, terminal is not big enough";
|
||||||
#ifdef WARN_NOT_SMP
|
#ifdef WARN_NOT_SMP
|
||||||
// standardized 'smp' errors
|
// standardized 'smp' errors
|
||||||
static const char err_smp[] = "\aSorry, only 1 cpu detected";
|
static const char err_smp[] = "\aSorry, only 1 cpu detected";
|
||||||
@ -2477,6 +2480,10 @@ static void do_key (unsigned c)
|
|||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '1':
|
case '1':
|
||||||
|
if (Cpu_tot+7 > Screen_rows && !CHKw(Curwin, View_CPUSUM)) {
|
||||||
|
show_msg(err_num_cpus);
|
||||||
|
break;
|
||||||
|
}
|
||||||
#ifdef WARN_NOT_SMP
|
#ifdef WARN_NOT_SMP
|
||||||
if (Cpu_tot > 1) TOGw(Curwin, View_CPUSUM);
|
if (Cpu_tot > 1) TOGw(Curwin, View_CPUSUM);
|
||||||
else show_msg(err_smp);
|
else show_msg(err_smp);
|
||||||
|
8
top.h
8
top.h
@ -391,14 +391,14 @@ typedef struct WIN_t {
|
|||||||
" %#4.1f%% \02us,\03 %#4.1f%% \02sy,\03 %#4.1f%% \02ni,\03 %#4.1f%% \02id,\03 %#4.1f%% \02wa,\03 %#4.1f%% \02hi,\03 %#4.1f%% \02si\03\n"
|
" %#4.1f%% \02us,\03 %#4.1f%% \02sy,\03 %#4.1f%% \02ni,\03 %#4.1f%% \02id,\03 %#4.1f%% \02wa,\03 %#4.1f%% \02hi,\03 %#4.1f%% \02si\03\n"
|
||||||
#ifdef CASEUP_SUMMK
|
#ifdef CASEUP_SUMMK
|
||||||
#define MEMORY_line1 "Mem: \03" \
|
#define MEMORY_line1 "Mem: \03" \
|
||||||
" %8uK \02total,\03 %8uK \02used,\03 %8uK \02free,\03 %8uK \02buffers\03\n"
|
" %8luK \02total,\03 %8luK \02used,\03 %8luK \02free,\03 %8luK \02buffers\03\n"
|
||||||
#define MEMORY_line2 "Swap:\03" \
|
#define MEMORY_line2 "Swap:\03" \
|
||||||
" %8uK \02total,\03 %8uK \02used,\03 %8uK \02free,\03 %8uK \02cached\03\n"
|
" %8luK \02total,\03 %8luK \02used,\03 %8luK \02free,\03 %8luK \02cached\03\n"
|
||||||
#else
|
#else
|
||||||
#define MEMORY_line1 "Mem: \03" \
|
#define MEMORY_line1 "Mem: \03" \
|
||||||
" %8uk \02total,\03 %8uk \02used,\03 %8uk \02free,\03 %8uk \02buffers\03\n"
|
" %8luk \02total,\03 %8luk \02used,\03 %8luk \02free,\03 %8luk \02buffers\03\n"
|
||||||
#define MEMORY_line2 "Swap:\03" \
|
#define MEMORY_line2 "Swap:\03" \
|
||||||
" %8uk \02total,\03 %8uk \02used,\03 %8uk \02free,\03 %8uk \02cached\03\n"
|
" %8luk \02total,\03 %8luk \02used,\03 %8luk \02free,\03 %8luk \02cached\03\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Keyboard Help specially formatted string(s) --
|
// Keyboard Help specially formatted string(s) --
|
||||||
|
Loading…
Reference in New Issue
Block a user