aboutsummaryrefslogtreecommitdiff
path: root/x11-wm/epplets
diff options
context:
space:
mode:
authorPietro Cerutti <gahr@FreeBSD.org>2008-03-10 20:41:57 +0000
committerPietro Cerutti <gahr@FreeBSD.org>2008-03-10 20:41:57 +0000
commitf4a53373b7cbb303e7ae109fd19e16e4677a554c (patch)
tree3185980ce30d8212c47de9d222d7a6e853e06a90 /x11-wm/epplets
parent7ac566fae0f123209e912914d5e51be72d392e6b (diff)
downloadports-f4a53373b7cbb303e7ae109fd19e16e4677a554c.tar.gz
ports-f4a53373b7cbb303e7ae109fd19e16e4677a554c.zip
Notes
Diffstat (limited to 'x11-wm/epplets')
-rw-r--r--x11-wm/epplets/Makefile45
-rw-r--r--x11-wm/epplets/distinfo6
-rw-r--r--x11-wm/epplets/files/patch-api::epplet.h.in10
-rw-r--r--x11-wm/epplets/files/patch-configure11
-rw-r--r--x11-wm/epplets/files/patch-epplets::Emix.c22
-rw-r--r--x11-wm/epplets/files/patch-epplets::Makefile.in11
-rw-r--r--x11-wm/epplets/files/patch-epplets::mbox.c10
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-Cpu.c222
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-Disk.c96
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-Load.c115
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-MemWatch.c121
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-Power.c269
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-SD.c14
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-Slides.c60
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-Sys.c61
-rw-r--r--x11-wm/epplets/files/patch-epplets_E-Wireless.c179
-rw-r--r--x11-wm/epplets/files/patch-epplets_Makefile.in180
-rw-r--r--x11-wm/epplets/files/patch-epplets_load.c38
-rw-r--r--x11-wm/epplets/files/patch-epplets_net.c130
-rw-r--r--x11-wm/epplets/pkg-plist35
20 files changed, 1531 insertions, 104 deletions
diff --git a/x11-wm/epplets/Makefile b/x11-wm/epplets/Makefile
index c48ab3bd957b..81a97f84ce88 100644
--- a/x11-wm/epplets/Makefile
+++ b/x11-wm/epplets/Makefile
@@ -6,30 +6,39 @@
#
PORTNAME= epplets
-PORTVERSION= 0.9
-PORTREVISION= 2
+PORTVERSION= 0.10
CATEGORIES= x11-wm
-MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITES= SF
MASTER_SITE_SUBDIR= enlightenment
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= gahr@FreeBSD.org
COMMENT= A collection of Enlightenment dock applications
BUILD_DEPENDS= e16:${PORTSDIR}/x11-wm/enlightenment
-LIB_DEPENDS= Imlib2.4:${PORTSDIR}/graphics/imlib2 \
- cdaudio.1:${PORTSDIR}/audio/libcdaudio
-RUN_DEPENDS= import:${PORTSDIR}/graphics/ImageMagick \
- e16:${PORTSDIR}/x11-wm/enlightenment
-
-USE_X_PREFIX= yes
-USE_GNOME= esound lthack
-USE_GL= yes
+LIB_DEPENDS= cdaudio.1:${PORTSDIR}/audio/libcdaudio
+RUN_DEPENDS= e16:${PORTSDIR}/x11-wm/enlightenment \
+ import:${PORTSDIR}/graphics/ImageMagick
+
+USE_XORG= xext
+USE_GNOME= esound gnometarget
+USE_GL= glut
USE_GMAKE= yes
-USE_AUTOTOOLS= libtool:15
-GNU_CONFIGURE= yes
+USE_AUTOTOOLS= libtool:15 autoconf:261
USE_LDCONFIG= yes
-CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include" \
- LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib"
-CONFIGURE_ARGS= --enable-fsstd
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib"
+CONFIGURE_ARGS= --disable-auto-respawn
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 600000
+BROKEN= Does not compile on 5.x
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|<machine/soundcard\.h>|<sys/soundcard.h>|g' \
+ ${WRKSRC}/epplets/Emix.c
+ @${REINPLACE_CMD} -e 's|<malloc\.h>|<stdlib.h>|g' \
+ ${WRKSRC}/epplets/mbox.c
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/x11-wm/epplets/distinfo b/x11-wm/epplets/distinfo
index 6692181af8f3..579356852c26 100644
--- a/x11-wm/epplets/distinfo
+++ b/x11-wm/epplets/distinfo
@@ -1,3 +1,3 @@
-MD5 (epplets-0.9.tar.gz) = a38653f731b7c8a0ee6ec8293e33edfd
-SHA256 (epplets-0.9.tar.gz) = 279260ff417a100665d3f1e7bb8250e79d175d059948accbbe4d66980275fc8b
-SIZE (epplets-0.9.tar.gz) = 1129444
+MD5 (epplets-0.10.tar.gz) = 19f881141e18a4f4402af16738ee5ae7
+SHA256 (epplets-0.10.tar.gz) = 4348f9f02e9d1a5671623159c75d29c5579333d059f12d821dde57f01a11dcc3
+SIZE (epplets-0.10.tar.gz) = 1112777
diff --git a/x11-wm/epplets/files/patch-api::epplet.h.in b/x11-wm/epplets/files/patch-api::epplet.h.in
deleted file mode 100644
index 7b87c97c61ff..000000000000
--- a/x11-wm/epplets/files/patch-api::epplet.h.in
+++ /dev/null
@@ -1,10 +0,0 @@
---- api/epplet.h.in.orig Fri Jun 30 08:54:24 2000
-+++ api/epplet.h.in Mon Dec 8 23:43:09 2003
-@@ -28,7 +28,6 @@
-
- /* preliminary OpenGL Checking */
- #ifdef HAVE_LIBGL
--#include <GL/glut.h>
- #include <GL/glx.h>
- #endif
-
diff --git a/x11-wm/epplets/files/patch-configure b/x11-wm/epplets/files/patch-configure
deleted file mode 100644
index d4ea3890e55d..000000000000
--- a/x11-wm/epplets/files/patch-configure
+++ /dev/null
@@ -1,11 +0,0 @@
---- configure.orig Mon Apr 24 01:33:18 2006
-+++ configure Mon Apr 24 01:36:16 2006
-@@ -22464,7 +22464,7 @@
- echo "$as_me: failed program was:" >&5
- sed 's/^/| /' conftest.$ac_ext >&5
-
--ac_cv_lib_Imlib2_imlib_create_image=no
-+ac_cv_lib_Imlib2_imlib_create_image=yes
- fi
- rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
diff --git a/x11-wm/epplets/files/patch-epplets::Emix.c b/x11-wm/epplets/files/patch-epplets::Emix.c
deleted file mode 100644
index 96a5c95cd00a..000000000000
--- a/x11-wm/epplets/files/patch-epplets::Emix.c
+++ /dev/null
@@ -1,22 +0,0 @@
---- epplets/Emix.c.orig Sat Apr 1 06:56:17 2006
-+++ epplets/Emix.c Sat Jun 3 19:44:51 2006
-@@ -7,11 +7,16 @@
- #include "epplet.h"
- #include <sys/ioctl.h>
- #include <fcntl.h>
--#ifdef __FreeBSD__
-+#include <config.h>
-+#ifdef HAVE_LINUX_SOUNDCARD_H
-+#include <linux/soundcard.h>
-+#elif HAVE_MACHINE_SOUNDCARD_H
- #include <machine/soundcard.h>
--#else
-+#elif HAVE_SYS_SOUNDCARD_H
- #include <sys/soundcard.h>
--#endif
-+#else
-+#error No soundcard defenition!
-+#endif /* SOUNDCARD_H */
-
- Epplet_gadget vs_master, vs_pcm, vs_lin, vs_cda, b_close, b_help;
-
diff --git a/x11-wm/epplets/files/patch-epplets::Makefile.in b/x11-wm/epplets/files/patch-epplets::Makefile.in
deleted file mode 100644
index 2e4c64253d53..000000000000
--- a/x11-wm/epplets/files/patch-epplets::Makefile.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- epplets/Makefile.in.orig Sat Jun 3 19:36:50 2006
-+++ epplets/Makefile.in Sat Jun 3 19:37:11 2006
-@@ -41,7 +41,7 @@
- bin_PROGRAMS = E-Load.epplet$(EXEEXT) E-Clock.epplet$(EXEEXT) \
- E-Time.epplet$(EXEEXT) E-Net.epplet$(EXEEXT) \
- E-Cpu.epplet$(EXEEXT) E-Biff.epplet$(EXEEXT) \
-- E-Power.epplet$(EXEEXT) @TEST_PROGS@ @MIXER_PROGS@ @GL_PROGS@ \
-+ @TEST_PROGS@ @MIXER_PROGS@ @GL_PROGS@ \
- E-MemWatch.epplet$(EXEEXT) E-Disk.epplet$(EXEEXT) \
- E-Areas.epplet$(EXEEXT) E-Magic.epplet$(EXEEXT) \
- E-Toolbox.epplet$(EXEEXT) E-NetFlame.epplet$(EXEEXT) \
diff --git a/x11-wm/epplets/files/patch-epplets::mbox.c b/x11-wm/epplets/files/patch-epplets::mbox.c
deleted file mode 100644
index b99b7e75adec..000000000000
--- a/x11-wm/epplets/files/patch-epplets::mbox.c
+++ /dev/null
@@ -1,10 +0,0 @@
---- epplets/mbox.c.orig Tue Apr 9 05:39:38 2002
-+++ epplets/mbox.c Mon Dec 8 02:46:36 2003
-@@ -32,7 +32,6 @@
- #include <string.h>
- #include <time.h>
- #include <utime.h>
--#include <malloc.h>
- #include <limits.h>
-
- #define ISSPACE(c) isspace((unsigned char) c)
diff --git a/x11-wm/epplets/files/patch-epplets_E-Cpu.c b/x11-wm/epplets/files/patch-epplets_E-Cpu.c
new file mode 100644
index 000000000000..48eb13ee8948
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-Cpu.c
@@ -0,0 +1,222 @@
+--- epplets/E-Cpu.c.orig 2007-03-16 20:52:25.000000000 +0100
++++ epplets/E-Cpu.c 2008-01-24 13:40:28.000000000 +0100
+@@ -1,3 +1,7 @@
++/*
++ * Copyright (C) 2008, Pietro Cerutti <gahr@FreeBSD.org> (FreeBSD adaptation)
++ */
++
+ #include <stdio.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
+@@ -13,6 +17,12 @@
+ #include "proc.h"
+ #endif
+
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#include <sys/param.h>
++#endif
++
+ int cpus = 0;
+ double *prev_val = NULL;
+ double *prev_val_nice = NULL;
+@@ -76,7 +86,7 @@
+ #define VSPREAD 160
+ #define RESIDUAL 75
+
+-#define MAX 255
++#define FLAME_MAX 255
+
+ static void
+ flame_col(int r1, int g1, int b1, int r2, int g2, int b2, int r3, int g3,
+@@ -133,7 +143,7 @@
+ hspread[x] = HSPREAD + (load_val[(x * cpus) / 40] / 50);
+ residual[x] = RESIDUAL + (load_val[(x * cpus) / 40] / 50);
+ ptr[x] = (rand() % ((load_val[(x * cpus) / 40]) + 155));
+- if (ptr[x] > MAX)
++ if (ptr[x] > FLAME_MAX)
+ ptr[x] = 0;
+ else if (ptr[x] < 0)
+ ptr[x] = 0;
+@@ -163,14 +173,14 @@
+ val3 = (ptr[x] * residual[x]) >> 8;
+
+ ptr[x - 1] += val2;
+- if (ptr[x - 1] > MAX)
+- ptr[x - 1] = MAX;
++ if (ptr[x - 1] > FLAME_MAX)
++ ptr[x - 1] = FLAME_MAX;
+ ptr[x - 40] += val1;
+- if (ptr[x - 40] > MAX)
+- ptr[x - 40] = MAX;
++ if (ptr[x - 40] > FLAME_MAX)
++ ptr[x - 40] = FLAME_MAX;
+ ptr[x + 1] += val2;
+- if (ptr[x + 1] > MAX)
+- ptr[x + 1] = MAX;
++ if (ptr[x + 1] > FLAME_MAX)
++ ptr[x + 1] = FLAME_MAX;
+ ptr[x] = val3;
+ }
+ }
+@@ -204,11 +214,12 @@
+ static void
+ cb_timer(void *data)
+ {
+-#ifdef HAVE_LIBGTOP
+
++ double val, val2, val_nice, val2_nice;
++ int i;
++
++#ifdef HAVE_LIBGTOP
+ glibtop_cpu cpu;
+- double val, val2;
+- int i;
+
+ glibtop_get_cpu(&cpu);
+
+@@ -226,14 +237,37 @@
+ /* printf ("CPU%d: %ld : %ld : %d : %d\n",i, val, prev_val[i], val2, load_val[i]); */
+ }
+
+-#else
++ goto end;
++#endif
+
++#ifdef __FreeBSD__
++ size_t len;
++ int max_cpus;
++
++ len = sizeof(max_cpus);
++
++ if(sysctlbyname("kern.smp.maxcpus", &max_cpus, &len, NULL, 0)) {
++ perror("Couldn't get maximum number of CPUs");
++ exit(EXIT_FAILURE);
++ }
++ long cp_time[sizeof(long) * max_cpus * CPUSTATES + 1];
++
++ len = sizeof(cp_time);
++
++ if(sysctlbyname("kern.cp_times", &cp_time, &len, NULL, 0)) {
++ perror("Couldn't retrieve CPU states");
++ exit(EXIT_FAILURE);
++ }
++
++ for(i=0; i<cpus; i++) {
++ val = cp_time[0*CPUSTATES];
++ val_nice = cp_time[1*CPUSTATES];
++ }
++#else
+ static FILE *f;
+- int i;
+
+ f = fopen("/proc/stat", "r");
+- if (f)
+- {
++ if (!f) exit(EXIT_FAILURE);
+ char s[256];
+
+ if (cpus > 1)
+@@ -242,40 +276,45 @@
+ {
+ char sUserCPU[64];
+ char sNiceCPU[64];
+- double val, val2, val_nice, val2_nice;
+
+ fgets(s, 255, f);
+ sscanf(s, "%*s %s %s %*s %*s", sUserCPU, sNiceCPU);
+
+ val = atof(sUserCPU);
+ val_nice = atof(sNiceCPU);
+-
+- val2 = val - prev_val[i];
+- prev_val[i] = val;
+- val2 *= 10;
+- if (val2 > 100)
+- val2 = 100;
+-
+- val2_nice = val_nice - prev_val_nice[i];
+- prev_val_nice[i] = val_nice;
+- val2_nice *= 10;
+- if (val2_nice > 100)
+- val2_nice = 100;
+-
+- if (include_nice)
+- load_val[i] = val2 + val2_nice;
+- else
+- load_val[i] = val2;
+-
+- if (load_val[i] > 100)
+- load_val[i] = 100;
+-
+- }
+- fclose(f);
+ }
+
++ fclose(f);
+ #endif
+
++ for(i=0; i<cpus; i++) {
++ if(prev_val[i] == 0)
++ prev_val[i] = val;
++ val2 = val - prev_val[i];
++ prev_val[i] = val;
++ val2 *= 10;
++ if (val2 > 100)
++ val2 = 100;
++
++ if(prev_val_nice[i] == 0)
++ prev_val_nice[i] = val_nice;
++ val2_nice = val_nice - prev_val_nice[i];
++ prev_val_nice[i] = val_nice;
++ val2_nice *= 10;
++ if (val2_nice > 100)
++ val2_nice = 100;
++
++ if (include_nice)
++ load_val[i] = val2 + val2_nice;
++ else
++ load_val[i] = val2;
++
++ if (load_val[i] > 100)
++ load_val[i] = 100;
++ }
++
++end:
++
+ draw_flame();
+ Epplet_paste_buf(buf, win, 0, 0);
+ Epplet_timer(cb_timer, NULL, 0.1, "TIMER");
+@@ -375,7 +414,22 @@
+ /* printf ("CPUs: %d\n", c); */
+
+ return c;
+-#else
++#endif
++
++#ifdef __FreeBSD__
++ int mib[2];
++ int nof_cpus;
++ size_t len = sizeof(nof_cpus);;
++
++ mib[0] = CTL_HW;
++ mib[1] = HW_NCPU;
++ if(sysctl(mib, 2, &nof_cpus, &len, NULL, 0) == -1) {
++ perror("Couldn't retrieve the number of CPUs: %s");
++ exit(EXIT_FAILURE);
++ }
++ return (nof_cpus);
++#endif
++
+ FILE *f;
+ char s[256];
+
+@@ -403,7 +457,6 @@
+ return count;
+ }
+ exit(1);
+-#endif
+ }
+
+ static void
diff --git a/x11-wm/epplets/files/patch-epplets_E-Disk.c b/x11-wm/epplets/files/patch-epplets_E-Disk.c
new file mode 100644
index 000000000000..bc0a6a72077c
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-Disk.c
@@ -0,0 +1,96 @@
+--- epplets/E-Disk.c.orig 2008-03-10 07:54:22.000000000 +0100
++++ epplets/E-Disk.c 2008-03-10 08:33:28.000000000 +0100
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (C) 1999-2005, Michael Jennings
++ * 2008, Pietro Cerutti <gahr@FreeBSD.org> (FreeBSD adaptation)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+@@ -29,6 +30,15 @@
+ #include <errno.h>
+ #include "epplet.h"
+
++#ifdef __FreeBSD__
++#include <stdlib.h>
++#include <strings.h>
++#include <sys/resource.h>
++#include <devstat.h>
++#define BLKSIZ 512
++static struct statinfo si;
++#endif
++
+ #if 0
+ # define D(x) do {printf("%10s | %7d: [debug] ", __FILE__, __LINE__); printf x; fflush(stdout);} while (0)
+ #else
+@@ -73,12 +83,41 @@
+ static void
+ timer_cb(void *data)
+ {
++ unsigned long in_blks = 0, out_blks = 0;
++ static unsigned long last_in = 0, last_out = 0, in_delta = 0, out_delta = 0;
++ char buff[1024];
++
++#ifdef __FreeBSD__
++ int ndevs;
++ int num_selected;
++ int num_selections;
++ int maxshowdevs = 10;
++ struct device_selection *dev_select = NULL;
++ struct devstat *dev;
++ long select_generation;
++ int dn, di;
++
++ if (devstat_getdevs(NULL, &si) == -1) return;
++ ndevs = si.dinfo->numdevs;
++
++ if (devstat_selectdevs(&dev_select, &num_selected, &num_selections,
++ &select_generation, si.dinfo->generation, si.dinfo->devices,
++ ndevs, NULL, 0, NULL, 0, DS_SELECT_ONLY, maxshowdevs, 1) == -1
++ ) return;
++
++ for (dn = 0; dn < ndevs; ++dn)
++ {
++ di = dev_select[dn].position;
++ dev = &si.dinfo->devices[di];
++ in_blks += dev->bytes[DEVSTAT_READ] / BLKSIZ;
++ out_blks += dev->bytes[DEVSTAT_WRITE] / BLKSIZ;
++ }
++
++ free(dev_select);
++#else
+
+ FILE *fp;
+- char buff[1024];
+ unsigned long a, b, c, d, e;
+- unsigned long in_blks = 0, out_blks = 0;
+- static unsigned long last_in = 0, last_out = 0, in_delta = 0, out_delta = 0;
+
+ if ((fp = fopen("/proc/diskstats", "r")) == NULL)
+ {
+@@ -131,9 +170,11 @@
+ }
+ }
+ }
++ fclose(fp);
++
++#endif
+ in_blks -= last_in;
+ out_blks -= last_out;
+- fclose(fp);
+
+ if (last_in)
+ {
+@@ -273,6 +314,12 @@
+
+ int prio;
+
++#ifdef __FreeBSD__
++ bzero(&si, sizeof(si));
++ si.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
++ bzero(si.dinfo, sizeof(struct devinfo));
++#endif
++
+ prio = getpriority(PRIO_PROCESS, getpid());
+ setpriority(PRIO_PROCESS, getpid(), prio + 10);
+ atexit(Epplet_cleanup);
diff --git a/x11-wm/epplets/files/patch-epplets_E-Load.c b/x11-wm/epplets/files/patch-epplets_E-Load.c
new file mode 100644
index 000000000000..dbd32b29e01e
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-Load.c
@@ -0,0 +1,115 @@
+--- epplets/E-Load.c.orig 2006-04-16 00:32:42.000000000 +0200
++++ epplets/E-Load.c 2008-01-24 00:20:59.000000000 +0100
+@@ -8,6 +8,12 @@
+ #include "proc.h"
+ #endif
+
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#include <sys/resource.h>
++#endif
++
+ int cpus = 0;
+ double *prev_val = NULL;
+ int *load_val = NULL;
+@@ -20,13 +26,15 @@
+ static void
+ cb_timer(void *data)
+ {
+-#ifdef HAVE_LIBGTOP
+
+-/* libgtop only handles total load, not per-CPU load */
++ int i;
++ double val, val2;
++
++#if defined(HAVE_LIBGTOP)
++
++ /* libgtop only handles total load, not per-CPU load */
+
+ glibtop_loadavg loadavg;
+- double val, val2;
+- int i;
+
+ glibtop_get_loadavg(&loadavg);
+ val2 = loadavg.loadavg[0];
+@@ -39,10 +47,27 @@
+ load_val[0] = val2;
+ Epplet_gadget_data_changed(load[0]);
+
++#elif defined(__FreeBSD__)
++
++ long cp_time[cpus][CPUSTATES];
++ size_t len = sizeof(cp_time);
++
++ sysctlbyname("kern.cp_times", cp_time, &len, NULL, 0);
++
++ for(i=0; i<cpus; i++)
++ {
++ val = cp_time[i][0];
++ val2 = val - prev_val[i];
++ prev_val[i] = val;
++ val2 *= 3;
++ if(val2 > 100) val2 = 100;
++ load_val[i] = val2;
++ Epplet_gadget_data_changed(load[i]);
++ }
++
+ #else
+
+ static FILE *f;
+- int i;
+
+ f = fopen("/proc/stat", "r");
+ if (f)
+@@ -54,7 +79,6 @@
+ for (i = 0; i < cpus; i++)
+ {
+ char ss[64];
+- double val, val2;
+
+ fgets(s, 255, f);
+ sscanf(s, "%*s %s %*s %*s %*s", ss);
+@@ -89,7 +113,8 @@
+ int
+ count_cpus(void)
+ {
+-#ifdef HAVE_LIBGTOP
++
++#if defined(HAVE_LIBGTOP)
+ int i, c = 0;
+ int bits;
+ glibtop_cpu cpu;
+@@ -104,8 +129,17 @@
+ }
+ /* printf ("CPUs: %d\n", c); */
+
+- return c;
++#elif defined(__FreeBSD__)
++
++ int mib[2];
++ int c;
++ size_t len = sizeof(c);
++ mib[0] = CTL_HW;
++ mib[1] = HW_NCPU;
++ sysctl(mib, 2, &c, &len, NULL, 0);
++
+ #else
++
+ FILE *f;
+ char s[256];
+
+@@ -130,10 +164,11 @@
+ if (count > 1)
+ count--;
+ fclose(f);
+- return count;
+ }
+- exit(1);
++ else
++ exit(1);
+ #endif
++ return (c);
+ }
+
+ int
diff --git a/x11-wm/epplets/files/patch-epplets_E-MemWatch.c b/x11-wm/epplets/files/patch-epplets_E-MemWatch.c
new file mode 100644
index 000000000000..8ae3951f438b
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-MemWatch.c
@@ -0,0 +1,121 @@
+--- epplets/E-MemWatch.c.orig 2006-04-16 00:32:42.000000000 +0200
++++ epplets/E-MemWatch.c 2008-01-25 23:37:25.000000000 +0100
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (C) 1999-2000, Michael Jennings
++ * 2008, Pietro Cerutti <gahr@FreeBSD.org> (FreeBSD adaptation)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+@@ -37,6 +38,13 @@
+ #include "proc.h"
+ #endif
+
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#include <fcntl.h>
++#include <kvm.h>
++#endif
++
+ #if 0
+ # define D(x) do {printf("%10s | %7d: [debug] ", __FILE__, __LINE__); printf x; fflush(stdout);} while (0)
+ #else
+@@ -74,7 +82,7 @@
+ used = (unsigned long)mem.used;
+ buffers = (unsigned long)mem.buffer;
+ cached = (unsigned long)mem.cached;
+-#else
++#elif defined(linux)
+ FILE *fp;
+
+ if ((fp = fopen("/proc/meminfo", "r")) == NULL)
+@@ -109,8 +117,20 @@
+ sscanf(buff, "%*s %lu %lu %*u %*u %lu %lu", &total, &used, &buffers,
+ &cached);
+ }
++#elif defined(__FreeBSD__)
++ int pagesize = getpagesize();
++ size_t len = sizeof(used);
++ sysctlbyname("hw.physmem", &total, &len, NULL, 0);
++ sysctlbyname("vm.stats.vm.v_free_count", &free, &len, NULL, 0);
++ sysctlbyname("vfs.bufspace", &buffers, &len, NULL, 0);
++ sysctlbyname("vfs.stats.vm.v_cache_count", &cached, &len, NULL, 0);
++
++ cached *= pagesize;
++ free *= pagesize;
+
+-#endif /* HAVE_LIBGTOP */
++ used = total - free;
++
++#endif
+
+ used -= (buffers + cached);
+ mem_val = (int)((((float)used) / total) * 100.0);
+@@ -123,15 +143,15 @@
+ }
+ else if (used < 1024 * 1024)
+ {
+- Esnprintf(buff, sizeof(buff), "M: %luK", used / 1024);
++ Esnprintf(buff, sizeof(buff), "M: %dK", used / 1024);
+ }
+ else if (used < 1024 * 1024 * 1024)
+ {
+- Esnprintf(buff, sizeof(buff), "M: %luM", used / (1024 * 1024));
++ Esnprintf(buff, sizeof(buff), "M: %dM", used / (1024 * 1024));
+ }
+ else
+ {
+- Esnprintf(buff, sizeof(buff), "M: %luG", used / (1024 * 1024 * 1024));
++ Esnprintf(buff, sizeof(buff), "M: %.2lfG", used / (1024.0 * 1024.0 * 1024.0));
+ }
+ Epplet_change_label(mem_label, buff);
+
+@@ -145,7 +165,7 @@
+ used = (unsigned long)swap.used;
+ }
+ while (swap.total == 0 && swap.used == 0 && check++ < 15);
+-#else
++#elif defined(linux)
+
+ if (kernel_2_6)
+ {
+@@ -174,7 +194,21 @@
+ }
+
+ fclose(fp);
+-#endif /* HAVE_LIBGTOP */
++#elif defined(__FreeBSD__)
++ kvm_t *k;
++ struct kvm_swap swp;
++
++ if(!(k = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, "kvm_open"))) {
++ used = 0;
++ total = 1;
++ } else {
++ if(kvm_getswapinfo(k, &swp, 1, 0) != -1) {
++ used = swp.ksw_used;
++ total = swp.ksw_total;
++ }
++ kvm_close(k);
++ }
++#endif
+ swap_val = (int)((((float)used) / total) * 100.0);
+
+ /*printf ("Swap: %lu %lu %d%%\n", total, used, swap_val); */
+@@ -273,6 +307,7 @@
+ {
+
+ int prio;
++#ifdef linux
+
+ /* check for Kernel 2.6 */
+ FILE *fp;
+@@ -295,6 +330,7 @@
+
+ fclose(fp);
+ /* end check for Kernel 2.6 */
++#endif
+
+ atexit(Epplet_cleanup);
+ prio = getpriority(PRIO_PROCESS, getpid());
diff --git a/x11-wm/epplets/files/patch-epplets_E-Power.c b/x11-wm/epplets/files/patch-epplets_E-Power.c
new file mode 100644
index 000000000000..62b4e1ef20d1
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-Power.c
@@ -0,0 +1,269 @@
+--- epplets/E-Power.c.orig 2006-04-16 00:32:43.000000000 +0200
++++ epplets/E-Power.c 2008-03-10 17:12:55.000000000 +0100
+@@ -1,9 +1,22 @@
++/*-
++ * Copyright 2008, Pietro Cerutti <gahr@FreeBSD.org> (FreeBSD adaptation)
++ */
++
+ #define _GNU_SOURCE
+ #include "epplet.h"
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <dirent.h>
+
++#ifdef __FreeBSD__
++#include <fcntl.h>
++#include <sys/ioctl.h>
++#include <dev/acpica/acpiio.h>
++#ifdef __i386__
++#include <machine/apm_bios.h>
++#endif
++#endif
++
+ /* Modified by Attila ZIMLER <hijaszu@hlfslinux.hu>, 2003/11/16
+ Added ACPI power management support.
+ */
+@@ -11,6 +24,19 @@
+ /* Length of explain strings in /proc/acpi/battery/BAT0 data files */
+ #define DATA_EXPLAIN_STR_LEN 25
+
++/* Power management modes */
++#define MODE_NONE 0x0
++#define MODE_APM 0x1
++#define MODE_ACPI 0x2
++static unsigned mode = MODE_NONE;
++
++#ifdef __FreeBSD__
++#define ACPI_DEV "/dev/acpi"
++#define APM_DEV "/dev/apm"
++static int apm_fd = -1,
++ acpi_fd = -1;
++#endif
++
+ int prev_bat_val = 110;
+ int bat_val = 0;
+ int time_val = 0;
+@@ -31,17 +57,39 @@
+ static void
+ cb_timer(void *data)
+ {
+- struct stat st;
+
++#ifdef linux
++ struct stat st;
+ if ((stat("/proc/apm", &st) > -1) && S_ISREG(st.st_mode))
+- cb_timer_apm(data);
++ mode = MODE_APM;
+ else if ((stat("/proc/acpi", &st) > -1) && S_ISDIR(st.st_mode))
++ mode = MODE_ACPI;
++#elif defined(__FreeBSD__)
++ /*
++ * Try ACPI first, if does not work, revert to APM
++ */
++ if(acpi_fd != -1 || ((acpi_fd = open(ACPI_DEV, O_RDONLY)) != -1))
++ mode = MODE_ACPI;
++ else if(apm_fd != -1 || ((apm_fd = open(APM_DEV, O_RDONLY)) != -1))
++ mode = MODE_APM;
++#else
++ mode = MODE_NONE;
++#endif
++
++
++ if(mode & MODE_APM)
++ cb_timer_apm(data);
++ else if(mode & MODE_ACPI)
+ cb_timer_acpi(data);
+ }
+
+ static void
+ cb_timer_acpi(void *data)
+ {
++ char current_status[256];
++ int bat_val = 0;
++
++#ifdef linux
+ /* We don't have any data from the remaining percentage, and time directly,
+ * so we have to calculate and measure them.
+ * (Measure the time and calculate the percentage.)
+@@ -57,9 +105,6 @@
+ int bat_level = 0;
+ int bat_drain = 1;
+
+- int bat_val = 0;
+-
+- char current_status[256];
+ char *line = 0;
+ size_t lsize = 0;
+ int discharging = 0;
+@@ -203,27 +248,74 @@
+ else
+ snprintf(current_status, sizeof(current_status), "Full");
+
++ /* Final steps before ending the status update. */
++ data = NULL;
++ if (lsize)
++ free(line);
++
++#elif defined(__FreeBSD__)
++ union acpi_battery_ioctl_arg batt;
++ int c;
++ batt.unit = 0;
++ if(ioctl(acpi_fd, ACPIIO_BATT_GET_BATTINFO, &batt) == -1)
++ return;
++
++ /*
++ * Get percent
++ */
++ if(batt.battinfo.cap == -1) {
++ c = snprintf(current_status, sizeof(current_status), "???");
++ bat_val = 0;
++ }
++ else {
++ c = snprintf(current_status, sizeof(current_status), "%d%%",
++ batt.battinfo.cap);
++ bat_val = batt.battinfo.cap;
++ }
++
++ /*
++ * Get online status
++ */
++ if(batt.battinfo.state == ACPI_BATT_STAT_NOT_PRESENT)
++ c += snprintf(&current_status[c], sizeof(current_status) - c, " NONE\n");
++ else if(batt.battinfo.state == ACPI_BATT_STAT_DISCHARG || batt.battinfo.state == ACPI_BATT_STAT_CRITICAL)
++ c += snprintf(&current_status[c], sizeof(current_status) - c, " OFF\n");
++ else
++ c += snprintf(&current_status[c], sizeof(current_status) - c, " ON\n");
++
++ /*
++ * Get remaining time
++ */
++ if(batt.battinfo.min == -1) {
++ if(batt.battinfo.state == ACPI_BATT_STAT_DISCHARG ||
++ batt.battinfo.state == ACPI_BATT_STAT_CRITICAL ||
++ batt.battinfo.state == ACPI_BATT_STAT_NOT_PRESENT)
++ snprintf(&current_status[c], sizeof(current_status) - c, "?:??");
++ }
++ else {
++ snprintf(&current_status[c], sizeof(current_status) - c, "%d:%2d",
++ batt.battinfo.min / 60, batt.battinfo.min % 60);
++ }
++
++#endif
+ /* Display current status */
+ Epplet_change_label(label, current_status);
+ sprintf(current_status, "E-Power-Bat-%i.png", ((bat_val + 5) / 10) * 10);
+ Epplet_change_image(image, 44, 24, current_status);
+ Epplet_timer(cb_timer, NULL, 5.0, "TIMER");
+-
+- /* Final steps before ending the status update. */
+- data = NULL;
+- if (lsize)
+- free(line);
+ }
+
+ static void
+ cb_timer_apm(void *data)
+ {
++ char s[256];
++#ifdef linux
+ static FILE *f;
+
+ f = fopen("/proc/apm", "r");
+ if (f)
+ {
+- char s[256], s1[32], s2[32], s3[32];
++ char s1[32], s2[32], s3[32];
+ int apm_flags, ac_stat, bat_stat, bat_flags;
+ int i, hours, minutes, up, up2;
+ char *s_ptr;
+@@ -296,14 +388,57 @@
+ else
+ s_ptr += sprintf(s_ptr, "%i:%02i", hours, minutes);
+ }
+- Epplet_change_label(label, s);
++ prev_bat_val = bat_val;
++#elif defined(__FreeBSD__) && defined(__i386__)
++ struct apm_info apm;
++ int c;
++ if(ioctl(apm_fd, APMIO_GETINFO, &apm) == -1)
++ return;
+
++ /*
++ * Get percent
++ */
++ if(apm.ai_batt_life == 0xff) {
++ c = snprintf(s, sizeof(s), "???");
++ bat_val = 0;
++ }
++ else {
++ c = snprintf(s, sizeof(s), "%d%%", apm.ai_batt_life);
++ bat_val = apm.ai_batt_life;
++ }
++
++ /*
++ * Get online status
++ */
++ if(apm.ai_acline == 0xff)
++ c += snprintf(&s[c], sizeof(s) - c, " NONE\n");
++ else if(apm.ai_acline)
++ c += snprintf(&s[c], sizeof(s) - c, " ON\n");
++ else
++ c += snprintf(&s[c], sizeof(s) - c , " OFF\n");
++
++ /*
++ * Get remaining time
++ */
++ if(apm.ai_batt_time == -1) {
++ if(apm.ai_acline == 0xff || !apm.ai_acline)
++ snprintf(&s[c], sizeof(s) - c, "?:??");
++ }
++ else
++ snprintf(&s[c], sizeof(s) - c, "%d:%2d",
++ apm.ai_batt_time / 3600, apm.ai_batt_time / 60 % 60);
++#endif
++
++ /* Display current status */
++ Epplet_change_label(label, s);
+ sprintf(s, "E-Power-Bat-%i.png", ((bat_val + 5) / 10) * 10);
+ Epplet_change_image(image, 44, 24, s);
++#ifdef linux
+ Epplet_timer(cb_timer, NULL, 30.0, "TIMER");
++#else
++ Epplet_timer(cb_timer, NULL, 5.0, "TIMER");
++#endif
+
+- prev_bat_val = bat_val;
+- }
+ data = NULL;
+ }
+
+@@ -351,7 +486,14 @@
+ static void
+ cb_suspend(void *data)
+ {
++#ifdef __FreeBSD__
++ if(mode & MODE_ACPI)
++ system("/usr/sbin/acpiconf -s 5");
++ else if(mode & MODE_APM)
++ system("/usr/sbin/apm -z");
++#else
+ system("/usr/bin/apm -s");
++#endif
+ return;
+ data = NULL;
+ }
+@@ -359,7 +501,14 @@
+ static void
+ cb_sleep(void *data)
+ {
++#ifdef __FreeBSD__
++ if(mode & MODE_ACPI)
++ system("/usr/sbin/acpiconf -s 1");
++ else if(mode & MODE_APM)
++ system("/usr/sbin/amp -z");
++#else
+ system("/usr/bin/apm -S");
++#endif
+ return;
+ data = NULL;
+ }
diff --git a/x11-wm/epplets/files/patch-epplets_E-SD.c b/x11-wm/epplets/files/patch-epplets_E-SD.c
new file mode 100644
index 000000000000..dc000ecc90a0
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-SD.c
@@ -0,0 +1,14 @@
+--- epplets/E-SD.c.orig 2008-01-11 09:53:52.000000000 +0100
++++ epplets/E-SD.c 2008-01-11 09:56:10.000000000 +0100
+@@ -586,6 +586,11 @@
+ esd_monitor_stream(ESD_BITS16 | ESD_STEREO | ESD_STREAM | ESD_PLAY,
+ RATE, NULL, "E-SD");
+
++ if(esd.fd < 0) {
++ printf("ERROR: Couldn't open EsounD monitor stream!\n");
++ exit(EXIT_FAILURE);
++ }
++
+ fcntl(esd.fd, F_SETFL, O_NONBLOCK);
+
+ if (esd_get_standby_mode(esd.fd) == ESM_RUNNING)
diff --git a/x11-wm/epplets/files/patch-epplets_E-Slides.c b/x11-wm/epplets/files/patch-epplets_E-Slides.c
new file mode 100644
index 000000000000..9b22c5d2a691
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-Slides.c
@@ -0,0 +1,60 @@
+--- epplets/E-Slides.c.orig 2008-03-10 17:24:51.000000000 +0100
++++ epplets/E-Slides.c 2008-03-10 17:26:19.000000000 +0100
+@@ -53,18 +53,18 @@
+ #define AUTOBG_SCALED 2
+ #define AUTOBG_PSCALED 3
+
+-Epplet_gadget close_button, play_button, pause_button, prev_button,
+- next_button, cfg_button, cfg_popup, picture;
+-Epplet_gadget cfg_tb_path, cfg_tb_delay, cfg_tb_zoom;
+-unsigned long idx = 0, image_cnt = 0;
+-double delay = 5.0;
+-char **filenames = NULL, *path, *zoom_cmd;
+-unsigned char paused = 0, randomize = 0, auto_setbg =
+- AUTOBG_OFF, maintain_aspect = 0;
+-int cfg_auto_setbg = AUTOBG_OFF, cfg_maintain_aspect =
+- 0, cfg_randomize = 0;
+-Window zoom_win = None, config_win = None;
+-int w = 3, h = 3;
++Epplet_gadget close_button, play_button, pause_button, prev_button,
++ next_button, cfg_button, cfg_popup, picture;
++Epplet_gadget cfg_tb_path, cfg_tb_delay, cfg_tb_zoom;
++unsigned long idx = 0, image_cnt = 0;
++double delay = 5.0;
++char **filenames = NULL, *path, *zoom_cmd;
++unsigned char paused = 0, randomize = 0, auto_setbg = AUTOBG_OFF,
++ maintain_aspect = 0;
++size_t cfg_auto_setbg = AUTOBG_OFF;
++int cfg_maintain_aspect = 0, cfg_randomize = 0;
++Window zoom_win = None, config_win = None;
++int w = 3, h = 3;
+
+ static char **dirscan(char *dir, unsigned long *num);
+ static char **randomize_file_list(char **names, unsigned long num);
+@@ -376,7 +376,7 @@
+ cfg_popup_cb(void *data)
+ {
+
+- int n = (int)data;
++ size_t n = (size_t)data;
+
+ switch (n)
+ {
+@@ -404,7 +404,7 @@
+ play_cb(void *data)
+ {
+
+- int op = (int)data;
++ size_t op = (size_t)data;
+
+ switch (op)
+ {
+@@ -588,7 +588,7 @@
+ static void
+ auto_popup_cb(void *data)
+ {
+- cfg_auto_setbg = (int)data;
++ cfg_auto_setbg = (size_t)data;
+ }
+
+ static void
diff --git a/x11-wm/epplets/files/patch-epplets_E-Sys.c b/x11-wm/epplets/files/patch-epplets_E-Sys.c
new file mode 100644
index 000000000000..7df73ac84e85
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-Sys.c
@@ -0,0 +1,61 @@
+--- epplets/E-Sys.c.orig 2008-01-24 19:41:11.000000000 +0100
++++ epplets/E-Sys.c 2008-01-24 19:54:23.000000000 +0100
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (C) 1999-2000, Michael Jennings
++ * 2008, Pietro Cerutti <gahr@FreeBSD.org> (FreeBSD adaptation)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+@@ -36,6 +37,12 @@
+ #include "proc.h"
+ #endif
+
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#define USECS_PER_SEC 1000;
++#endif
++
+ #if 0
+ # define D(x) do {printf("%10s | %7d: [debug] ", __FILE__, __LINE__); printf x; fflush(stdout);} while (0)
+ #else
+@@ -67,7 +74,7 @@
+ glibtop_get_uptime(&uptime);
+ secs = (unsigned long)uptime.uptime;
+
+-#else
++#elif defined(linux)
+
+ FILE *fp;
+
+@@ -81,6 +88,15 @@
+ secs = (unsigned long)total_secs;
+ fclose(fp);
+
++#elif defined(__FreeBSD__)
++ struct timeval bt;
++ size_t len = sizeof(bt);
++ time_t base, now;
++ int mib[] = {CTL_KERN, KERN_BOOTTIME};
++ sysctl(mib, 2, &bt, &len, NULL, 0);
++ time(&now);
++ base = now - bt.tv_sec + 30;
++ secs = base;
+ #endif
+
+ days = secs / 86400;
+@@ -89,11 +105,8 @@
+ secs %= 3600;
+ mins = secs / 60;
+ secs %= 60;
+- if (secs == 0)
+- {
+- secs = 60;
+- }
+- delay = (double)secs;
++
++ delay = 60 - (double)secs;
+
+ Esnprintf(buff, sizeof(buff), "%lu days", days);
+ Epplet_change_label(label2, buff);
diff --git a/x11-wm/epplets/files/patch-epplets_E-Wireless.c b/x11-wm/epplets/files/patch-epplets_E-Wireless.c
new file mode 100644
index 000000000000..472f0fb9c365
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_E-Wireless.c
@@ -0,0 +1,179 @@
+--- epplets/E-Wireless.c.orig 2006-04-16 00:32:43.000000000 +0200
++++ epplets/E-Wireless.c 2008-03-10 21:21:36.000000000 +0100
+@@ -3,6 +3,8 @@
+ * copyleft (C) Mark C. Langston 1999
+ * Damn near all the code originally from: cocidius@telebot.net
+ * and his E-CpuX Epplet.
++ *
++ * Copyright (C) 2008, Pietro Cerutti <gahr@FreeBSD.org> (FreeBSD adaptation)
+ */
+
+ #include <stdio.h>
+@@ -13,6 +15,18 @@
+ #include <errno.h>
+ #include <epplet.h>
+
++#ifdef __FreeBSD__
++#include <sys/param.h>
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <sys/sockio.h>
++#include <net/if.h>
++#include <net/if_media.h>
++#include <net80211/ieee80211_ioctl.h>
++#include <ifaddrs.h>
++#include <strings.h>
++#endif
++
+ #define HEIGHT 30
+ #define WIDTH 40
+
+@@ -25,7 +39,7 @@
+ int cpu_hist_size = 0;
+ int *cpu_hist = NULL;
+ int hist_pos = 0;
+-int color = 0;
++size_t color = 0;
+ unsigned long prev_total = 0;
+ unsigned long prev_out = 0;
+ unsigned long prev_in = 0;
+@@ -152,11 +166,71 @@
+ static void
+ cb_timer(void *data)
+ {
++ double sigstr = 0;
++ unsigned long l0;
++ char ss[64];
++ int percent;
++
++/*
++ * Sorry, no support for FreeBSD 5.x
++ */
++#ifdef __FreeBSD__
++ char if_name[IFNAMSIZ];
++ int sock;
++ char buffer[24 * 1024];
++ struct ifaddrs *ifa, *ifa_iter;
++ struct ifmediareq ifmr;
++ struct ieee80211req ireq;
++ struct ieee80211req_scan_result scan;
++
++ bzero(if_name, sizeof(if_name));
++
++ if((sock = socket(PF_INET, SOCK_DGRAM, 0)) == -1) {
++ perror("socket");
++ goto common;
++ }
++
++ if(getifaddrs(&ifa)) {
++ perror("getifaddrs");
++ goto common;
++ }
++
++ ifa_iter = ifa;
++ do
++ {
++ bzero(&ifmr, sizeof(ifmr));
++ strncpy(ifmr.ifm_name, ifa_iter->ifa_name, sizeof(ifmr.ifm_name)-1);
++
++ if(ioctl(sock, SIOCGIFMEDIA, &ifmr) < 0) continue;
++ if(!(ifmr.ifm_status & IFM_AVALID)) continue;
++ if(IFM_TYPE(ifmr.ifm_active) != IFM_IEEE80211) continue;
++ strncpy(if_name, ifa_iter->ifa_name, sizeof(if_name)-1);
++ break;
++ } while((ifa_iter = ifa_iter->ifa_next));
++
++ freeifaddrs(ifa);
++
++ if(!*if_name) goto common;
++
++ strncpy(ireq.i_name, if_name, sizeof(ireq.i_name) - 1);
++ ireq.i_type = IEEE80211_IOC_SCAN_RESULTS;
++ ireq.i_data = buffer;
++ ireq.i_len = sizeof(buffer);
++
++ if(ioctl(sock, SIOCG80211, &ireq) < 0) {
++ close(sock);
++ goto common;
++ }
++ close(sock);
++
++ if(ireq.i_len < sizeof(scan))
++ goto common;
++
++ bcopy(buffer, &scan, sizeof(scan));
++ sigstr = scan.isr_rssi;
++#else
+ FILE *fpStat;
+- int percent;
+- double sigstr;
+- char s[256], ss[64];
+- unsigned long l0;
++ char s[256];
+
+ fpStat = fopen("/proc/net/wireless", "r");
+ if (fpStat)
+@@ -169,8 +243,15 @@
+ sscanf(s, "%*s %*s %s %*s %*s %*s %*s %*s", ss);
+
+ sigstr = atof(ss);
++ fclose(fpStat);
++ }
++#endif
++
++common:
++
++ l0 = sigstr;
++ percent = (100 * l0 / 92);
+
+- l0 = sigstr;
+ percent = (100 * l0 / 92);
+ if (percent > 100)
+ percent = 100;
+@@ -179,13 +260,11 @@
+ sprintf(ss, "%d%%", percent);
+ Epplet_change_label(lbl_usage, ss);
+
+- fclose(fpStat);
+ draw_graph();
+ hist_pos++;
+ hist_pos %= WIDTH;
+ Epplet_paste_buf(buf, win, 0, 0);
+ Epplet_timer(cb_timer, NULL, 1, "TIMER");
+- }
+ data = NULL;
+ }
+
+@@ -234,7 +313,7 @@
+ {
+ char s[2] = { 0, 0 };
+
+- color = (int)data;
++ color = (size_t)data;
+ s[0] = '0' + color;
+ Epplet_modify_config("color", s);
+ Epplet_save_config();
+@@ -257,7 +336,7 @@
+ memset(cpu_hist, 0x00, sizeof(int) * cpu_hist_size);
+ hist_pos = 0;
+
+- Epplet_Init("E-WIRELESS", "0.1", "E 802.11 signal monitoring epplet",
++ Epplet_Init("E-Wireless", "0.1", "E 802.11 signal monitoring epplet",
+ 3, 3, argc, argv, 0);
+
+ Epplet_load_config();
+@@ -283,10 +362,10 @@
+
+ p = Epplet_create_popup();
+ Epplet_add_popup_entry(p, "Green", NULL, cb_color, (void *)0L);
+- Epplet_add_popup_entry(p, "Blue", NULL, cb_color, (void *)1L);
+- Epplet_add_popup_entry(p, "Red", NULL, cb_color, (void *)2L);
+- Epplet_add_popup_entry(p, "Yellow", NULL, cb_color, (void *)3L);
+- Epplet_add_popup_entry(p, "Cyan", NULL, cb_color, (void *)4L);
++ Epplet_add_popup_entry(p, "Red", NULL, cb_color, (void *)1L);
++ Epplet_add_popup_entry(p, "Blue", NULL, cb_color, (void *)2L);
++ Epplet_add_popup_entry(p, "Cyan", NULL, cb_color, (void *)3L);
++ Epplet_add_popup_entry(p, "Yellow", NULL, cb_color, (void *)4L);
+ Epplet_add_popup_entry(p, "Magenta", NULL, cb_color, (void *)5L);
+ Epplet_add_popup_entry(p, "Gray", NULL, cb_color, (void *)6L);
+ popup = Epplet_create_popupbutton("Colors", NULL, 6, 24, 36, 12, NULL, p);
diff --git a/x11-wm/epplets/files/patch-epplets_Makefile.in b/x11-wm/epplets/files/patch-epplets_Makefile.in
new file mode 100644
index 000000000000..82a35a61e91f
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_Makefile.in
@@ -0,0 +1,180 @@
+--- epplets/Makefile.in.orig 2007-05-04 00:02:50.000000000 +0200
++++ epplets/Makefile.in 2008-03-10 12:39:28.000000000 +0100
+@@ -46,7 +46,6 @@
+ E-Magic.epplet$(EXEEXT) E-Toolbox.epplet$(EXEEXT) \
+ E-NetFlame.epplet$(EXEEXT) E-Sys.epplet$(EXEEXT) \
+ E-ScreenShoot.epplet$(EXEEXT) E-Slides.epplet$(EXEEXT) \
+- E-Xss.epplet$(EXEEXT) E-Mountbox.epplet$(EXEEXT) \
+ E-Exec.epplet$(EXEEXT) E-ScreenSave.epplet$(EXEEXT) \
+ E-NetGraph.epplet$(EXEEXT) E-MoonClock.epplet$(EXEEXT) \
+ E-UrlWatch.epplet$(EXEEXT) E-LoadMeter.epplet$(EXEEXT) \
+@@ -109,9 +108,6 @@
+ CalcEphem.$(OBJEXT) Moon.$(OBJEXT)
+ E_MoonClock_epplet_OBJECTS = $(am_E_MoonClock_epplet_OBJECTS)
+ E_MoonClock_epplet_LDADD = $(LDADD)
+-am_E_Mountbox_epplet_OBJECTS = E-Mountbox.$(OBJEXT)
+-E_Mountbox_epplet_OBJECTS = $(am_E_Mountbox_epplet_OBJECTS)
+-E_Mountbox_epplet_LDADD = $(LDADD)
+ am_E_Net_epplet_OBJECTS = E-Net.$(OBJEXT) net.$(OBJEXT)
+ E_Net_epplet_OBJECTS = $(am_E_Net_epplet_OBJECTS)
+ E_Net_epplet_LDADD = $(LDADD)
+@@ -164,9 +160,6 @@
+ am_E_Wireless_epplet_OBJECTS = E-Wireless.$(OBJEXT)
+ E_Wireless_epplet_OBJECTS = $(am_E_Wireless_epplet_OBJECTS)
+ E_Wireless_epplet_LDADD = $(LDADD)
+-am_E_Xss_epplet_OBJECTS = E-Xss.$(OBJEXT)
+-E_Xss_epplet_OBJECTS = $(am_E_Xss_epplet_OBJECTS)
+-E_Xss_epplet_LDADD = $(LDADD)
+ am_Emix_epplet_OBJECTS = Emix.$(OBJEXT)
+ Emix_epplet_OBJECTS = $(am_Emix_epplet_OBJECTS)
+ Emix_epplet_LDADD = $(LDADD)
+@@ -203,9 +196,8 @@
+ $(E_ScreenShoot_epplet_SOURCES) $(E_Slides_epplet_SOURCES) \
+ $(E_Sys_epplet_SOURCES) $(E_Time_epplet_SOURCES) \
+ $(E_Toolbox_epplet_SOURCES) $(E_UrlWatch_epplet_SOURCES) \
+- $(E_Wireless_epplet_SOURCES) $(E_Xss_epplet_SOURCES) \
+- $(Emix_epplet_SOURCES) $(EppletConfigTest_epplet_SOURCES) \
+- $(EppletTest_epplet_SOURCES)
++ $(E_Wireless_epplet_SOURCES) $(Emix_epplet_SOURCES) \
++ $(EppletConfigTest_epplet_SOURCES) $(EppletTest_epplet_SOURCES)
+ DIST_SOURCES = $(E_Areas_epplet_SOURCES) $(E_Bandwidth_epplet_SOURCES) \
+ $(E_Biff_epplet_SOURCES) $(E_Clock_epplet_SOURCES) \
+ $(E_Cpu_epplet_SOURCES) $(E_Disk_epplet_SOURCES) \
+@@ -221,9 +213,8 @@
+ $(E_ScreenShoot_epplet_SOURCES) $(E_Slides_epplet_SOURCES) \
+ $(E_Sys_epplet_SOURCES) $(E_Time_epplet_SOURCES) \
+ $(E_Toolbox_epplet_SOURCES) $(E_UrlWatch_epplet_SOURCES) \
+- $(E_Wireless_epplet_SOURCES) $(E_Xss_epplet_SOURCES) \
+- $(Emix_epplet_SOURCES) $(EppletConfigTest_epplet_SOURCES) \
+- $(EppletTest_epplet_SOURCES)
++ $(E_Wireless_epplet_SOURCES) $(Emix_epplet_SOURCES) \
++ $(EppletConfigTest_epplet_SOURCES) $(EppletTest_epplet_SOURCES)
+ ETAGS = etags
+ CTAGS = ctags
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+@@ -445,10 +436,11 @@
+ E_MemWatch_epplet_SOURCES = E-MemWatch.c
+ E_MemWatch_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
+ E_MemWatch_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
+-E_MemWatch_epplet_LDADD = $(LDADD) $(GTLIBS)
++E_MemWatch_epplet_LDADD = $(LDADD) $(GTLIBS) -lkvm
+ E_Disk_epplet_SOURCES = E-Disk.c
+ E_Disk_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
+ E_Disk_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
++E_Disk_epplet_LDADD = $(LDADD) $(GTLIBS) -ldevstat
+ E_Sys_epplet_SOURCES = E-Sys.c
+ E_Sys_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
+ E_Sys_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
+@@ -456,9 +448,6 @@
+ E_Slides_epplet_SOURCES = E-Slides.c
+ E_Slides_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
+ E_Slides_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
+-E_Xss_epplet_SOURCES = E-Xss.c
+-E_Xss_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
+-E_Xss_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
+ E_ScreenShoot_epplet_SOURCES = \
+ E-ScreenShoot.c cloak.c utils.c utils.h cloak.h \
+ E-ScreenShoot_ftp.c E-ScreenShoot_ftp.h
+@@ -476,9 +465,6 @@
+ E_UrlWatch_epplet_SOURCES = E-UrlWatch.c E-UrlWatch.h utils.c utils.h
+ E_UrlWatch_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
+ E_UrlWatch_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
+-E_Mountbox_epplet_SOURCES = E-Mountbox.c
+-E_Mountbox_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
+-E_Mountbox_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
+ E_Pinger_epplet_SOURCES = E-Pinger.c
+ E_Pinger_epplet_DEPENDENCIES = $(top_builddir)/api/libepplet.la
+ E_Pinger_epplet_LDFLAGS = -rpath $(libdir):$(pkglibdir)
+@@ -496,10 +482,6 @@
+ E-Mixer.ABOUT/E-Mixer-wide.png \
+ E-Mixer.ABOUT/MAIN \
+ E-MoonClock.ABOUT/MAIN \
+-E-Mountbox.ABOUT/dialog.png \
+-E-Mountbox.ABOUT/MAIN \
+-E-Mountbox.ABOUT/shot.png \
+-E-Mountbox.ABOUT/shot_unmounted.png \
+ E-NetFlame.ABOUT/MAIN \
+ E-OpenGL-Demo.ABOUT/MAIN \
+ E-Pants.ABOUT/MAIN \
+@@ -523,10 +505,10 @@
+ ICONS = icons/E-Biff.icon icons/E-Clock.icon icons/E-Cpu.icon \
+ icons/E-Disk.icon icons/E-Exec.icon icons/E-Load.icon \
+ icons/E-MemWatch.icon icons/E-Mixer.icon \
+-icons/E-MoonClock.icon icons/E-Mountbox.icon icons/E-Net.icon \
++icons/E-MoonClock.icon icons/E-Net.icon \
+ icons/E-NetFlame.icon icons/E-Power.icon icons/E-SD.icon \
+ icons/E-ScreenSave.icon icons/E-ScreenShoot.icon icons/E-Slides.icon \
+-icons/E-Sys.icon icons/E-Time.icon icons/E-Xss.icon icons/Emix.icon \
++icons/E-Sys.icon icons/E-Time.icon icons/Emix.icon \
+ icons/E-UrlWatch.icon icons/E-Magic.icon icons/E-PlayCD.icon \
+ icons/E-OpenGL-Demo.icon icons/E-Pinger.icon \
+ icons/E-Pinger.icon.bg icons/E-Pants.icon icons/E-Wireless.icon
+@@ -565,9 +547,6 @@
+ E-MoonClock-data/E-MoonClock-55.png E-MoonClock-data/E-MoonClock-56.png \
+ E-MoonClock-data/E-MoonClock-57.png E-MoonClock-data/E-MoonClock-58.png \
+ E-MoonClock-data/E-MoonClock-59.png E-MoonClock-data/E-MoonClock-60.png \
+-E-Mountbox-data/E-Mountbox-bg.png E-Mountbox-data/E-Mountbox-blockdev.png \
+-E-Mountbox-data/E-Mountbox-cd.png E-Mountbox-data/E-Mountbox-floppy.png \
+-E-Mountbox-data/E-Mountbox-zip.png E-Mountbox-data/E-Mountbox-jazz.png \
+ E-Power-data/E-Power-Bat-0.png E-Power-data/E-Power-Bat-10.png \
+ E-Power-data/E-Power-Bat-100.png E-Power-data/E-Power-Bat-20.png \
+ E-Power-data/E-Power-Bat-30.png E-Power-data/E-Power-Bat-40.png \
+@@ -591,11 +570,11 @@
+ E-Toolbox-data/sample.cfg E-Toolbox-data/popup-sample.cfg \
+ E-Toolbox-data/default.cfg
+
+-NEED_FONT = E-Clock E-Mixer E-MoonClock E-Mountbox E-NetFlame E-Power E-SD \
++NEED_FONT = E-Clock E-Mixer E-MoonClock E-NetFlame E-Power E-SD \
+ E-ScreenSave E-ScreenShoot Emix E-UrlWatch E-PlayCD E-OpenGL-Demo \
+ E-Pinger E-Pants E-Cpu E-Wireless
+
+-NEED_BG = E-Clock E-Mixer E-MoonClock E-Mountbox E-NetFlame E-Power E-SD \
++NEED_BG = E-Clock E-Mixer E-MoonClock E-NetFlame E-Power E-SD \
+ E-ScreenSave E-ScreenShoot Emix E-UrlWatch E-PlayCD E-OpenGL-Demo \
+ E-Pinger E-Pants E-Cpu E-Wireless
+
+@@ -702,9 +681,6 @@
+ E-MoonClock.epplet$(EXEEXT): $(E_MoonClock_epplet_OBJECTS) $(E_MoonClock_epplet_DEPENDENCIES)
+ @rm -f E-MoonClock.epplet$(EXEEXT)
+ $(LINK) $(E_MoonClock_epplet_LDFLAGS) $(E_MoonClock_epplet_OBJECTS) $(E_MoonClock_epplet_LDADD) $(LIBS)
+-E-Mountbox.epplet$(EXEEXT): $(E_Mountbox_epplet_OBJECTS) $(E_Mountbox_epplet_DEPENDENCIES)
+- @rm -f E-Mountbox.epplet$(EXEEXT)
+- $(LINK) $(E_Mountbox_epplet_LDFLAGS) $(E_Mountbox_epplet_OBJECTS) $(E_Mountbox_epplet_LDADD) $(LIBS)
+ E-Net.epplet$(EXEEXT): $(E_Net_epplet_OBJECTS) $(E_Net_epplet_DEPENDENCIES)
+ @rm -f E-Net.epplet$(EXEEXT)
+ $(LINK) $(E_Net_epplet_LDFLAGS) $(E_Net_epplet_OBJECTS) $(E_Net_epplet_LDADD) $(LIBS)
+@@ -756,9 +732,6 @@
+ E-Wireless.epplet$(EXEEXT): $(E_Wireless_epplet_OBJECTS) $(E_Wireless_epplet_DEPENDENCIES)
+ @rm -f E-Wireless.epplet$(EXEEXT)
+ $(LINK) $(E_Wireless_epplet_LDFLAGS) $(E_Wireless_epplet_OBJECTS) $(E_Wireless_epplet_LDADD) $(LIBS)
+-E-Xss.epplet$(EXEEXT): $(E_Xss_epplet_OBJECTS) $(E_Xss_epplet_DEPENDENCIES)
+- @rm -f E-Xss.epplet$(EXEEXT)
+- $(LINK) $(E_Xss_epplet_LDFLAGS) $(E_Xss_epplet_OBJECTS) $(E_Xss_epplet_LDADD) $(LIBS)
+ Emix.epplet$(EXEEXT): $(Emix_epplet_OBJECTS) $(Emix_epplet_DEPENDENCIES)
+ @rm -f Emix.epplet$(EXEEXT)
+ $(LINK) $(Emix_epplet_LDFLAGS) $(Emix_epplet_OBJECTS) $(Emix_epplet_LDADD) $(LIBS)
+@@ -790,7 +763,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-MemWatch.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-Mixer.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-MoonClock.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-Mountbox.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-Net.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-NetFlame.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-NetGraph.Po@am__quote@
+@@ -809,7 +781,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-Toolbox.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-UrlWatch.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-Wireless.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/E-Xss.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Emix.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Moon.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestEpplet.Po@am__quote@
+@@ -900,7 +871,7 @@
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+ distdir: $(DISTFILES)
+- $(mkdir_p) $(distdir)/E-Biff-data $(distdir)/E-Clock-data $(distdir)/E-Clock.ABOUT $(distdir)/E-Cpu.ABOUT $(distdir)/E-Magic-data $(distdir)/E-Mixer.ABOUT $(distdir)/E-MoonClock-data $(distdir)/E-MoonClock.ABOUT $(distdir)/E-Mountbox-data $(distdir)/E-Mountbox.ABOUT $(distdir)/E-NetFlame.ABOUT $(distdir)/E-OpenGL-Demo-data $(distdir)/E-OpenGL-Demo.ABOUT $(distdir)/E-Pants.ABOUT $(distdir)/E-Pinger.ABOUT $(distdir)/E-PlayCD.ABOUT $(distdir)/E-Power-data $(distdir)/E-Power.ABOUT $(distdir)/E-SD-data $(distdir)/E-SD.ABOUT $(distdir)/E-ScreenSave.ABOUT $(distdir)/E-ScreenShoot-data $(distdir)/E-ScreenShoot.ABOUT $(distdir)/E-Toolbox-data $(distdir)/E-UrlWatch-data $(distdir)/E-UrlWatch.ABOUT $(distdir)/E-Wireless.ABOUT $(distdir)/Emix-data $(distdir)/Emix.ABOUT $(distdir)/icons
++ $(mkdir_p) $(distdir)/E-Biff-data $(distdir)/E-Clock-data $(distdir)/E-Clock.ABOUT $(distdir)/E-Cpu.ABOUT $(distdir)/E-Magic-data $(distdir)/E-Mixer.ABOUT $(distdir)/E-MoonClock-data $(distdir)/E-MoonClock.ABOUT $(distdir)/E-NetFlame.ABOUT $(distdir)/E-OpenGL-Demo-data $(distdir)/E-OpenGL-Demo.ABOUT $(distdir)/E-Pants.ABOUT $(distdir)/E-Pinger.ABOUT $(distdir)/E-PlayCD.ABOUT $(distdir)/E-Power-data $(distdir)/E-Power.ABOUT $(distdir)/E-SD-data $(distdir)/E-SD.ABOUT $(distdir)/E-ScreenSave.ABOUT $(distdir)/E-ScreenShoot-data $(distdir)/E-ScreenShoot.ABOUT $(distdir)/E-Toolbox-data $(distdir)/E-UrlWatch-data $(distdir)/E-UrlWatch.ABOUT $(distdir)/E-Wireless.ABOUT $(distdir)/Emix-data $(distdir)/Emix.ABOUT $(distdir)/icons
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
diff --git a/x11-wm/epplets/files/patch-epplets_load.c b/x11-wm/epplets/files/patch-epplets_load.c
new file mode 100644
index 000000000000..4e3092f0791c
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_load.c
@@ -0,0 +1,38 @@
+--- epplets/load.c.orig 2008-01-24 15:26:46.000000000 +0100
++++ epplets/load.c 2008-01-24 16:07:37.000000000 +0100
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (C) 1999-2000, Michael Jennings
++ * 2008, Pietro Cerutti <gahr@FreeBSD.org> (FreeBSD adaptation)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+@@ -38,6 +39,10 @@
+ #include <errno.h>
+ #include <unistd.h>
+
++#ifdef __FreeBSD__
++#include <stdlib.h> /* getloadavg(3) */
++#endif
++
+ #if 0
+ # define D(x) do {printf("%10s | %7d: [debug] ", __FILE__, __LINE__); printf x; fflush(stdout);} while (0)
+ #else
+@@ -99,9 +104,15 @@
+ sscanf(buff, "%lf %lf %lf", &a, &b, &c);
+ SET_AND_RETURN(a, b, c);
+ }
+-
++#elif defined(__FreeBSD__)
++void
++get_load_average(double *one, double *five, double *fifteen)
++{
++ double load[3];
++ getloadavg(load, 3);
++ SET_AND_RETURN(load[0], load[1], load[2]);
++}
+ #else
+-/* A generic fallback that should work just about anywhere. */
+ void
+ get_load_average(double *one, double *five, double *fifteen)
+ {
diff --git a/x11-wm/epplets/files/patch-epplets_net.c b/x11-wm/epplets/files/patch-epplets_net.c
new file mode 100644
index 000000000000..7ffb4a32a89c
--- /dev/null
+++ b/x11-wm/epplets/files/patch-epplets_net.c
@@ -0,0 +1,130 @@
+--- epplets/net.c.orig 2006-04-16 00:32:43.000000000 +0200
++++ epplets/net.c 2008-03-10 21:26:47.000000000 +0100
+@@ -1,5 +1,6 @@
+ /*
+ * Copyright (C) 1999-2000, Michael Jennings
++ * 2008, Pietro Cerutti <gahr@FreeBSD.org> (FreeBSD adaptation)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+@@ -38,6 +39,14 @@
+ #ifdef linux
+ # include <linux/version.h>
+ #endif
++#ifdef __FreeBSD__
++# include <sys/types.h>
++# include <sys/socket.h>
++# include <sys/sysctl.h>
++# include <sys/time.h>
++# include <net/if.h>
++# include <net/if_mib.h>
++#endif
+ #include "epplet.h"
+ #include "net.h"
+
+@@ -86,6 +95,48 @@
+ }
+ fclose(fp);
+ return (names);
++
++#elif defined(__FreeBSD__)
++
++ struct ifmibdata data;
++ int ifno_mib[5];
++ int fmib_mib[6];
++ int nof_rows, idx, row;
++ size_t len;
++
++ ifno_mib[0] = CTL_NET;
++ ifno_mib[1] = PF_LINK;
++ ifno_mib[2] = NETLINK_GENERIC;
++ ifno_mib[3] = IFMIB_SYSTEM;
++ ifno_mib[4] = IFMIB_IFCOUNT;
++
++ fmib_mib[0] = CTL_NET;
++ fmib_mib[1] = PF_LINK;
++ fmib_mib[2] = NETLINK_GENERIC;
++ fmib_mib[3] = IFMIB_IFDATA;
++ fmib_mib[5] = IFDATA_GENERAL;
++
++ len = sizeof(nof_rows);
++
++ sysctl(ifno_mib, 5, &nof_rows, &len, NULL, 0);
++
++ len = sizeof(data);
++
++ for(row=1, idx=0; row <= nof_rows; row++) {
++ fmib_mib[4] = row;
++ if(sysctl(fmib_mib, 6, &data, &len, NULL, 0) && errno == ENOENT)
++ continue;
++ else {
++ names = realloc(names, sizeof(char *) * ++idx);
++ names[idx-1] = strdup(data.ifmd_name);
++ }
++ }
++ names[idx] = NULL;
++
++ if(count) *count = idx;
++ return (names);
++
++
+ #elif defined(__sun__)
+ return ((char **)NULL);
+ #else
+@@ -107,8 +158,11 @@
+ FILE *fp;
+ char buff[256], *colon =
+ NULL, dev[64], in_str[64], out_str[64];
++#elif defined(__FreeBSD__)
++ struct ifmibdata data;
++ int mib[6], ifno_mib[5], row, nof_ifaces;
++ size_t len;
+ #endif
+-
+ if (device == NULL)
+ {
+ return (EFAULT);
+@@ -173,6 +227,43 @@
+ }
+ fclose(fp);
+ return ((match) ? (0) : (ENODEV));
++#elif defined(__FreeBSD__)
++ ifno_mib[0] = CTL_NET;
++ ifno_mib[1] = PF_LINK;
++ ifno_mib[2] = NETLINK_GENERIC;
++ ifno_mib[3] = IFMIB_SYSTEM;
++ ifno_mib[4] = IFMIB_IFCOUNT;
++
++ len = sizeof(nof_ifaces);
++
++ sysctl(ifno_mib, 5, &nof_ifaces, &len, NULL, 0);
++
++ mib[0] = CTL_NET;
++ mib[1] = PF_LINK;
++ mib[2] = NETLINK_GENERIC;
++ mib[3] = IFMIB_IFDATA;
++ mib[5] = IFDATA_GENERAL;
++
++ len = sizeof(data);
++
++ for(row=1; row<=nof_ifaces; row++) {
++ mib[4] = row;
++
++ if(sysctl(mib, 6, &data, &len, NULL, 0) && errno == ENOENT)
++ continue;
++
++ if(strcmp(device, data.ifmd_name))
++ continue;
++
++ if(in_bytes)
++ *in_bytes = (double)data.ifmd_data.ifi_ibytes;
++ if(out_bytes)
++ *out_bytes = (double)data.ifmd_data.ifi_obytes;
++ return (0);
++ }
++
++ return (ENODEV);
++
+ #else
+ /* Unsupported platform. */
+ if (in_bytes != NULL)
diff --git a/x11-wm/epplets/pkg-plist b/x11-wm/epplets/pkg-plist
index 3006fd2df907..c5ab6e5648fb 100644
--- a/x11-wm/epplets/pkg-plist
+++ b/x11-wm/epplets/pkg-plist
@@ -11,7 +11,6 @@ bin/E-Magic.epplet
bin/E-MemWatch.epplet
bin/E-Mixer.epplet
bin/E-MoonClock.epplet
-bin/E-Mountbox.epplet
bin/E-Net.epplet
bin/E-NetFlame.epplet
bin/E-NetGraph.epplet
@@ -19,6 +18,7 @@ bin/E-OpenGL-Demo.epplet
bin/E-Pants.epplet
bin/E-Pinger.epplet
bin/E-PlayCD.epplet
+bin/E-Power.epplet
bin/E-SD.epplet
bin/E-ScreenSave.epplet
bin/E-ScreenShoot.epplet
@@ -28,13 +28,12 @@ bin/E-Time.epplet
bin/E-Toolbox.epplet
bin/E-UrlWatch.epplet
bin/E-Wireless.epplet
-bin/E-Xss.epplet
bin/Emix.epplet
include/epplet.h
lib/libepplet.a
lib/libepplet.la
lib/libepplet.so
-lib/libepplet.so.1
+lib/libepplet.so.2
share/e16/epplet_data/E-Biff/7of9.png
share/e16/epplet_data/E-Biff/newmail.png
share/e16/epplet_data/E-Biff/nomail.png
@@ -116,18 +115,6 @@ share/e16/epplet_data/E-MoonClock/E-MoonClock-60.png
share/e16/epplet_data/E-MoonClock/E-MoonClock.ABOUT/MAIN
share/e16/epplet_data/E-MoonClock/E-MoonClock.ABOUT/aircut3.ttf
share/e16/epplet_data/E-MoonClock/E-MoonClock.ABOUT/bg.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox-bg.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox-blockdev.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox-cd.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox-floppy.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox-jazz.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox-zip.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox.ABOUT/MAIN
-share/e16/epplet_data/E-Mountbox/E-Mountbox.ABOUT/aircut3.ttf
-share/e16/epplet_data/E-Mountbox/E-Mountbox.ABOUT/bg.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox.ABOUT/dialog.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox.ABOUT/shot.png
-share/e16/epplet_data/E-Mountbox/E-Mountbox.ABOUT/shot_unmounted.png
share/e16/epplet_data/E-NetFlame/E-NetFlame.ABOUT/MAIN
share/e16/epplet_data/E-NetFlame/E-NetFlame.ABOUT/aircut3.ttf
share/e16/epplet_data/E-NetFlame/E-NetFlame.ABOUT/bg.png
@@ -146,8 +133,20 @@ share/e16/epplet_data/E-PlayCD/E-PlayCD.ABOUT/EPlayCD.jpg
share/e16/epplet_data/E-PlayCD/E-PlayCD.ABOUT/MAIN
share/e16/epplet_data/E-PlayCD/E-PlayCD.ABOUT/aircut3.ttf
share/e16/epplet_data/E-PlayCD/E-PlayCD.ABOUT/bg.png
+share/e16/epplet_data/E-Power/E-Power.ABOUT/MAIN
share/e16/epplet_data/E-Power/E-Power.ABOUT/aircut3.ttf
share/e16/epplet_data/E-Power/E-Power.ABOUT/bg.png
+share/e16/epplet_data/E-Power/E-Power-Bat-0.png
+share/e16/epplet_data/E-Power/E-Power-Bat-10.png
+share/e16/epplet_data/E-Power/E-Power-Bat-20.png
+share/e16/epplet_data/E-Power/E-Power-Bat-30.png
+share/e16/epplet_data/E-Power/E-Power-Bat-40.png
+share/e16/epplet_data/E-Power/E-Power-Bat-50.png
+share/e16/epplet_data/E-Power/E-Power-Bat-60.png
+share/e16/epplet_data/E-Power/E-Power-Bat-70.png
+share/e16/epplet_data/E-Power/E-Power-Bat-80.png
+share/e16/epplet_data/E-Power/E-Power-Bat-90.png
+share/e16/epplet_data/E-Power/E-Power-Bat-100.png
share/e16/epplet_data/E-SD/E-SD.ABOUT/MAIN
share/e16/epplet_data/E-SD/E-SD.ABOUT/aircut3.ttf
share/e16/epplet_data/E-SD/E-SD.ABOUT/bg.png
@@ -199,18 +198,19 @@ share/e16/epplet_icons/E-Biff.icon
share/e16/epplet_icons/E-Clock.icon
share/e16/epplet_icons/E-Cpu.icon
share/e16/epplet_icons/E-Disk.icon
+share/e16/epplet_icons/E-Exec.icon
share/e16/epplet_icons/E-Load.icon
share/e16/epplet_icons/E-Magic.icon
share/e16/epplet_icons/E-MemWatch.icon
share/e16/epplet_icons/E-Mixer.icon
share/e16/epplet_icons/E-MoonClock.icon
-share/e16/epplet_icons/E-Mountbox.icon
share/e16/epplet_icons/E-Net.icon
share/e16/epplet_icons/E-NetFlame.icon
share/e16/epplet_icons/E-OpenGL-Demo.icon
share/e16/epplet_icons/E-Pants.icon
share/e16/epplet_icons/E-Pinger.icon
share/e16/epplet_icons/E-PlayCD.icon
+share/e16/epplet_icons/E-Power.icon
share/e16/epplet_icons/E-SD.icon
share/e16/epplet_icons/E-ScreenSave.icon
share/e16/epplet_icons/E-ScreenShoot.icon
@@ -219,7 +219,6 @@ share/e16/epplet_icons/E-Sys.icon
share/e16/epplet_icons/E-Time.icon
share/e16/epplet_icons/E-UrlWatch.icon
share/e16/epplet_icons/E-Wireless.icon
-share/e16/epplet_icons/E-Xss.icon
share/e16/epplet_icons/Emix.icon
@dirrmtry rmdir %D/share/e16/epplet_icons
@dirrm share/e16/epplet_data/Emix/Emix.ABOUT
@@ -247,8 +246,6 @@ share/e16/epplet_icons/Emix.icon
@dirrm share/e16/epplet_data/E-OpenGL-Demo
@dirrm share/e16/epplet_data/E-NetFlame/E-NetFlame.ABOUT
@dirrm share/e16/epplet_data/E-NetFlame
-@dirrm share/e16/epplet_data/E-Mountbox/E-Mountbox.ABOUT
-@dirrm share/e16/epplet_data/E-Mountbox
@dirrm share/e16/epplet_data/E-MoonClock/E-MoonClock.ABOUT
@dirrm share/e16/epplet_data/E-MoonClock
@dirrm share/e16/epplet_data/E-Mixer/E-Mixer.ABOUT