# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # wmwave # wmwave/files # wmwave/files/Makefile # wmwave/files/patch-wmwave.c # wmwave/Makefile # wmwave/distinfo # wmwave/pkg-comment # wmwave/pkg-descr # wmwave/pkg-plist # echo c - wmwave mkdir -p wmwave > /dev/null 2>&1 echo c - wmwave/files mkdir -p wmwave/files > /dev/null 2>&1 echo x - wmwave/files/Makefile sed 's/^X//' >wmwave/files/Makefile << 'END-of-wmwave/files/Makefile' X# X# $FreeBSD: ports/net/wmwave/files/Makefile,v 1.1 2001/12/27 20:18:42 lioux Exp $ X# X# makefile for wmwave-0.4 on 27-12-2001 by bms X# XPROG=wmwave XSRCS=wmwave.c wmgeneral.c XMAN1=wmwave.1 X XCFLAGS += -g -I${X11BASE}/include -DWICACHE XLDFLAGS+= -L${X11BASE}/lib -lX11 -lXpm -lXext -lm X XBINDIR=${PREFIX}/bin XMANDIR=${MANPREFIX}/man/man X X# extra dependency to rebuild when master pixmap changed Xwmwave.o: wmwave-master.xpm X X.include END-of-wmwave/files/Makefile echo x - wmwave/files/patch-wmwave.c sed 's/^X//' >wmwave/files/patch-wmwave.c << 'END-of-wmwave/files/patch-wmwave.c' X--- wmwave.c.orig Fri Aug 20 14:44:21 1999 X+++ wmwave.c Tue May 21 11:05:44 2002 X@@ -1,38 +1,21 @@ X /* X+ * $Id$ X+ * X * wmtop.c -- WindowMaker process view dock app X- * Derived by Carsten Schuermann carsten@schuermann.org X- * http://www.schuermann.org/~carsten X- * from X- * Dan Piponi dan@tanelorn.demon.co.uk X- * http://www.tanelorn.demon.co.uk X- * who derived it X- * from code originally contained in wmsysmon by Dave Clark (clarkd@skynet.ca) X+ * X * This software is licensed through the GNU General Public License. X- * $Log: wmwave.c,v $ X- * Revision 1.7 1999/08/20 13:44:21 carsten X- * version 0.4 complete X- * X- * Revision 1.6 1999/08/19 17:58:52 carsten X- * Almost final version X- * X- * Revision 1.5 1999/08/19 13:54:30 carsten X- * done X- * X- * Revision 1.4 1999/08/19 11:14:50 carsten X- * hookup to /proc/net/wirless complete X- * X- * Revision 1.3 1999/08/19 02:39:07 carsten X- * improved design and hooked it up X- * X- * Revision 1.2 1999/08/16 03:45:34 carsten X- * Added dots X- * X- * Revision 1.1 1999/08/15 15:39:18 carsten X- * Added wmwave project to repository X- * X+ * X+ * Authors (in reverse chronological order): X+ * Bruce M. Simpson X+ * Carsten Schuermann X+ * Dan Piponi X+ * Dave Clark X+ * X+ * The FreeBSD version of this software is released under the GNU GPL, and X+ * forms part of the Consume Project . X+ * X */ X X- X #include X #include X #include X@@ -45,313 +28,394 @@ X #include X #include X #include X+#include X X+#include X #include X #include X #include X-#include X #include X #include X+#include X+#include X+ X+#include X+#include X+#include X+#include X+#include X+ X+#include X+#include X+#include X+#include X+#include X+#include X+#include X+ X+#if __FreeBSD_version >= 500015 X+#include X+#else X+#include X+#endif X X #include X #include X #include X X- X #include "wmgeneral.h" X- X #include "wmwave-master.xpm" X X-char wmwave_mask_bits[64*64]; X-int wmwave_mask_width = 64; X-int wmwave_mask_height = 64; X- X-#define WMWAVE_VERSION "0.4" X+char wmwave_mask_bits[64 * 64]; X+int wmwave_mask_width = 64; X+int wmwave_mask_height = 64; X+ X+#define WMWAVE_DEFAULT_INTERFACE "wi0" X+#define WMWAVE_VERSION "0.4_FreeBSD" X+ X+int update_rate = 100000; X+char *ProgName; X+char *iface = WMWAVE_DEFAULT_INTERFACE; X+time_t curtime; X+time_t prevtime; X+int mode = 0; /* default: no card detected */ X+int screen = 0; /* default: Quality screen is displayed */ X+ X+void usage(void); X+void printversion(void); X+void BlitString(char *name, int x, int y); X+void BlitNum(int num, int x, int y); X+void wmwave_routine(int, char **); X+void DrawBar(float percent, int dx, int dy); X+void DrawGreenBar(float percent, int dx, int dy); X X-int update_rate=100000; X- X-char *ProgName; X- X-time_t curtime; X-time_t prevtime; X- X-int mode = 0; // default: no card detected X-int screen = 0; // default: Quality screen is displayed X- X-void usage(void); X-void printversion(void); X-void BlitString(char *name, int x, int y); X-void BlitNum(int num, int x, int y); X-void wmwave_routine(int, char **); X-void DrawBar(float percent, int dx, int dy); X-void DrawGreenBar(float percent, int dx, int dy); X+inline void X+DrawBar(float percent, int dx, int dy) X+{ X+ int tx; X X-inline void DrawBar(float percent, int dx, int dy) { X- int tx; X- X- tx = (float)((float)54 * ((float)percent / (float)100.0)); X- copyXPMArea(67, 36, tx, 4, dx, dy); X- copyXPMArea(67, 43, 54-tx, 4, dx+tx, dy); X+ tx = (float)((float)54 * ((float)percent / (float)100.0)); X+ copyXPMArea(67, 36, tx, 4, dx, dy); X+ copyXPMArea(67, 43, 54 - tx, 4, dx + tx, dy); X } X X X-inline void DrawGreenBar(float percent, int dx, int dy) { X- int tx; X- X- tx = (float)((float)54 * ((float)percent / (float)100.0)); X- copyXPMArea(67, 58, tx, 4, dx, dy); X- copyXPMArea(67, 43, 54-tx, 4, dx+tx, dy); X-} X+inline void X+DrawGreenBar(float percent, int dx, int dy) X+{ X+ int tx; X X-inline void DrawRedDot() { X- copyXPMArea(80, 65, 6, 6, 52, 5); X+ tx = (float)((float)54 * ((float)percent / (float)100.0)); X+ copyXPMArea(67, 58, tx, 4, dx, dy); X+ copyXPMArea(67, 43, 54 - tx, 4, dx + tx, dy); X } X X-inline void DrawYellowDot() { X- copyXPMArea(86, 65, 6, 6, 52, 5); X+inline void X+DrawRedDot() X+{ X+ copyXPMArea(80, 65, 6, 6, 52, 5); X } X X-inline void DrawGreenDot() { X- copyXPMArea(92, 65, 6, 6, 52, 5); X+inline void X+DrawYellowDot() X+{ X+ copyXPMArea(86, 65, 6, 6, 52, 5); X } X X-inline void DrawEmptyDot() { X- copyXPMArea(98, 65, 6, 6, 52, 5); X+inline void X+DrawGreenDot() X+{ X+ copyXPMArea(92, 65, 6, 6, 52, 5); X } X X-float min (float x, float y) { X- if (x < y) {return x;} X- else {return y;} X+inline void X+DrawEmptyDot() X+{ X+ copyXPMArea(98, 65, 6, 6, 52, 5); X } X X /* X- * Find CPU times for all processes X+ * XXX: redefining min() to operate on floats is a bad idea; X+ * changed to _fmin(). X */ X-void DisplayWireless(void) { X- FILE *wireless; // File handle for /proc/net/wireless X- X- char line[255]; X- char iface[5]; X- char status [3]; X- float link = 0; X- float level = 0; X- float noise = 0; X- int nwid = 0; X- int crypt = 0; X- int misc = 0; X- X- if ((wireless = fopen ("/proc/net/wireless", "r")) != NULL) X- { X- fgets(line,sizeof(line),wireless); X- fgets(line,sizeof(line),wireless); X- if (fgets(line,sizeof(line),wireless) == NULL) { X- mode = 0; X- } X- else { X- sscanf(line,"%s %s %f %f %f %d %d %d", X- iface,status,&link,&level,&noise,&nwid,&crypt,&misc); X- mode = 1; X- } X- fclose(wireless); X- X- X- /* Print channel information, and signal ratio */ X- X- switch (mode) { X- case 1: BlitString("Quality",4,4); X- if (link<=10) {DrawRedDot ();} X- else if (link<=20) {DrawYellowDot ();} X- else {DrawGreenDot();}; X- BlitString("Link ", 4,18); X- DrawBar(min ((int)(link * 1.8), 100.0), 4, 27); X- BlitString("Level ", 4,32); X- DrawGreenBar(min ((int)(level * 0.3), 100.0), 4, 41); X- BlitString("Noise ", 4,46); X- DrawGreenBar(min ((int)(noise * 0.3), 100.0), 4, 55); X- break; X- case 0: BlitString("NO CARD",4,4); X- DrawEmptyDot(); X- BlitString(" ", 4,18); X- DrawBar(0.0, 4, 27); X- BlitString(" ", 4,32); X- DrawGreenBar(0.0, 4, 41); X- BlitString(" ", 4,46); X- DrawGreenBar(0.0, 4, 55); X- break; X- }; X- } X- else { X- printf ("Wirless device /proc/net/wireless not found\nEnable radio networking and recompile your kernel\n"); X- exit (0); X- } X-} X- X-/* SIGCHLD handler */ X-void sig_chld(int signo) X-{ X- waitpid((pid_t) -1, NULL, WNOHANG); X- signal(SIGCHLD, sig_chld); X-} X- X-int main(int argc, char *argv[]) { X- int i; X- X- /* Parse Command Line */ X- X- signal(SIGCHLD, sig_chld); X- ProgName = argv[0]; X- if (strlen(ProgName) >= 5) X- ProgName += (strlen(ProgName) - 5); X- X- for (i=1; i (i+1)) { X- update_rate = (atoi(argv[i+1]) * 1000); X- i++; X+ X+ mode = MODE_HAVE_CARD; X+ wisigsp = (struct wi_sigcache *) (wisigsnp+1); X+ link = wisigsp->quality * 1.0; X+ level = wisigsp->signal * -1.0; X+ noise = wisigsp->noise * -1.0; X+draw: X+ /* X+ * Print channel information, and signal ratio X+ */ X+ switch (mode) { X+ case MODE_HAVE_CARD: X+ BlitString("Quality", 4, 4); X+ if (link <= 10) { X+ DrawRedDot(); X+ } else if (link <= 20) { X+ DrawYellowDot(); X+ } else { X+ DrawGreenDot(); X+ }; X+ BlitString("Link ", 4, 18); X+ DrawBar(_fmin((int)(link * 1.8), 100.0), 4, 27); X+ BlitString("Level ", 4, 32); X+ DrawGreenBar(_fmin((int)(level * 0.3), 100.0), 4, 41); X+ BlitString("Noise ", 4, 46); X+ DrawGreenBar(_fmin((int)(noise * 0.3), 100.0), 4, 55); X+ break; X+ case MODE_NO_CARD: X+ default: X+ BlitString("NO CARD", 4, 4); X+ DrawEmptyDot(); X+ BlitString(" ", 4, 18); X+ DrawBar(0.0, 4, 27); X+ BlitString(" ", 4, 32); X+ DrawGreenBar(0.0, 4, 41); X+ BlitString(" ", 4, 46); X+ DrawGreenBar(0.0, 4, 55); X+ break; X+ }; X+ close(s); X+} X+ X+void X+sig_chld(int signo) X+{ X+ waitpid((pid_t) - 1, NULL, WNOHANG); X+ signal(SIGCHLD, sig_chld); X+} X+ X+int X+main(int argc, char *argv[]) X+{ X+ int i; X+ X+ X+ signal(SIGCHLD, sig_chld); X+ X+ ProgName = argv[0]; X+ if (strlen(ProgName) >= 5) X+ ProgName += (strlen(ProgName) - 5); X+ X+ for (i = 1; i < argc; i++) { X+ char *arg = argv[i]; X+ X+ if (*arg == '-') { X+ switch (arg[1]) { X+ case 'i': X+ if (argc > (i + 1)) { X+ iface = argv[i+1]; X+ if (strncmp("wi", iface, 2) != 0) { X+ fprintf(stderr, "error: you " X+ "must specify a wiX interface.\n"); X+ usage(); X+ exit(EX_USAGE); X+ } X+ } X+ break; X+ case 'd': X+ if (strcmp(arg + 1, "display")) { X+ usage(); X+ exit(EX_USAGE); X+ } X+ break; X+ case 'g': X+ if (strcmp(arg + 1, "geometry")) { X+ usage(); X+ exit(EX_USAGE); X+ } X+ break; X+ case 'v': X+ printversion(); X+ exit(EX_OK); X+ break; X+ case 'r': X+ if (argc > (i + 1)) { X+ update_rate = (atoi(argv[i+1]) * 1000); X+ i++; X+ } X+ break; X+ default: X+ usage(); X+ exit(EX_USAGE); X+ break; X+ } X+ } X } X- break; X- default: X- usage(); X- exit(0); X- break; X- } X- } X- } X- X- wmwave_routine(argc, argv); X- X- return 0; X+ X+ wmwave_routine(argc, argv); X+ X+ exit(EX_OK); X } X X /* X * Main loop X */ X-void wmwave_routine(int argc, char **argv) { X- XEvent Event; X- struct timeval tv={0,0}; X- struct timeval last={0,0}; X- X- createXBMfromXPM(wmwave_mask_bits, wmwave_master_xpm, wmwave_mask_width, wmwave_mask_height); X- X- openXwindow(argc, argv, wmwave_master_xpm, wmwave_mask_bits, wmwave_mask_width, wmwave_mask_height); X- X- RedrawWindow(); X- X- X- while (1) { X- X- curtime = time(0); X- X- if (1) { X- memcpy(&last, &tv, sizeof(tv)); X- X- /* X- * Update display X- */ X- DisplayWireless(); X- X- RedrawWindow(); X- } X- X- /* X- * X Events X- */ X- while (XPending(display)) { X- XNextEvent(display, &Event); X- switch (Event.type) { X- case Expose: X+void X+wmwave_routine(int argc, char **argv) X+{ X+ XEvent Event; X+ struct timeval tv = {0, 0}; X+ struct timeval last = {0, 0}; X+ X+ createXBMfromXPM(wmwave_mask_bits, wmwave_master_xpm, wmwave_mask_width, wmwave_mask_height); X+ X+ openXwindow(argc, argv, wmwave_master_xpm, wmwave_mask_bits, wmwave_mask_width, wmwave_mask_height); X+ X RedrawWindow(); X- break; X- case DestroyNotify: X- XCloseDisplay(display); X- exit(0); X- case ButtonPress: X- switch (screen) { X- case 0: screen=1; break; X- case 1: screen=0; break; X- }; X- break; X- } X- } X- X- usleep(update_rate); X- } X+ X+ for (;;) { X+ curtime = time(0); X+ memcpy(&last, &tv, sizeof(tv)); X+ X+ /* X+ * Update display X+ */ X+ DisplayWireless(); X+ RedrawWindow(); X+ X+ /* X+ * X Events X+ */ X+ while (XPending(display)) { X+ XNextEvent(display, &Event); X+ switch (Event.type) { X+ case Expose: X+ RedrawWindow(); X+ break; X+ case DestroyNotify: X+ XCloseDisplay(display); X+ exit(EX_OK); X+ case ButtonPress: X+ switch (screen) { X+ case 0: X+ screen = 1; X+ break; X+ case 1: X+ screen = 0; X+ break; X+ }; X+ break; X+ } X+ } X+ usleep(update_rate); X+ } X } X X /* X * Blits a string at given co-ordinates X */ X-void BlitString(char *name, int x, int y) { X- int i; X- int c; X- int k; X- X- k = x; X- for (i=0; name[i]; i++) X- { X- X- c = toupper(name[i]); X- if (c >= 'A' && c <= 'Z') X- { // its a letter X- c -= 'A'; X- copyXPMArea(c * 6, 74, 6, 8, k, y); X- k += 6; X- } else X- if (c>='0' && c<='9') { // its a number or symbol X- c -= '0'; X- copyXPMArea(c * 6, 64, 6, 8, k, y); X- k += 6; X- } else { X- copyXPMArea(5, 84, 6, 8, k, y); X- k += 6; X- X- } X- } X-} X- X-void BlitNum(int num, int x, int y) { X- char buf[1024]; X- int newx=x; X- X- sprintf(buf, "%03i", num); X- X- BlitString(buf, newx, y); X+void X+BlitString(char *name, int x, int y) X+{ X+ int i; X+ int c; X+ int k; X+ X+ k = x; X+ for (i = 0; name[i]; i++) { X+ X+ c = toupper(name[i]); X+ if (c >= 'A' && c <= 'Z') { /* its a letter */ X+ c -= 'A'; X+ copyXPMArea(c * 6, 74, 6, 8, k, y); X+ k += 6; X+ } else if (c >= '0' && c <= '9') { X+ /* its a number or symbol */ X+ c -= '0'; X+ copyXPMArea(c * 6, 64, 6, 8, k, y); X+ k += 6; X+ } else { X+ copyXPMArea(5, 84, 6, 8, k, y); X+ k += 6; X+ X+ } X+ } X+} X+ X+void X+BlitNum(int num, int x, int y) X+{ X+ char buf[1024]; X+ int newx = x; X+ X+ sprintf(buf, "%03i", num); X+ BlitString(buf, newx, y); X } X X /* X * Usage X */ X-void usage(void) { X- fprintf(stderr, "\nWmwave - Carsten Schuermann http://www.schuermann.org/~dockapps\n\n"); X- fprintf(stderr, "usage:\n"); X- fprintf(stderr, " -display \n"); X- fprintf(stderr, " -r update rate in milliseconds (default:100)\n"); X- fprintf(stderr, "\n"); X+void X+usage(void) X+{ X+ fprintf(stderr, "\rwmwave 0.4 - by Bruce M Simpson et al. \n"); X+ fprintf(stderr, "usage:\n"); X+ fprintf(stderr, " -display \n"); X+ fprintf(stderr, " -i interface to use (default to wi0)\n"); X+ fprintf(stderr, " -r update rate in milliseconds (default:100)\n"); X+ fprintf(stderr, "\n"); X } X X /* X * printversion X */ X-void printversion(void) { X- fprintf(stderr, "wmwave v%s\n", WMWAVE_VERSION); X+void X+printversion(void) X+{ X+ fprintf(stderr, "wmwave v%s\n", WMWAVE_VERSION); X } END-of-wmwave/files/patch-wmwave.c echo x - wmwave/Makefile sed 's/^X//' >wmwave/Makefile << 'END-of-wmwave/Makefile' X# New ports collection makefile for: wmwave X# Date created: 21 May 2002 X# Whom: Bruce M Simpson X# X# $FreeBSD: ports/net/wmwave/Makefile,v 1.2 2002/01/05 08:20:41 pat Exp $ X# X XPORTNAME= wmwave XPORTVERSION= 0.4_1 XCATEGORIES= net XMASTER_SITES= http://www.schuermann.org/~dockapps/dist/ XDISTNAME= ${PORTNAME}-0-4 XEXTRACT_SUFX= .tgz X XMAINTAINER= bms@spc.org X XMAKEFILE= ${FILESDIR}/Makefile XWRKSRC= ${WRKDIR}/${PORTNAME} XUSE_XPM= yes XMAKE_ENV= MANPREFIX=${MANPREFIX} X XMAN1= wmwave.1 XMANCOMPRESSED= yes X X# configure is a no-op for this port. Xdo-configure: X X.include END-of-wmwave/Makefile echo x - wmwave/distinfo sed 's/^X//' >wmwave/distinfo << 'END-of-wmwave/distinfo' XMD5 (wmwave-0-4.tgz) = 24e985599a85d7165e5905b9d34cd81d END-of-wmwave/distinfo echo x - wmwave/pkg-comment sed 's/^X//' >wmwave/pkg-comment << 'END-of-wmwave/pkg-comment' XDisplay 802.11 status in the WindowMaker Dock END-of-wmwave/pkg-comment echo x - wmwave/pkg-descr sed 's/^X//' >wmwave/pkg-descr << 'END-of-wmwave/pkg-descr' XFrom the README on the website: X Xwmwave is dockapp for window maker to display statistical information Xabout a current wireless ethernet connection. The current release Xis Version 0.4. wmwave has been tested under Redhat 5.2 with an XWavelan Silver WEP/IEEE card from Lucent Technologies. X XI have rewritten the network code for use with Bill Paul's wi(4) Xdriver as it appears in FreeBSD 5.0-CURRENT and 4.4-STABLE. Support Xfor other cards will not be integrated into this GPLed version. X XAuthors: Bruce M Simpson, Carsten Schuermann, Dan Piponi, Dave Clark XWWW: http://www.schuermann.org/~dockapps/ X XBruce Xbms@spc.org END-of-wmwave/pkg-descr echo x - wmwave/pkg-plist sed 's/^X//' >wmwave/pkg-plist << 'END-of-wmwave/pkg-plist' Xbin/wmwave END-of-wmwave/pkg-plist exit