+ */
--- wmmon-1.0b2.orig/wmmon/wmmon.c
+++ wmmon-1.0b2/wmmon/wmmon.c
-@@ -28,6 +28,10 @@
+@@ -28,6 +28,12 @@
Changes:
----
++ 15/05/2004 (Simon Law, sfllaw@debian.org)
++ * Support disabling of mode-cycling
+ 23/10/2003 (Simon Law, sfllaw@debian.org)
+ * Eliminated exploitable static buffers
+ * Added -geometry support.
18/05/1998 (Antoine Nulle, warp@xs4all.nl)
* MEM/SWAP/UPTIME only updated when visible
* Using global file descriptors to reduce file
-@@ -65,6 +69,7 @@
+@@ -65,6 +71,7 @@
* First Working Version
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
-@@ -100,31 +105,27 @@
+@@ -100,31 +107,28 @@
/* Global Variables */
/********************/
-char *ProgName;
int stat_current = 0; /* now global */
++int mode_cycling = 1; /* Allow mode-cycling */
FILE *fp_meminfo;
FILE *fp_stat;
FILE *fp_loadavg;
for (i=1; i<argc; i++) {
char *arg = argv[i];
-@@ -132,29 +133,35 @@
+@@ -132,13 +136,17 @@
switch (arg[1]) {
case 'd' :
if (strcmp(arg+1, "display")) {
- case 'v' :
- printversion();
- exit(0);
-- break;
+ case 'g' :
+ if (strcmp(arg+1, "geometry")) {
+ usage(name);
+ return 1;
+ }
++ case 'l' :
++ mode_cycling = 0;
+ break;
case 'i' :
stat_current = 1;
- break;
+@@ -146,15 +154,20 @@
case 's' :
stat_current = 2;
break;
}
/*******************************************************************************\
-@@ -214,8 +221,7 @@
+@@ -214,8 +227,7 @@
long idle;
FILE *fp;
int xpm_X = 0, xpm_Y = 0;
-@@ -246,16 +252,21 @@
+@@ -246,16 +258,21 @@
if (RIGHT_ACTION) right_action = strdup(RIGHT_ACTION);
if (MIDDLE_ACTION) middle_action = strdup(MIDDLE_ACTION);
stat_online = checksysdevs();
-@@ -269,26 +280,36 @@
+@@ -269,26 +286,36 @@
starttime = time(0);
nexttime = starttime + 10;
waitpid(0, NULL, WNOHANG);
-@@ -377,6 +398,9 @@
+@@ -377,6 +404,9 @@
if (curtime >= nexttime) {
nexttime+=10;
for (i=0; i<stat_online; i++) {
if (stat_device[i].his[54])
stat_device[i].his[54] /= stat_device[i].hisaddcnt;
-@@ -430,7 +454,6 @@
+@@ -411,7 +441,7 @@
+ break;
+ case ButtonRelease:
+ i = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
+- if (but_stat == i && but_stat >= 0) {
++ if (but_stat == i && but_stat >= 0 && mode_cycling) {
+ switch (but_stat) {
+ case 0:
+ switch (Event.xbutton.button) {
+@@ -430,7 +460,6 @@
}
case 1:
stat_current++;
if (stat_current == stat_online)
stat_current = 0;
-@@ -499,43 +522,80 @@
+@@ -499,43 +528,80 @@
void update_stat_mem(stat_dev *st, stat_dev *st2) {
}
/*******************************************************************************\
-@@ -545,11 +605,11 @@
+@@ -545,11 +611,11 @@
void get_statistics(char *devname, long *is, long *ds, long *idle) {
int i;
*is = 0;
*ds = 0;
-@@ -557,9 +617,9 @@
+@@ -557,9 +623,9 @@
if (!strncmp(devname, "cpu", 3)) {
fseek(fp_stat, 0, SEEK_SET);
/* 1..3, 4 == idle, we don't want idle! */
for (i=0; i<3; i++) {
p = strtok(NULL, tokens);
-@@ -577,17 +637,35 @@
+@@ -577,17 +643,35 @@
if (!strncmp(devname, "i/o", 3)) {
fseek(fp_stat, 0, SEEK_SET);
}
}
-@@ -715,16 +793,16 @@
+@@ -715,16 +799,17 @@
|* usage *|
\*******************************************************************************/
+ printf("\n");
+ printf(" -display DISPLAY contact the DISPLAY X server\n");
+ printf(" -geometry GEOMETRY position the clock at GEOMETRY\n");
++ printf(" -l locked view - cannot cycle modes\n");
+ printf(" -i start in Disk I/O mode\n");
+ printf(" -s start in System Info mode\n");
+ printf(" -h display this help and exit\n");
}
/*******************************************************************************\
-@@ -733,7 +811,7 @@
+@@ -733,7 +818,7 @@
void printversion(void) {
+ */
--- wmmon-1.0b2.orig/wmmon/wmmon.1
+++ wmmon-1.0b2/wmmon/wmmon.1
-@@ -0,0 +1,185 @@
+@@ -0,0 +1,192 @@
+'\" t
+.\" Man page for wmmon
+.\" Copyright (c) 2003 Software in the Public Interest, Inc.
+.IP \(bu 4
+a realtime CPU stress meter;
+.IP \(bu
-+an auto\-scaled average system load meter, like
++an auto-scaled average system load meter, like
+.B xload
+and
+.BR wmavgload ;
+.IP \(bu
+a realtime disk I/O stress meter;
+.IP \(bu
-+auto\-scaled disk I/O load meter;
++auto-scaled disk I/O load meter;
+.IP \(bu
+realtime memory and swap usage meters;
+.IP \(bu
+a display for system uptime;
+.IP \(bu
-+three user\-defined commands to launch.
++three user-defined commands to launch.
+
+.SH OPTIONS
+
+.IR X(7x) .
+
+.TP
++.BR \-l
++Lock the mode, so that it cannot be cycled by clicking on the upper-left
++widget. You can use this to open multiple copies of
++.BR WMMon ,
++each set to a different mode.
++
++.TP
+.BR \-i
-+start in disk I/O mode, which displays instantaneous disk usage and
++Start in disk I/O mode, which displays instantaneous disk usage and
+average disk load.
+
+.TP
+.BR \-s
-+start in system information mode, which displays memory usage, swap usage,
++Start in system information mode, which displays memory usage, swap usage,
+and uptime.
+
+.TP
+The
+.B WMMon
+display can be cycled between CPU, disk I/O, and system
-+information displays by clicking on the upper\-left widget. This
++information displays by clicking on the upper-left widget. This
+displays CPU information by default.
+
+WMMon can also be used to launch programs. You may click either left,
-+middle, or right mouse buttons in the average\-load section of the
-+window. The pre\-configured program will be launched according to the
++middle, or right mouse buttons in the average-load section of the
++window. The pre-configured program will be launched according to the
+mouse button clicked. (see
+.B CONFIGURATION FILE
+below.)
+
+Window Maker users should drag and drop the
+.B WMMon
-+window on the Dock. Then, right\-click on the border of the window and
++window on the Dock. Then, right-click on the border of the window and
+select \*(lqSettings...\*(rq. Check \*(lqStart when Window Maker
+is started\*(rq.
+
+.SH "CONFIGURATION FILE"
+
+.B WMMon
-+can launch three user\-defined commands, triggered by left, middle and
++can launch three user-defined commands, triggered by left, middle and
+right mouse button clicks. You can define the commands to launch in
+.I $HOME/.wmmonrc
+