sysinfo patch
John Campbell
jdc at naucse.UUCP
Tue Sep 5 02:52:52 AEST 1989
Patch for Lenny Tropiano's sysinfo program for the UNIX PC.
By John Campbell ...!arizona!naucse!jdc
This patch prevents sysinfo from writing to the 2 bottom lines of the Unix
PC screen if those lines are being used by another program. This patch
will be useful to users of GNUPLOT 1.10A, which uses those 2 lines for
range information. It will, of course, work with any other program, such as
the UA, the phone manager, etc... that uses these 2 lines (ie: soft keys.)
To apply it, feed it to Larry Wall's patch program. If you don't have it
and can't get it, apply it by hand.
*** sysinfo.c.orig Sun Jun 18 20:25:06 1989
--- sysinfo.c Mon Jun 19 20:54:19 1989
***************
*** 164,169
mailcheck(mailbuffer);
loadaverage(loadbuf);
utd.ut_num = WTXTSLK1;
sprintf(utd.ut_text,LINE_1,
mailbuffer, loadbuf,
--- 164,170 -----
mailcheck(mailbuffer);
loadaverage(loadbuf);
+ if (line_free (wd, WTXTSLK1, 21, "Load")) {
utd.ut_num = WTXTSLK1;
sprintf(utd.ut_text,LINE_1,
mailbuffer, loadbuf,
***************
*** 172,177
mins,(mins == 1) ? " " : "s"
);
ioctl(wd, WIOCSETTEXT, &utd);
utd.ut_num = WTXTSLK2;
freemem = memory() / MEGABYTE;
--- 173,179 -----
mins,(mins == 1) ? " " : "s"
);
ioctl(wd, WIOCSETTEXT, &utd);
+ }
if (line_free (wd, WTXTSLK2, 0, "File")) {
utd.ut_num = WTXTSLK2;
***************
*** 173,178
);
ioctl(wd, WIOCSETTEXT, &utd);
utd.ut_num = WTXTSLK2;
freemem = memory() / MEGABYTE;
sprintf(utd.ut_text,LINE_2,
--- 175,181 -----
ioctl(wd, WIOCSETTEXT, &utd);
}
+ if (line_free (wd, WTXTSLK2, 0, "File")) {
utd.ut_num = WTXTSLK2;
freemem = memory() / MEGABYTE;
sprintf(utd.ut_text,LINE_2,
***************
*** 181,186
* 100.0), fs.s_tinode, freemem
);
ioctl(wd, WIOCSETTEXT, &utd);
#ifdef CHGWIND
close(wd);
#endif
--- 184,190 -----
* 100.0), fs.s_tinode, freemem
);
ioctl(wd, WIOCSETTEXT, &utd);
+ }
#ifdef CHGWIND
close(wd);
#endif
***************
*** 329,331
return(ctob(mem));
}
--- 333,360 -----
return(ctob(mem));
}
+
+ int line_free (wd, line_num, offset, buf)
+ int line_num, offset;
+ char *buf;
+ {
+ int i;
+ char *ptr;
+
+ utd.ut_num = line_num;
+ ioctl(wd, WIOCGETTEXT, &utd);
+
+ /* Count blanks, if 80 then return 1. */
+ for (i=0, ptr=utd.ut_text; i < 80; ++i, ++ptr)
+ if (*ptr != ' ') break;
+ if (i == 80 || *ptr == '\0') return 1;
+
+ /* Otherwise see if the string is an expected string... */
+ ptr = utd.ut_text + offset;
+ while (*buf == *ptr) {
+ ++buf;
+ ++ptr;
+ }
+
+ return *buf == '\0';
+ }
----------------------------------------------------------------------
--
John Campbell ...!arizona!naucse!jdc
CAMPBELL at NAUVAX.bitnet
unix? Sure send me a dozen, all different colors.
More information about the Unix-pc.sources
mailing list