From 6083e3f774eb8849d772fbb5a3f7c68366ca6322 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 22 Oct 2014 16:34:42 -0500 Subject: [PATCH] wmifs: Remove libc5 version. libc6 was released in 1997... --- wmifs/INSTALL | 6 +- wmifs/wmifs/wmifs-libc5.c | 934 -------------------------------------- 2 files changed, 1 insertion(+), 939 deletions(-) delete mode 100644 wmifs/wmifs/wmifs-libc5.c diff --git a/wmifs/INSTALL b/wmifs/INSTALL index 6da86aa..8ba1834 100644 --- a/wmifs/INSTALL +++ b/wmifs/INSTALL @@ -21,7 +21,7 @@ Requirements Installation -------------------------------------------------------------- 1) % tar -zxvf wmifs-1.3b.tar.gz -2)* % cd wmifs.app/wmifs +2) % cd wmifs.app/wmifs 3) % make 4) % su root 5) # make install @@ -30,10 +30,6 @@ Installation start, stop & restart scripts 7) % wmifs & (or wmifs -h for brief help). -2)* If you're on a libc5 system, copy or move wmifs-libc5.c - over wmifs.c (i.e. cp wmifs-libc5.c wmifs.c) and proceed - with step 3) - 6)* This is optional, WMiFS also works fine without them, it's entirely up to you ;-) diff --git a/wmifs/wmifs/wmifs-libc5.c b/wmifs/wmifs/wmifs-libc5.c deleted file mode 100644 index b810b2f..0000000 --- a/wmifs/wmifs/wmifs-libc5.c +++ /dev/null @@ -1,934 +0,0 @@ -/* - Best viewed with vim5, using ts=4 - - This code was mainly put together by looking at the - following programs: - - asclock - A neat piece of equip, used to display the date - and time on the screen. - Comes with every AfterStep installation. - - Source used: - How do I create a not so solid window? - How do I open a window? - How do I use pixmaps? - - pppstats - A program that prints the amount of data that - is transferred over a ppp-line. - - Source used: - How do I read the ppp device? - ------------------------------------------------------------ - - Author: Martijn Pieterse (pieterse@xs4all.nl) - - This program was hacked together between the 7th of March - and the 14th of March 1998. - - This program might be Y2K resistant. We shall see. :) - - This program is distributed under the GPL license. - (as were asclock and pppstats) - - Known Features: (or in non M$ talk, BUGS) - * only ppp0 will be read - use wmifs if you want to read more than one ppp connection - not sure about this. - * the leds won't be reliable with - more than 1 ppp connection - * there is an iconwin, and win variable. - I have no clue why only win shouldn't - be enough. Will check it out later. - * The afterstep what seems the shift the - pixmap a bit. Don't know how and why. - It works in the WindowManager. - - Things to do: - Split up main() - - ---- - Thanks - ---- - - Most of the ideas, and jumpstarting it: - - #linuxnl, without this irc-channel wmppp would've never seen the light! - - CCC (Constructive Code Criticism): - - Marcelo E. Magallon - Thanks a LOT! It takes a while to get me convinced... :) - - - Minor bugs and ideas: - - Marc De Scheemaecker / David Mihm / Chris Soghoian / - Alessandro Usseglio Viretta / Dan Pascu - - and ofcourse numerous ppl who send us bug reports. - (numerous? hmm.. todo: rephrase this :) ) - - - ---- - Changes: - --- - 12/05/1998 (Antoine Nulle), warp@xs4all.nl) - * Made wmifs.c libc5 compatible version - 04/05/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Changed the "middle of the waveform" line color - * Moved the RedrawWindow out of the main loop. - Lightens the system load - 02/05/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Torn wmppp and wmifs apart. - This is gonna be wmifs - * Added parse_rcfile - * Added waitpid, to get rid of the zombies, spotteb by Alessandro Usseglio Viretta - 30/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Used the DrawStats routine from wmifs in wmppp - * I decided to add a list in this source file - with name of ppl who helped me build this code better. - * I finally removed the /proc/net/route dependancy - All of the connections are taken from /proc/net/dev. - /proc/net/route is still used for checking if it is on-line. - 27/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * WMIFS: stats scrolled, while red led burning - * WMPPP: changed positions of line speed - 25/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Changed the checknetdevs routine, a lot! - 23/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Added line speed detection. via seperate exec. (this has to be suid root!) - Speed has to be no more than 99999 - * Added speed and forcespeed in ~/.wmppprc and /etc/wmppprc - * wmifs: added on-line detection scheme, update the bitmap coordinates - * wmppp: the x-button now allways disconnects. - 22/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Added /etc/wmppprc support, including "forced" mode. - * Added /etc/wmifsrc support, including "forced" mode. - 21/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Moved the stats one pixel down. - * Added status led in wmifs. - * Changed RX/TX leds of wmifs to resemble wmppp - * Added the "dot" between eth.0 ppp.0 etc. - * Changed to wmifs stats to match wmppp stats (only pppX changed) - * Made sure that when specified -t 1, it stayed that way, even - when longer than 100 minutes online - * With -t 1, jump from 59:59 to 01:00 instead of 99:59 to 01:40 - 16/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Added "all" devices in wmifs - * Added "lo" support only if aked via -i - * Added on-line time detection (using /var/run/ppp0.pid) - * Added time-out for the orange led. (one minute) - 15/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Another wmppp-master.xpm. - Line speed detection being the main problem here.. :( - * Moved START_COMMAND / STOP_COMMAND to ~/.wmppprc - Return 0, everything went ok. - Return 10, the command did not work. - Please note, these functions are ran in the background. - * Removed the ability to configure - * When "v" is clicked, an orange led will appear. - if the connect script fails (return value == 10) - it will become dark again. Else the on-line detection will - pick it up, and "green" it. - 14/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Added "-timer" - * Added "-display" support - * Changed pixmap to a no-name pixmap. - + Changed LED positions - + Changed Timer position - + Changed Stats Size - 05/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Added ~/.wmifsrc support. - * Put some code in DrawStats - * Check devices when pressing "device change" - 03/04/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Added code for wmifs - 28/03/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * forgot what i did.. :) - 27/03/1998 (Martijn Pieterse, pieterse@xs4all.nl) - * Added on-line detection - Scan through /proc/net/route and check everye line - for "ppp". - * A bit of code clean-up. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include "../wmgeneral/wmgeneral.h" -#include "../wmgeneral/misc.h" - -#include "wmifs-master.xpm" -#include "wmifs-mask.xbm" - - /***********/ - /* Defines */ -/***********/ - -/* Fill in the hardcoded actions */ -#define LEFT_ACTION (NULL) -#define MIDDLE_ACTION (NULL) -#define RIGHT_ACTION (NULL) - -/* Defines voor alle coordinate */ - -#define LED_NET_RX (4) -#define LED_NET_TX (5) -#define LED_NET_POWER (6) - -#define WMIFS_VERSION "1.2.1" - - /**********************/ - /* External Variables */ -/**********************/ - -extern char **environ; - - /********************/ - /* Global Variables */ -/********************/ - -char *ProgName; -char *active_interface = NULL; -int TimerDivisor=60; -int WaveForm=0; - - /*****************/ - /* PPP variables */ -/*****************/ - -#define PPP_UNIT 0 -int ppp_h = -1; - -#define PPP_STATS_HIS 54 - - /***********************/ - /* Function Prototypes */ -/***********************/ - -void usage(void); -void printversion(void); -void DrawTime(int, int); -void DrawStats(int *, int, int, int, int); - -void SetOnLED(int); -void SetErrLED(int); -void SetWaitLED(int); -void SetOffLED(int); - -void ButtonUp(int); -void ButtonDown(int); - -void wmifs_routine(int, char **); - -void get_ppp_stats(struct ppp_stats *cur); - - - /********/ - /* Main */ -/********/ - -void main(int argc, char *argv[]) { - - int i; - - - /* Parse Command Line */ - - ProgName = argv[0]; - if (strlen(ProgName) >= 5) - ProgName += (strlen(ProgName) - 5); - - for (i=1; i Button */ - AddMouseRegion(0, 5, 5, 35, 15); - AddMouseRegion(1, 5, 20, 58, 58); - - starttime = time(0); - nexttime = starttime + 5; - - for (i=0; i= nexttime) { - nexttime+=5; - - for (i=0; i= 0) { - switch (but_stat) { - case 0 : - /* re-read the table */ - strcpy(temp, stat_devices[stat_current].name); - stat_online = checknetdevs(); - stat_current = 0; - for (i=0; i= '0' && name[strlen(name)-1] <= '9') { - copyXPMArea(61, 64, 4, 9, k, 5); - k+=4; - } - c = toupper(name[i]); - if (c >= 'A' && c <= 'Z') { - c -= 'A'; - copyXPMArea(c * 6, 74, 6, 9, k, 5); - k += 6; - } else { - c -= '0'; - copyXPMArea(c * 6, 64, 6, 9, k, 5); - k += 6; - } - } - -} - -/*******************************************************************************\ -|* get_statistics *| -\*******************************************************************************/ - -int get_statistics(char *devname, long *ip, long *op, long *is, long *os) { - - FILE *fp; - char temp[128]; - char *p; - char *tokens = " |:\n"; - int input, output; - int i; - int found; - struct ppp_stats ppp_cur, ppp_old; - static int ppp_opened = 0; - - - if (!strncmp(devname, "ppp", 3)) { - if (!ppp_opened) { - /* Open the ppp device. */ - memset(&ppp_cur, 0, sizeof(ppp_cur)); - if ((ppp_h = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return -1; - get_ppp_stats(&ppp_cur); - ppp_old = ppp_cur; - ppp_opened = 1; - } - - get_ppp_stats(&ppp_cur); - - *op = ppp_cur.p.ppp_opackets; - *ip = ppp_cur.p.ppp_ipackets; - - *is = ppp_cur.p.ppp_ibytes; - *os = ppp_cur.p.ppp_obytes; - - return 0; - } - - /* Read from /proc/net/dev the stats! */ - fp = fopen("/proc/net/dev", "r"); - fgets(temp, 128, fp); - fgets(temp, 128, fp); - - input = -1; - output = -1; - i = 0; - found = -1; - - p = strtok(temp, tokens); - do { - if (!(strcmp(p, "packets"))) { - if (input == -1) input = i; - else output = i; - } - i++; - p = strtok(NULL, tokens); - } while (input == -1 || output == -1); - - while (fgets(temp, 128, fp)) { - if (strstr(temp, devname)) { - found = 0; - p = strtok(temp, tokens); - i = 0; - do { - if (i == input) { - *ip = *is = atoi(p); - input = -1; - } - if (i == output) { - *op = *os = atoi(p); - output = -1; - } - i++; - p = strtok(NULL, tokens); - } while (input != -1 || output != -1); - } - } - fclose(fp); - - return found; -} - -/*******************************************************************************\ -|* stillonline *| -\*******************************************************************************/ - -int stillonline(char *ifs) { - - FILE *fp; - char temp[128]; - int i; - - i = 0; - fp = fopen("/proc/net/route", "r"); - if (fp) { - while (fgets(temp, 128, fp)) { - if (strstr(temp, ifs)) { - i = 1; /* Line is alive */ - } - } - fclose(fp); - } - return i; -} - -/*******************************************************************************\ -|* checknetdevs *| -\*******************************************************************************/ - -int checknetdevs(void) { - - FILE *fd; - char temp[128]; - char *p; - int i=0,j; - int k; - int devsfound=0; - char *tokens = " :\t\n"; - char foundbuffer[MAX_STAT_DEVICES][8]; - - for (i=0; i pixels_per_byte) - pixels_per_byte = p[0] + p[1]; - p += 2; - } - - pixels_per_byte /= size; - p = his; - - for (k=0; k\n"); - fprintf(stderr, "\t-h\tthis help screen\n"); - fprintf(stderr, "\t-i \tdefault (as it appears in /proc/net/route)\n"); - fprintf(stderr, "\t-v\tprint the version number\n"); - fprintf(stderr, "\t-w\twaveform load\n"); - fprintf(stderr, "\n"); -} - -/*******************************************************************************\ -|* printversion *| -\*******************************************************************************/ - -void printversion(void) { - - fprintf(stderr, "%s\n", WMIFS_VERSION); -} - -/*******************************************************************************\ -|* get_ppp_stats *| -\*******************************************************************************/ - -void get_ppp_stats(struct ppp_stats *cur) { - - struct ifpppstatsreq req; - - memset(&req, 0, sizeof(req)); - - req.stats_ptr = (caddr_t) &req.stats; - - sprintf(req.ifr__name, "ppp%d", PPP_UNIT); - - if (ioctl(ppp_h, SIOCGPPPSTATS, &req) < 0) { - fprintf(stderr, "heyho!\n"); - } - - *cur = req.stats; -} - -#define LED_SZE_X (4) -#define LED_SZE_Y (4) - -#define LED_ON_NET_X (87) -#define LED_ON_NET_Y (66) -#define LED_OFF_NET_X (93) -#define LED_OFF_NET_Y (66) -#define LED_ERR_NET_X (81) -#define LED_ERR_NET_Y (66) -#define LED_ON_SW_NET_X (49) -#define LED_ON_SW_NET_Y (85) -#define LED_OFF_SW_NET_X (44) -#define LED_OFF_SW_NET_Y (85) - -#define LED_PWR_X (53) -#define LED_PWR_Y (7) -#define LED_SND_X (47) -#define LED_SND_Y (7) -#define LED_RCV_X (41) -#define LED_RCV_Y (7) - -#define LED_SW_X (38) -#define LED_SW_Y (14) - -/*******************************************************************************\ -|* SetOnLED *| -\*******************************************************************************/ -void SetOnLED(int led) { - - switch (led) { - - case LED_NET_RX: - copyXPMArea(LED_ON_NET_X, LED_ON_NET_Y, LED_SZE_X, LED_SZE_Y, LED_RCV_X, LED_RCV_Y); - break; - case LED_NET_TX: - copyXPMArea(LED_ON_NET_X, LED_ON_NET_Y, LED_SZE_X, LED_SZE_Y, LED_SND_X, LED_SND_Y); - break; - case LED_NET_POWER: - copyXPMArea(LED_ON_NET_X, LED_ON_NET_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y); - break; - } -} - -/*******************************************************************************\ -|* SetOffLED *| -\*******************************************************************************/ -void SetOffLED(int led) { - - switch (led) { - - case LED_NET_RX: - copyXPMArea(LED_OFF_NET_X, LED_OFF_NET_Y, LED_SZE_X, LED_SZE_Y, LED_RCV_X, LED_RCV_Y); - break; - case LED_NET_TX: - copyXPMArea(LED_OFF_NET_X, LED_OFF_NET_Y, LED_SZE_X, LED_SZE_Y, LED_SND_X, LED_SND_Y); - break; - case LED_NET_POWER: - copyXPMArea(LED_OFF_NET_X, LED_OFF_NET_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y); - break; - } -} - -/*******************************************************************************\ -|* SetErrLED *| -\*******************************************************************************/ -void SetErrLED(int led) { - - switch (led) { - case LED_NET_POWER: - copyXPMArea(LED_ERR_NET_X, LED_ERR_NET_Y, LED_SZE_X, LED_SZE_Y, LED_PWR_X, LED_PWR_Y); - break; - } -}