debian/0000755000000000000000000000000011727114651007173 5ustar debian/rules0000755000000000000000000000207111724475543010262 0ustar #!/usr/bin/make -f # Made with the aid of debmake, by Christoph Lameter, # based on the sample debian/rules file for GNU hello by Ian Jackson. # Handmodified by P. Frauenfelder for debhelper support, 5 Sept 1998 build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: dh_testdir xmkmf make touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp xmkmf make clean rm Makefile dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs make install DESTDIR=$(CURDIR)/debian/wmnet binary-indep: build install # There are no architecture-independent files to be uploaded # generated by this package. If there were any they would be # made here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs Changelog dh_installdocs README dh_installmenu dh_installman wmnet.man dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: binary binary-arch binary-indep clean build install debian/control0000644000000000000000000000120311724477166010604 0ustar Source: wmnet Section: x11 Priority: optional Maintainer: Martin Lazar Standards-Version: 3.9.3 Build-Depends: debhelper (>= 5), libx11-dev, libxext-dev, xutils-dev Homepage: http://www.katharineosborne.com/wmnet/ Package: wmnet Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, netbase Suggests: wmaker Description: network monitor for WindowMaker This little program polls network statistics and does a few things with the data it gets. The speedometer keeps track of the current speed per second and shows it in a color corresponding to which of rx or tx that has the highest speed at the moment. debian/source/0000755000000000000000000000000011724467600010475 5ustar debian/source/format0000644000000000000000000000001411724467600011703 0ustar 3.0 (quilt) debian/copyright0000644000000000000000000000171611727113302011123 0ustar This package was debianized by Philipp Frauenfelder on Wed, 29 Jul 1998 21:53:48 +0200. It is now maintained by Martin Lazar It was downloaded from http://isufug.ee.iastate.edu/~joff/wmnet.html, then http://www.katharineosborne.com/wmnet/, now at http://dockapps.windowmaker.org/file.php/id/77 wmnet was created by Jesse B. Off and is upstream maintained by Katharine Osborne . Copyright: 1998 Jesse B. Off 2000 Katharine Osborne Licence: This software is released under the GNU General Public License agreement. No warranties, whatever.... you know the usuals.... this is free software. if you use it, great... if you wanna make a change to it, great, but please send me the diff. On a Debian system the complete text of the GNU General Public License can be found in the file `/usr/share/common-licenses/GPL' debian/compat0000644000000000000000000000000211724467264010401 0ustar 5 debian/changelog0000644000000000000000000001641011727114644011051 0ustar wmnet (1.06-1) unstable; urgency=low * New upstream version * Switch to dpkg-source 3.0 (quilt) format * Bump Standards-Version to 3.9.3 * Fixed lintian warnings: - debian-rules-missing-recommended-target build-arch - debian-rules-missing-recommended-target build-indep - debhelper-but-no-misc-depends * Fix when values in /proc/net/dev are getting big (Closes: #639967) * Fixed spelling errors: - wmnet.c, debian/copyright: "GNU General Public License" - wmnet.man: "overridden" * Update Sandro Tosi's email in debian/patches/* * Add new upstream maintainer to debian/copyright -- Martin Lazar Sat, 03 Mar 2012 21:20:19 +0100 wmnet (1.05-17) unstable; urgency=low * Adopting package (Closes: #490737) * debian/control - set myself as maintainer - removed rman from build dependencies (Closes: #492132) * debian/copyright - set myself as new maintainer * debian/patches/01_restore_pristine_code.dpatch - removed changes to Makefile (it is automaticaly generated from Imakefile) * debian/patches/10_fix_manpage_minus.dpatch - added description (fix lintian dpatch-missing-description warning) -- Martin Lazar Sat, 03 Mar 2012 20:22:41 +0100 wmnet (1.05-16) unstable; urgency=low * debian/control - replaced xutils build-dep with xutils-dev; thanks to Daniel Schepler for the report; Closes: #485275 - bump Standards-Version to 3.8.0 + debian/README.source added -- Sandro Tosi Fri, 11 Jul 2008 23:24:19 +0200 wmnet (1.05-15) unstable; urgency=low * debian/control - added some build-dependency (Closes: #450534) - bump Standards-Version to 3.7.3 - added dpatch dependency - removed x11proto-xext-dev build-dep since libxext-dev depends on it * debian/menu - updated menu section (for menu migration) * debian/rules - dpatch integration * debian/patches/01_restore_pristine_code.dpatch - added to remove upstream code direct modification * debian/patches/10_fix_manpage_minus.dpatch - fix lintian warning about manpage and minus characters * debian/patches/01_restore_pristine_code.dpatch - removed changes to manpage (see bug #106382) * debian/patches/10_fix_manpage_minus.dpatch - updated due to some changes have been removed (see bug #106382) * debian/patches/20_bts-106382_fix_arrows_direction.dpatch - added to fix arrows directions (Closes: #106382) Thanks to Matthew Ashton for the patch -- Sandro Tosi Sat, 05 Jan 2008 11:19:19 +0100 wmnet (1.05-14) unstable; urgency=low * Adopting package (Closes: #406775) * debian/control - set myself as maintainer - bump Standards-Version to 3.7.2 - build depends on debhelper >=5 - little reformat of short and long description - add Homepage field on source stanza and linking to right url - removed dependency against rman * debian/compat - bump to 5 * debian/copyright - separation of copyright and licence sections - fixed upstream website - set myself as new maintainer - add reference to GPL licence file on debian box - note on new upstream maintainer * debian/watch - bump to version 3 - fixed of URL to check * debian/menu - moved entry to Applications/Network - fixed binary location * debian/rules - add dh_installman call - add install target (and fix targets dependency) - removed unneded "rm" command in build-arch target - removed make invokation for man install -- Sandro Tosi Mon, 01 Oct 2007 19:42:27 +0200 wmnet (1.05-13) unstable; urgency=low * Remove references to /usr/X11R6/* from debian/dirs. -- Philipp Frauenfelder Thu, 20 Apr 2006 21:47:31 +0200 wmnet (1.05-12) unstable; urgency=low * Rebuild against new X11. Closes: #362950 -- Philipp Frauenfelder Mon, 17 Apr 2006 15:50:56 +0200 wmnet (1.05-11) unstable; urgency=low * Add command line option to choose X display to use. Thanks to Armin Kretschmer for the patch. * Bumped standards version. -- Philipp Frauenfelder Tue, 1 Nov 2005 20:50:19 +0100 wmnet (1.05-10) unstable; urgency=low * Move man page more gracefully. dh_installman is not needed. -- Philipp Frauenfelder Wed, 4 Aug 2004 11:17:33 +0200 wmnet (1.05-9) unstable; urgency=low * Added debian/watch file. I am not upgrading to the latest upstream release as this does only improve support for OpenBSD and is said not work less reliably on Linux. * Removed ipac from suggestions. Closes: #254216 * Removed references to IP accounting from package description as it also works without. * Changed xlibs-dev to libx11-dev in build dependencies. Added rman to build dependencies to build man page. * Debhelper compat 4 mode. * More lintian clean (only imake induced warnings remain). -- Philipp Frauenfelder Wed, 4 Aug 2004 08:46:37 +0200 wmnet (1.05-8) unstable; urgency=low * Fix drawing problems with partially covered window. Thanks to Trilobit for the patch. Closes: #221770 * Bumped standards version to 3.6.1 -- Philipp Frauenfelder Thu, 20 Nov 2003 07:50:39 +0100 wmnet (1.05-7) unstable; urgency=low * Corrected man page: graph documentation had swapped tx/rx description. Closes: #105803 -- Philipp Frauenfelder Fri, 20 Jul 2001 06:25:02 +0000 wmnet (1.05-6) unstable; urgency=low * Changes to make wmnet compile with gcc-3.0 (important for hppa and ia64. Closes: #103274 Also in this bug report: a wish that I should get rid of xmkmf, but I do not know enough about configure or xmkmf to do that on my own... -- Philipp Frauenfelder Fri, 6 Jul 2001 06:41:23 +0000 wmnet (1.05-5) unstable; urgency=low * New standards version: 3.2.1, including build dependencies * Updated copyright information: new upstream and new site -- Philipp Frauenfelder Wed, 3 Jan 2001 15:26:57 +0100 wmnet (1.05-4) unstable; urgency=low * Recompiled with new debhelper to get FHS compliance. -- Philipp Frauenfelder Wed, 29 Sep 1999 14:35:00 +0200 wmnet (1.05-3) unstable; urgency=low * Applied patch from Bart Warmerdam fixing a a problem on Alpha. Closes: #39246. * Standards-Version: 3.0.1. -- Philipp Frauenfelder Thu, 2 Sep 1999 23:14:27 +0200 wmnet (1.05-2) unstable; urgency=low * Recompile with glibc2.1 * Added patch from Nelson Minar fixing a problem with traffic > 1GB (wmnet only shows received traffic, not transmitted). -- Philipp Frauenfelder Wed, 28 Apr 1999 17:21:40 +0200 wmnet (1.05-1) unstable; urgency=low * New upstream version. -- Philipp Frauenfelder Sun, 11 Oct 1998 14:28:44 +0200 wmnet (1.04-2) unstable; urgency=low * Changed architecture to any, fixes #27459 * Fixed typo in debian/control and clarified the ipfwadm / ipac thing. -- Philipp Frauenfelder Tue, 15 Sep 1998 21:45:04 +0200 wmnet (1.04-1) unstable; urgency=low * Initial Release. -- Philipp Frauenfelder Sat, 5 Sep 1998 10:30:04 +0200 debian/watch0000644000000000000000000000011011724467264010224 0ustar version=3 http://www.katharineosborne.com/wmnet/ wmnet-([\d\.]*).tar.gz debian/menu0000644000000000000000000000016311724467264010072 0ustar ?package(wmnet):needs="x11" section="Applications/Network/Monitoring"\ title="wmnet" command="/usr/bin/wmnet -l" debian/dirs0000644000000000000000000000003311724467264010063 0ustar usr/bin usr/share/man/man1 debian/patches/0000755000000000000000000000000011727111531010614 5ustar debian/patches/40_spelling-error.patch0000644000000000000000000000200511725022554015105 0ustar Author: Description: fixed spelling error * GNU Public License => GNU General Public License * overriden => overridden --- a/wmnet.c +++ b/wmnet.c @@ -140,7 +140,7 @@ case 'v': printf("wmnet 1.06\n" "Copyright (C) 1998, 2000 Jesse B. Off, Katharine Osborne \n" - "This program is released under the terms of the GNU Public License.\n"); + "This program is released under the terms of the GNU General Public License.\n"); exit(14); break; case 'X': --- a/wmnet.man +++ b/wmnet.man @@ -88,7 +88,7 @@ sets the initial state of wmnet. WMnet tries to automatically determine which state to start up in by starting up in withdrawn state if a WindowMaker defined atom is present, and in normalstate otherwise. This behavior is -overriden by specifying one of these options. +overridden by specifying one of these options. .TP .B -e,--execute=\fICOMMAND executes \fICOMMAND \fPon a single click from button 1 (left mouse button). debian/patches/30_bts-639967_fix_big_proc_net_dev.patch0000644000000000000000000000672211724505447017753 0ustar Author: Adam Lackorzynski Description: Fix when values in /proc/net/dev are getting big (see bug #639967) --- a/drivers.c +++ b/drivers.c @@ -60,8 +60,8 @@ extern char buffer[256]; extern char *in_rule_string, *out_rule_string, *device; -extern unsigned long totalbytes_in, totalbytes_out, lastbytes_in, lastbytes_out; -extern unsigned long totalpackets_in, totalpackets_out, lastpackets_in, lastpackets_out; +extern unsigned long long totalbytes_in, totalbytes_out, lastbytes_in, lastbytes_out; +extern unsigned long long totalpackets_in, totalpackets_out, lastpackets_in, lastpackets_out; extern unsigned int diffpackets_in, diffpackets_out, diffbytes_in, diffbytes_out; extern unsigned int out_rule, in_rule; /* number of rule in /proc/net/ip_acct to use */ extern Bool current_tx, current_rx, rx, tx; @@ -197,7 +197,7 @@ flag |= ACCOUNT_IN_FOUND; while(buffer[offset++] != ' '); offset += 18; - totalpackets_in = strtoul(&buffer[offset], &ptr, 10); + totalpackets_in = strtoull(&buffer[offset], &ptr, 10); if (totalpackets_in == lastpackets_in) break; totalbytes_in = strtoul(ptr, NULL, 10); diffpackets_in += totalpackets_in - lastpackets_in; @@ -211,7 +211,7 @@ flag |= ACCOUNT_OUT_FOUND; while(buffer[offset++] != ' '); offset += 18; - totalpackets_out = strtoul(&buffer[offset], &ptr, 10); + totalpackets_out = strtoull(&buffer[offset], &ptr, 10); if (totalpackets_out == lastpackets_out) break; totalbytes_out = strtoul(ptr, NULL, 10); diffpackets_out += totalpackets_out - lastpackets_out; @@ -371,9 +371,9 @@ packets_in_str = bytes_in_str; NEXTFIELD(packets_in_str); - totalpackets_in = strtoul(packets_in_str, NULL, 10); + totalpackets_in = strtoull(packets_in_str, NULL, 10); if (totalpackets_in != lastpackets_in) { - totalbytes_in = strtoul(bytes_in_str, NULL, 10); + totalbytes_in = strtoull(bytes_in_str, NULL, 10); diffpackets_in += totalpackets_in - lastpackets_in; diffbytes_in += totalbytes_in - lastbytes_in; lastpackets_in = totalpackets_in; @@ -391,9 +391,9 @@ packets_out_str = bytes_out_str; NEXTFIELD(packets_out_str); - totalpackets_out = strtoul(packets_out_str, NULL, 10); + totalpackets_out = strtoull(packets_out_str, NULL, 10); if (totalpackets_out != lastpackets_out) { - totalbytes_out = strtoul(bytes_out_str, NULL, 10); + totalbytes_out = strtoull(bytes_out_str, NULL, 10); diffpackets_out += totalpackets_out - lastpackets_out; diffbytes_out += totalbytes_out - lastbytes_out; lastpackets_out = totalpackets_out; --- a/wmnet.h +++ b/wmnet.h @@ -77,8 +77,8 @@ /* I know statically declared buffers are against GNU coding standards, so sue me */ char buffer[256], *click_command = NULL, *label = NULL; struct timeval timenow, timelast; -unsigned long totalbytes_in, totalbytes_out, lastbytes_in, lastbytes_out; -unsigned long totalpackets_in, totalpackets_out, lastpackets_in, lastpackets_out; +unsigned long long totalbytes_in, totalbytes_out, lastbytes_in, lastbytes_out; +unsigned long long totalpackets_in, totalpackets_out, lastpackets_in, lastpackets_out; unsigned int diffpackets_in, diffpackets_out, diffbytes_in, diffbytes_out; unsigned int delayTime = 25000, displayDelay = 55000, maxRate = 6000; unsigned int out_rule = 2, in_rule = 1, graphbox_height = 44; /* number of rule in /proc/net/ip_acct to use */ debian/patches/20_bts-106382_fix_arrows_direction.patch0000644000000000000000000000264011727111531017774 0ustar Author: Sandro Tosi Description: Based on the patch of Matthew Ashton, this fix arrows direction, as in upstream willing --- a/wmnet.c +++ b/wmnet.c @@ -613,21 +613,21 @@ XSetBackground(dpy, graphics_context, black_pixel); if(current_tx == True) { XSetForeground(dpy, graphics_context, tx_pixel[HIGH_INTENSITY]); - XCopyPlane(dpy, arrow, *visible_window, graphics_context, 7, 0, 7, 9, 53, 5, 1); + XCopyPlane(dpy, arrow, *visible_window, graphics_context, 0, 0, 7, 9, 46, 5, 1); /* XFillRectangle(dpy, *visible_window, graphics_context, 55, 5, 4, 4); */ } else { XSetForeground(dpy, graphics_context, grey_pixel); - XCopyPlane(dpy, arrow, *visible_window, graphics_context, 7, 0, 7, 9, 53, 5, 1); + XCopyPlane(dpy, arrow, *visible_window, graphics_context, 0, 0, 7, 9, 46, 5, 1); } if(current_rx == True) { XSetForeground(dpy, graphics_context, rx_pixel[HIGH_INTENSITY]); - XCopyPlane(dpy, arrow, *visible_window, graphics_context, 0, 0, 7, 9, 46, 5, 1); + XCopyPlane(dpy, arrow, *visible_window, graphics_context, 7, 0, 7, 9, 53, 5, 1); /* XFillRectangle(dpy, *visible_window, graphics_context, 55, 12, 4, 4); */ } else { XSetForeground(dpy, graphics_context, grey_pixel); - XCopyPlane(dpy, arrow, *visible_window, graphics_context, 0, 0, 7, 9, 46, 5, 1); + XCopyPlane(dpy, arrow, *visible_window, graphics_context, 7, 0, 7, 9, 53, 5, 1); } } debian/patches/10_fix_manpage_minus.patch0000644000000000000000000000776011727111521015637 0ustar Author: Sandro Tosi Description: Escape hyphens in manual page --- a/wmnet.man +++ b/wmnet.man @@ -28,7 +28,7 @@ the data it gets. It has small blinking lights for the rx and tx of IP packets, a digital speedometer of your networks current speed and a bar graph like xload plotting your throughput. It -has a tx speed graph from bottom-up and rx speed graph from the top-down. +has a tx speed graph from bottom\-up and rx speed graph from the top\-down. The speedometer keeps track of the current speed per second and shows it in a color corresponding to which of rx or tx that has the highest speed at the moment. Also, the graph is drawn in a way that the highest @@ -59,10 +59,10 @@ .B \-x,--maxrate=\fIBYTES maximum transfer rate for graph scale. Defaults to 6000, which should be in the right area for modem connections. The key is to experiment -with this setting and the --logscale option to get the kind of graph +with this setting and the \-\-logscale option to get the kind of graph that fits your connection type. A general rule of thumb is to set this to 4 to 5 times greater than your maximum throughput. The author finds -using --logscale and --maxrate=10000000 to work nicely for the entire range +using \-\-logscale and \-\-maxrate=10000000 to work nicely for the entire range of his dorms ethernet based connection to the internet. .TP @@ -107,7 +107,7 @@ .TP .B -D,--driver=\fIDRIVER use \fIDRIVER \fP to get the stats we monitor. Compiled in drivers can be listed -with the -h switch. +with the \-h switch. .TP .B -W,--device=\fIDEVICE watch statistics for \fIDEVICE \fP. This option is only used for certain @@ -120,28 +120,28 @@ network. Exactly what drivers are available is determined at compile time. The driver wmnet ultimately uses at runtime is dependent on your system. There are 4 drivers specific to Linux and 1 to *BSD. The driver used can be overridden -by the --driver option. The available drivers are \fIpppstats, devstats, ipfwadm, +by the \-\-driver option. The available drivers are \fIpppstats, devstats, ipfwadm, ipchains\fP and \fIkmem\fP. .TP .B pppstats this driver works on Linux 2.0 or Linux 2.1 for ONLY ppp type devices. -Specify the \fI--device\fP option for the interface to monitor. By default it +Specify the \fI\-\-device\fP option for the interface to monitor. By default it uses interface ppp0. Please note, that if the ppp device is not available or active, wmnet will continue to try in the hopes that it is only temporarily offline. .TP .B devstats -use this driver on Linux 2.1 kernels for any interface. Pass the \fI--device\fP option +use this driver on Linux 2.1 kernels for any interface. Pass the \fI\-\-device\fP option for the device you want monitored, otherwise, the default is eth0. This will be available for ONLY Linux 2.1 kernels and will always be there on those kernels. .TP .B ipfwadm use this driver on Linux 2.0 kernels compiled with IP accounting. It won't work on Linux 2.1. -You'll also need to specify the \fI--txrule\fP and \fI--rxrule\fP options. By default, wmnet uses +You'll also need to specify the \fI\-\-txrule\fP and \fI\-\-rxrule\fP options. By default, wmnet uses the first two rules it finds. .TP .B ipchains this driver will only work in Linux 2.1 kernels with IP chains compiled in. You'll want to also -specify the \fI--txrule\fP and \fI--rxrule\fP options and specify the chain names. By default it +specify the \fI\-\-txrule\fP and \fI\-\-rxrule\fP options and specify the chain names. By default it uses the chains "acctin" and "acctout" There must be at least one rule on the named ipchain, if there is more than one rule in the specified chain, it uses the first. The chain @@ -150,7 +150,7 @@ .TP .B kmem this driver is available on FreeBSD and OpenBSD systems and must be passed -a device through the \fI--device\fP option. By default, it uses ec0 but +a device through the \fI\-\-device\fP option. By default, it uses ec0 but will accept any valid device name. .SH FILES .TP debian/patches/01_restore_pristine_code.patch0000644000000000000000000003254311727111514016537 0ustar Author: Sandro Tosi Description: New patch generated from wmnet 1.05-15 diff.gz --- a/wmnet.c +++ b/wmnet.c @@ -100,9 +100,9 @@ char *txcolorString = NULL, *rxcolorString = NULL, *labelfgcolorString = NULL, *labelbgcolorString = NULL; char *parser = NULL; #ifdef linux - const struct option long_options[19] = { + const struct option long_options[20] = { #else - const struct option long_options[17] = { + const struct option long_options[18] = { #endif {"device", required_argument, NULL, 'W'}, {"label", required_argument, NULL, 'L'}, @@ -124,6 +124,7 @@ {"unpromisc", required_argument, NULL, 'u'}, {"driver", required_argument, NULL, 'D'}, {"version", no_argument, NULL, 'v'}, + {"display", required_argument, NULL, 'X'}, {0, 0, 0, 0} }; @@ -131,9 +132,9 @@ /* Get options */ #ifdef linux - while((c = getopt_long(argc, argv, "W:F:B:L:vp:u:wnle:R:T:r:t:D:d:x:h", long_options, NULL)) != EOF) { + while((c = getopt_long(argc, argv, "W:F:B:L:X:vp:u:wnle:R:T:r:t:D:d:x:h", long_options, NULL)) != EOF) { #else - while((c = getopt_long(argc, argv, "W:F:B:L:vp:u:wnle:r:t:D:d:x:h", long_options, NULL)) != EOF) { + while((c = getopt_long(argc, argv, "W:F:B:L:X:vp:u:wnle:r:t:D:d:x:h", long_options, NULL)) != EOF) { #endif switch(c) { case 'v': @@ -142,6 +143,9 @@ "This program is released under the terms of the GNU Public License.\n"); exit(14); break; + case 'X': + dpy_name = strdup(optarg); + break; case 'W': device = strdup(optarg); break; @@ -280,17 +284,18 @@ "-----------------------------------------------------\n" " -h, --help this help\n" " -v, --version display version information\n" + " -X, --display X server to contact\n" " -L, --label=LABEL display LABEL on bottom of window\n" " -F, --labelfg=COLOR foreground color for the label\n" " -B, --labelbg=COLOR background color for the label\n" - " -e, --execute=COMMAND run COMMAND on click\n" + " -e, --execute=COMMAND run COMMAND on click\n"); #ifdef linux - " -T, --txrule=RULE accounting rule number (ipfwadm) or\n" + printf(" -T, --txrule=RULE accounting rule number (ipfwadm) or\n" " IP chain name (ipchains) to monitor for tx\n" " -R, --rxrule=RULE accounting rule number (ipfwadm) or\n" - " IP chain name (ipchains) to monitor for rx\n" + " IP chain name (ipchains) to monitor for rx\n"); #endif - " -W, --device=DEVICE monitor DEVICE for stats (devstats,kmem,pppstats)\n" + printf(" -W, --device=DEVICE monitor DEVICE for stats (devstats,kmem,pppstats)\n" " -w, --withdrawn start up in withdrawn state\n" " -n, --normalstate start up in normal, shaped state\n" " -t, --txcolor=COLOR color for tx\n" @@ -328,7 +333,7 @@ } /* Open X Display */ - if ((dpy = XOpenDisplay(NULL)) == NULL) { + if ((dpy = XOpenDisplay(dpy_name)) == NULL) { fprintf(stderr,"wmnet: doh...can't connect to X server, giving up\n"); exit(1); } @@ -343,8 +348,10 @@ sigemptyset(&signal_action.sa_mask); signal_action.sa_flags = (SA_NOCLDSTOP|SA_RESTART); #ifdef linux +#if !defined(__alpha) && !defined(__hppa__) && !defined(__ia64__) // Alpha doen't have this structure member signal_action.sa_restorer = NULL; #endif +#endif if ((sigaction(SIGCHLD, &signal_action, NULL) == -1) || (sigaction(SIGINT, &signal_action, NULL) == -1) || (sigaction(SIGTERM, &signal_action, NULL) == -1)) { @@ -426,6 +433,8 @@ root_window = DefaultRootWindow(dpy); createWin(&main_window); + /*Trilobit anlegen eines buffers als pixmap*/ + buffer_pixmap=XCreatePixmap(dpy, root_window, 64, 64, DefaultDepth(dpy, screen)); color.red = color.green = color.blue = 12000; XAllocColor(dpy, DefaultColormap(dpy, screen), &color); @@ -474,9 +483,12 @@ XShapeCombineRectangles(dpy, *visible_window, ShapeBounding, 4, 4, &bound, 1, ShapeBounding, 0); XSelectInput(dpy, *visible_window, (ExposureMask|ButtonPressMask)); XMapSubwindows(dpy, *visible_window); - + /*Trilobit initialisieren des Buffers:*/ + XSetForeground(dpy, graphics_context, darkgrey_pixel); + XFillRectangle(dpy, buffer_pixmap, graphics_context, GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT); } +/*************************** anfang zu verändern ************/ /* Utility function to create a window for setupX() */ void createWin(Window *win) { XClassHint classHint; @@ -522,8 +534,10 @@ XSetBackground(dpy, graphics_context, black_pixel); XCopyPlane(dpy, arrow, *visible_window, graphics_context, 7, 0, 7, 9, 53, 5, 1); XCopyPlane(dpy, arrow, *visible_window, graphics_context, 0, 0, 7, 9, 46, 5, 1); + /*Trilobit ganz billig, einfach buffer zurückschreiben:*/ + XCopyArea(dpy, buffer_pixmap, *visible_window, graphics_context, GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y); } - +/******************* ende zu verändern *********************/ /* Main loop that is called every delaytime. This calls stat_gather() and updateSpeedometer() when needed * and takes care of the displaying and scrolling the graph */ @@ -563,17 +577,17 @@ yy = GRAPH_Y_UPPER + (GRAPH_HEIGHT * percent_tx) ; yy = yy > GRAPH_Y_BOTTOM ? GRAPH_Y_BOTTOM : yy; - +/************************ anfang zu verändern ***************/ /* only update the speedometer every 7th displayDelay */ if (t == 7) updateSpeedometer(rate_rx, rate_tx); /* blank var is just for stopping executing the X* funcs when the disp is all black */ if ((y == GRAPH_Y_BOTTOM && yy == GRAPH_Y_UPPER) && (diffbytes_in + diffbytes_out) == 0) blank++; else blank = 0; if (blank < (GRAPH_WIDTH + 1) ) { - XCopyArea(dpy, *visible_window, *visible_window, graphics_context, GRAPH_X + 1, + XCopyArea(dpy, buffer_pixmap, buffer_pixmap, graphics_context, GRAPH_X + 1, GRAPH_Y, GRAPH_WIDTH - 1, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y); XSetForeground(dpy, graphics_context, darkgrey_pixel); - XDrawLine(dpy, *visible_window, graphics_context, GRAPH_X_RIGHT, y, GRAPH_X_RIGHT, yy); + XDrawLine(dpy, buffer_pixmap, graphics_context, GRAPH_X_RIGHT, y, GRAPH_X_RIGHT, yy); if (( (yy == GRAPH_Y_UPPER && diffbytes_out > 0 && rate_rx > rate_tx) || (rate_rx >= rate_tx && yy != GRAPH_Y_UPPER)) ) { drawColoredLine(GRAPH_Y_UPPER, yy, tx_pixel); } @@ -583,14 +597,17 @@ if (( (yy == GRAPH_Y_UPPER && diffbytes_out > 0) || (rate_rx < rate_tx && yy != GRAPH_Y_UPPER)) ) { drawColoredLine(GRAPH_Y_UPPER, yy, tx_pixel); } - } - + /* Trilobit nachdem buffer zurechtgebastelt, den kram ins fenster kopieren: */ + XCopyArea(dpy, buffer_pixmap, *visible_window, graphics_context, GRAPH_X, + GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y); + }/*END if blank*/ +/************************* ende zu verändern *******************/ diffbytes_in = diffbytes_out = 0; timelast = timenow; } - if (!stat_gather()) { /* Anything change? */ + if (!stat_gather()) { /* Anything change? erneuert nur die Pfeilanzeigen */ current_rx = rx; current_tx = tx; XSetBackground(dpy, graphics_context, black_pixel); @@ -675,7 +692,7 @@ } - +/*************************** anfang zu verändern ***************/ /* called from within tock to draw the shaded lines making up our bar-graph */ void drawColoredLine(int y1, int y2, unsigned long *shadecolor) { int subline[4], i; @@ -684,10 +701,13 @@ for(i = 0; i < 3; i++) { if (y1 > y2) subline[i+1] = y1 - (((y1 - y2) * linebreaks[i]) / 100); else subline[i+1] = y1 + (((y2 - y1) * linebreaks[i]) / 100); - XSetForeground(dpy, graphics_context, shadecolor[i]); - XDrawLine(dpy, *visible_window, graphics_context, GRAPH_X_RIGHT, subline[i], GRAPH_X_RIGHT, subline[i+1]); + XSetForeground(dpy, graphics_context, shadecolor[i]); + /*Trilobit alles erstmal in meinen buffer schreiben: */ + XDrawLine(dpy, buffer_pixmap, graphics_context, GRAPH_X_RIGHT, subline[i], GRAPH_X_RIGHT, subline[i+1]); + //XDrawLine(dpy, *visible_window, graphics_context, GRAPH_X_RIGHT, subline[i], GRAPH_X_RIGHT, subline[i+1]); } } +/************************* ende zu verändern *******************/ /* Returns in returnarray a 3 value array containing 3 shades (low, normal, and high) of XColor shade. --- a/wmnet.h +++ b/wmnet.h @@ -63,9 +63,11 @@ /* X Stuff */ Display *dpy; +char *dpy_name = NULL; Window root_window, main_window, icon_window, *visible_window; Font thefont; Pixmap arrow; +Pixmap buffer_pixmap; /*Trilobit pixmap als zwischenbuffer*/ Atom delete_atom; int screen, specified_state = -1; GC graphics_context; --- a/Imakefile +++ b/Imakefile @@ -1,10 +1,10 @@ DEPLIBS = $(DEPXLIB) -CC = gcc -Wall +CC = gcc -Wall -O2 #ifdef LinuxArchitecture STD_DEFINES = -Dlinux DEFINES = -Dlinux_libc5 -#if LinuxCLibMajorVersion > 5 +#if 1 DEFINES = -Dlinux_libc6 #endif LOCAL_LIBRARIES = $(XLIB) -lm --- a/wmnet.man +++ b/wmnet.man @@ -113,6 +113,8 @@ watch statistics for \fIDEVICE \fP. This option is only used for certain stat drivers, namely: kmem, devstats, and pppstats. The ipchains and ipfwadm stat drivers do not use this parameter. +.B -X,--display=\fDISPLAY +X display to use. .SH STAT DRIVERS wmnet uses different stat drivers to get the stats it needs to monitor your network. Exactly what drivers are available is determined at compile time. The --- a/drivers.c +++ b/drivers.c @@ -9,6 +9,7 @@ * great, but please send me the diff. */ +#include #include #include #include @@ -318,6 +319,11 @@ #ifdef USE_2_1_DEV +/* nelson@media.mit.edu - simple macro to skip to the next field in a character string. + * First skip all the non-space characters, then skip all the space characters. + */ +#define NEXTFIELD(p) while (!isspace(*(p))) (p)++; while (isspace(*(p))) (p)++; + int updateStats_dev(void) { FILE *dev; char *ptr; @@ -332,25 +338,42 @@ "Perhaps we are not running Linux?\n"); exit(4); } - /* the first two lines we can skip */ + /* the first two lines we can skip - just text headers */ fgets(buffer, 256, dev); fgets(buffer, 256, dev); - /* IP Chain Rules for Linux kernel 2_1.x */ + /* devstats for Linux kernel 2_1.x */ while(flag != (ACCOUNT_IN_FOUND|ACCOUNT_OUT_FOUND) && fgets(buffer, 256, dev)) { + /* scan to the first : to find the device name */ ptr = buffer; while(*ptr == ' ') ptr++; name = ptr; while(*ptr != ':') ptr++; - *ptr = '\0'; + *ptr = '\0'; /* ptr used below! */ if (!strcmp(name, device)) { + /* found the device we are monitoring, parse data. */ + /* nelson@media.mit.edu - hacked to deal with variable width data */ + + int i; + char *bytes_in_str, *packets_in_str, *bytes_out_str, *packets_out_str; flag = (ACCOUNT_IN_FOUND|ACCOUNT_OUT_FOUND); - totalpackets_in = strtoul(&buffer[15], NULL, 10); + /* Bytes in is the first field after the : + * Note, there may be no whitespace after : + */ + bytes_in_str = ptr + 1; + while (isspace(*bytes_in_str)) + bytes_in_str++; + + /* Packets in is the next field after bytes in */ + packets_in_str = bytes_in_str; + NEXTFIELD(packets_in_str); + + totalpackets_in = strtoul(packets_in_str, NULL, 10); if (totalpackets_in != lastpackets_in) { - totalbytes_in = strtoul(&buffer[7], NULL, 10); + totalbytes_in = strtoul(bytes_in_str, NULL, 10); diffpackets_in += totalpackets_in - lastpackets_in; diffbytes_in += totalbytes_in - lastbytes_in; lastpackets_in = totalpackets_in; @@ -358,16 +381,29 @@ rx = True; } + /* Bytes out is the seventh field after packets in */ + bytes_out_str = packets_in_str; + for (i = 0; i < 7; i++) { + NEXTFIELD(bytes_out_str); + } + + /* Packets out is the next field after bytes out */ + packets_out_str = bytes_out_str; + NEXTFIELD(packets_out_str); - totalpackets_out = strtoul(&buffer[74], NULL, 10); + totalpackets_out = strtoul(packets_out_str, NULL, 10); if (totalpackets_out != lastpackets_out) { - totalbytes_out = strtoul(&buffer[66], NULL, 10); + totalbytes_out = strtoul(bytes_out_str, NULL, 10); diffpackets_out += totalpackets_out - lastpackets_out; diffbytes_out += totalbytes_out - lastbytes_out; lastpackets_out = totalpackets_out; lastbytes_out = totalbytes_out; tx = True; } +#ifdef NELSONDEBUG + fprintf(stderr, "%lu %lu %lu %lu\n", totalbytes_in, totalpackets_in, + totalbytes_out, totalpackets_out); +#endif } } debian/patches/series0000644000000000000000000000024411725022362012032 0ustar 01_restore_pristine_code.patch 10_fix_manpage_minus.patch 20_bts-106382_fix_arrows_direction.patch 30_bts-639967_fix_big_proc_net_dev.patch 40_spelling-error.patch