Subject: bin/10851: A new trivial feature to systat
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jate@uwasa.fi>
List: netbsd-bugs
Date: 08/17/2000 05:33:15
>Number: 10851
>Category: bin
>Synopsis: A new trivial feature to systat
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Aug 17 05:34:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Jarkko Teppo
>Release: NetBSD-1.5ALPHA
>Organization:
none
>Environment:
NetBSD muuli 1.5_ALPHA (MUULI) #1: Thu Aug 17 06:45:59 PDT 2000
jarkko@muuli:/mnt/usr/src/sys/arch/hp300/compile/MUULI hp300
>Description:
It would be nice to have an "all" mode to systat which would cycle
between all working modes, sort of like VMS' MONITOR ALL -command.
A quick and really dirty patch against 1.5ALPHA2 is provided, though
it should be rewritten. Consider it as a motivational example:)
>How-To-Repeat:
>Fix:
*** main.c.orig Sun Jun 4 11:29:13 2000
--- main.c Thu Aug 17 12:12:36 2000
***************
*** 83,88 ****
--- 83,91 ----
WINDOW *wnd;
int CMDLINE;
+ int allflag;
+ int allcounter;
+
static WINDOW *wload; /* one line window for load average */
static void usage __P((void));
***************
*** 141,149 ****
modefound++;
break;
}
}
! if (!modefound)
error("%s: Unknown command.", argv[0]);
}
--- 144,156 ----
modefound++;
break;
}
+ if(strstr("all",argv[0]) == "all"){
+ allcounter=0;
+ allflag=1;
+ }
}
! if (!modefound && !allflag)
error("%s: Unknown command.", argv[0]);
}
***************
*** 250,260 ****
{
int j;
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGALRM);
sigprocmask(SIG_BLOCK, &set, NULL);
-
/* Get the load average over the last minute. */
(void)getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
(*curmode->c_fetch)();
--- 257,267 ----
{
int j;
sigset_t set;
+ struct mode *p;
sigemptyset(&set);
sigaddset(&set, SIGALRM);
sigprocmask(SIG_BLOCK, &set, NULL);
/* Get the load average over the last minute. */
(void)getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
(*curmode->c_fetch)();
***************
*** 282,287 ****
--- 289,305 ----
wrefresh(wnd);
move(CMDLINE, col);
refresh();
+ if(allflag && signo==SIGALRM){
+ if(allcounter>2){ /*XXX Replace with something sane*/
+ p=curmode;
+ p++;
+ if(p->c_name==NULL)
+ p=modes;
+ switch_mode(p);
+ allcounter=0;
+ }
+ else allcounter++;
+ }
sigprocmask(SIG_UNBLOCK, &set, NULL);
alarm(naptime);
}
*** cmds.c.orig Mon Jun 5 14:48:25 2000
--- cmds.c Thu Aug 17 11:28:54 2000
***************
*** 50,55 ****
--- 50,56 ----
#include "extern.h"
void switch_mode __P((struct mode *p));
+ extern int allflag;
void
command(cmd)
***************
*** 105,112 ****
--- 106,115 ----
struct mode *p;
{
int switchfail;
+ struct mode *r;
switchfail = 0;
+ r=p;
if (curmode == p)
return;
***************
*** 139,147 ****
curmode = p;
labels();
display(0);
! if (switchfail)
error("Couldn't switch mode, back to %s", curmode->c_name);
! else
status();
}
--- 142,153 ----
curmode = p;
labels();
display(0);
! if (switchfail && !allflag)
error("Couldn't switch mode, back to %s", curmode->c_name);
! else if(switchfail && allflag){
! r++; switch_mode(r);
! }
! else
status();
}
>Release-Note:
>Audit-Trail:
>Unformatted: