bit of top hacking

This commit is contained in:
albert 2006-06-25 01:14:24 +00:00
parent a791f8034f
commit 1e73c7b8bc
2 changed files with 11 additions and 4 deletions

7
top.c
View File

@ -273,6 +273,7 @@ static int chin (int ech, char *buf, unsigned cnt)
// This routine simply formats whatever the caller wants and
// 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 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,
// if P_WCH had been selected and the program is restarted, the
// 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, ...)
{
char tmp[SMLBUFSIZ];
@ -2470,6 +2472,7 @@ static void do_key (unsigned c)
{
// standardized 'secure mode' errors
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
// standardized 'smp' errors
static const char err_smp[] = "\aSorry, only 1 cpu detected";
@ -2477,6 +2480,10 @@ static void do_key (unsigned c)
switch (c) {
case '1':
if (Cpu_tot+7 > Screen_rows && !CHKw(Curwin, View_CPUSUM)) {
show_msg(err_num_cpus);
break;
}
#ifdef WARN_NOT_SMP
if (Cpu_tot > 1) TOGw(Curwin, View_CPUSUM);
else show_msg(err_smp);

8
top.h
View File

@ -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"
#ifdef CASEUP_SUMMK
#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" \
" %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
#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" \
" %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
// Keyboard Help specially formatted string(s) --