Hi,
this is a little patch for E-Net.
Usage: E-Net.epplet [interface]
Thanks.
[EMAIL PROTECTED]:~/dev/epplets-0.7/epplets$ diff -u -3 E-Net.c.original E-Net.c --- E-Net.c.original 2005-03-05 13:12:19.000000000 +0100 +++ E-Net.c 2005-03-06 01:40:11.000000000 +0100 @@ -7,6 +7,9 @@ #include "epplet.h" #include "net.h"
+/* kix -> patch for multiple interface */
+#define IFLEN 10
+
double bands[] =
{1000000000, 100000000, 10000000, 2000000, 1540000, 1000000, 512000, 256000,
144000, 128000, 64000, 56000, 33600, 28800, 14400, 9600, 4800, 2400, 300, 75
@@ -20,6 +23,7 @@
double down_last = 0;
Epplet_gadget load_up;
Epplet_gadget load_down;
+char iface[IFLEN];
static void cb_timer(void *data); static void cb_close(void *data); @@ -28,18 +32,19 @@ static void save_conf(void); static void load_conf(void);
+
static void
cb_timer(void *data)
{
double val = -1.0, val2 = -1.0, dval, dval2;
unsigned char invalid;- invalid = net_get_bytes_inout("eth0", &val, &val2);
+ invalid = net_get_bytes_inout(iface, &val, &val2);
if (invalid)
{
char err[255];- Esnprintf(err, sizeof(err), "Unable to get network device statistics for eth0: %s", net_strerror(invalid));
+ Esnprintf(err, sizeof(err), "Unable to get network device statistics for %s: %s", iface, net_strerror(invalid));
Epplet_dialog_ok(err);
Epplet_unremember();
Esync();
@@ -75,6 +80,7 @@
Epplet_modify_config("upstream_max", s);
Esnprintf(s, sizeof(s), "%f", downstream_max);
Epplet_modify_config("downstream_max", s);
+ Epplet_modify_config("interface", iface);
Epplet_save_config();
}
@@ -88,6 +94,10 @@
s = Epplet_query_config_def("downstream_max", "1540000");
downstream_max = (double)atof(s);
+
+ s = Epplet_query_config_def("interface", "eth0");
+ strncpy(iface, s, IFLEN -1);
+ iface[IFLEN] = '\0';
}static void @@ -105,6 +115,12 @@ }
static void
+cb_set_iface(void)
+{
+ save_conf();
+}
+
+static void
cb_close(void *data)
{
Epplet_unremember();
@@ -128,6 +144,13 @@
Epplet_load_config();
load_conf();+ /* Load the interface */
+ if (argc == 2) {
+ strncpy(iface, argv[1], IFLEN -1);
+ iface[IFLEN] = '\0';
+ cb_set_iface();
+ }
+
Epplet_timer(cb_timer, NULL, 0.333, "TIMER");
Epplet_gadget_show(Epplet_create_button(NULL, NULL,
2, 2, 0, 0, "CLOSE", 0, NULL,------------------------------------------------------- This SF.net email is sponsored by Demarc: A global provider of Threat Management Solutions. Download our HomeAdmin security software for free today! http://www.demarc.com/info/Sentarus/hamr30 _______________________________________________ enlightenment-cvs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs
