Patch to allow "sysinfo" change to the current active window.
Lenny Tropiano
lenny at icus.UUCP
Sun Jan 31 13:51:55 AEST 1988
I made a few changes to allow only one sysinfo process display on
the software label lines on your currently active window. The only
drawback to this is that the software labels of the User Agent, or
another process that displays labels, will be over written by the
sysinfo information.
There might be a delay between the window manager's window activation
and the new display of the information. This depends on how fast the
window manager creates the new window (system load). The SIGWIND
signal is caught, and a new CURRENT window is gotten, but if the system
is slow it will still be the old window. In that case the information
won't be displayed until the sleep(SLEEP) is done.
Apply the following patch with "patch" :-)
--- cut here for patch --- --- cut here for patch --- --- cut here for patch ---
*** sysinfo.c Sat Jan 30 22:31:05 1988
--- ../sysinfo.c Sat Jan 30 22:21:48 1988
***************
*** 4,9
** Programmer: Lenny Tropiano UUCP: ...icus!lenny **
** Organization: ICUS Computer Group (c)1988 **
** Date: January 23, 1988 **
** **
**************************************************************************
** **
--- 4,10 -----
** Programmer: Lenny Tropiano UUCP: ...icus!lenny **
** Organization: ICUS Computer Group (c)1988 **
** Date: January 23, 1988 **
+ ** Patchlevel: 1 [Updated to switch to current window] **
** **
**************************************************************************
** **
***************
*** 34,39
#include <sys/window.h>
#include <sys/filsys.h>
#include <utmp.h>
#define MINUTE 60L
#define HOUR (60L * 60L)
--- 35,41 -----
#include <sys/window.h>
#include <sys/filsys.h>
#include <utmp.h>
+ #include <setjmp.h>
#define MINUTE 60L
#define HOUR (60L * 60L)
***************
*** 49,54
#define TRUE 1
#endif
char *progname; /* program name */
char mailfile[30]; /* mailbox file name */
struct utdata utd; /* Window data structure */
--- 51,58 -----
#define TRUE 1
#endif
+ int wd; /* window descriptor */
+ jmp_buf jmpbuf; /* save the current environ */
char *progname; /* program name */
char mailfile[30]; /* mailbox file name */
struct utdata utd; /* Window data structure */
***************
*** 98,103
info_process()
{
char mailbuffer[40];
while (TRUE) {
--- 102,108 -----
info_process()
{
+ int refrsh();
char mailbuffer[40];
signal (SIGWIND, refrsh);
***************
*** 100,105
{
char mailbuffer[40];
while (TRUE) {
filestatus();
uptime();
--- 105,112 -----
int refrsh();
char mailbuffer[40];
+ signal (SIGWIND, refrsh);
+
while (TRUE) {
setjmp(jmpbuf);
open_current_window();
***************
*** 101,106
char mailbuffer[40];
while (TRUE) {
filestatus();
uptime();
mailcheck(mailbuffer);
--- 108,116 -----
signal (SIGWIND, refrsh);
while (TRUE) {
+ setjmp(jmpbuf);
+ open_current_window();
+
filestatus();
uptime();
mailcheck(mailbuffer);
***************
*** 112,118
hrs, (hrs == 1) ? " " : "s",
mins,(mins == 1) ? " " : "s"
);
! ioctl(0, WIOCSETTEXT, &utd);
utd.ut_num = WTXTSLK2;
sprintf(utd.ut_text,LINE_2,
--- 122,128 -----
hrs, (hrs == 1) ? " " : "s",
mins,(mins == 1) ? " " : "s"
);
! ioctl(wd, WIOCSETTEXT, &utd);
utd.ut_num = WTXTSLK2;
sprintf(utd.ut_text,LINE_2,
***************
*** 120,127
(int)((((float)fs.s_tfree / (float)fs.s_fsize) + 0.005)
* 100.0), fs.s_tinode
);
! ioctl(0, WIOCSETTEXT, &utd);
!
sleep(SLEEP);
}
}
--- 130,137 -----
(int)((((float)fs.s_tfree / (float)fs.s_fsize) + 0.005)
* 100.0), fs.s_tinode
);
! ioctl(wd, WIOCSETTEXT, &utd);
! close(wd);
sleep(SLEEP);
}
}
***************
*** 124,129
sleep(SLEEP);
}
}
int terminate()
--- 134,173 -----
close(wd);
sleep(SLEEP);
}
+ }
+
+ int refrsh()
+ {
+ int window,
+ dummy,
+ refrsh();
+ char windev[9];
+
+ signal(SIGWIND,SIG_IGN);
+ window = ioctl(0, WIOCGPREV, dummy);
+ sprintf(windev,"/dev/w%d",window);
+ if ((wd = open(windev,O_RDWR|O_NDELAY)) == -1)
+ wd = 0;
+ utd.ut_num = WTXTSLK1; /* clear the label area */
+ utd.ut_text[0] = '\0';
+ ioctl(wd, WIOCSETTEXT, &utd);
+ utd.ut_num = WTXTSLK2;
+ ioctl(wd, WIOCSETTEXT, &utd);
+ close(wd); /* close previous window */
+ longjmp(jmpbuf, 0); /* return back to main loop */
+ }
+
+ int open_current_window()
+ {
+ int window,
+ dummy,
+ refrsh();
+ char windev[9];
+
+ window = ioctl(0, WIOCGCURR, dummy);
+ sprintf(windev,"/dev/w%d",window);
+ if ((wd = open(windev,O_RDWR|O_NDELAY)) == -1)
+ wd = 0;
}
int terminate()
--
============================ US MAIL: Lenny Tropiano, ICUS Computer Group
IIIII CCC U U SSSS PO Box 1
I C C U U S Islip Terrace, New York 11752
I C U U SSS PHONE: (516) 968-8576 [H] (516) 582-5525 [W]
I C C U U S AT&T MAIL: ...attmail!icus!lenny TELEX: 154232428
IIIII CCC UUU SSSS UUCP:
============================ ...{uunet!godfre, harvard!talcott}!\
...{ihnp4, boulder, mtune, bc-cis, ptsfa, sbcs}! >icus!lenny
"Usenet the final frontier" ...{cmcl2!phri, hoptoad}!dasys1!/
More information about the Unix-pc.sources
mailing list