aboutsummaryrefslogtreecommitdiff
path: root/net/gnomenetstatus
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2004-01-03 08:26:16 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2004-01-03 08:26:16 +0000
commit21079947e1a8facdc0508d5408f6137b0fa370d9 (patch)
treea1b1d73742b11e3c828db997f0086374fc74ef74 /net/gnomenetstatus
parent7ef90db4b1cae3a3d5f4dd3b16bf64069c9bdee6 (diff)
downloadports-21079947e1a8facdc0508d5408f6137b0fa370d9.tar.gz
ports-21079947e1a8facdc0508d5408f6137b0fa370d9.zip
Notes
Diffstat (limited to 'net/gnomenetstatus')
-rw-r--r--net/gnomenetstatus/Makefile28
-rw-r--r--net/gnomenetstatus/distinfo1
-rw-r--r--net/gnomenetstatus/files/patch-configure10
-rw-r--r--net/gnomenetstatus/files/patch-src_netstatus-iface.c114
-rw-r--r--net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c160
-rw-r--r--net/gnomenetstatus/pkg-descr2
-rw-r--r--net/gnomenetstatus/pkg-plist40
7 files changed, 355 insertions, 0 deletions
diff --git a/net/gnomenetstatus/Makefile b/net/gnomenetstatus/Makefile
new file mode 100644
index 000000000000..4c5494cb60ab
--- /dev/null
+++ b/net/gnomenetstatus/Makefile
@@ -0,0 +1,28 @@
+# New ports collection makefile for: gnomenetstatus
+# Date Created: 05 December 2003
+# Whom: Joe Marcus Clarke <marcus@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= gnomenetstatus
+PORTVERSION= 0.12
+PORTREVISION= 1
+CATEGORIES= net gnome
+MASTER_SITES= ${MASTER_SITE_GNOME}
+MASTER_SITE_SUBDIR= sources/gnome-netstatus/0.12
+DISTNAME= gnome-netstatus-${PORTVERSION}
+DIST_SUBDIR= gnome2
+
+MAINTAINER= gnome@FreeBSD.org
+COMMENT= A GNOME applet that shows network status
+
+USE_X_PREFIX= yes
+USE_BZIP2= yes
+USE_GNOME= gnomehack gnomeprefix libgnome
+USE_GMAKE= yes
+USE_LIBTOOL= yes
+CONFIGURE_ARGS= CPPFLAGS="-I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib"
+
+.include <bsd.port.mk>
diff --git a/net/gnomenetstatus/distinfo b/net/gnomenetstatus/distinfo
new file mode 100644
index 000000000000..f355b4b3f301
--- /dev/null
+++ b/net/gnomenetstatus/distinfo
@@ -0,0 +1 @@
+MD5 (gnome2/gnome-netstatus-0.12.tar.bz2) = 9977c8fddaaa335c86772da56a591112
diff --git a/net/gnomenetstatus/files/patch-configure b/net/gnomenetstatus/files/patch-configure
new file mode 100644
index 000000000000..f195f07b43c6
--- /dev/null
+++ b/net/gnomenetstatus/files/patch-configure
@@ -0,0 +1,10 @@
+--- configure.orig Wed Dec 11 18:31:51 2002
++++ configure Thu Dec 12 12:07:17 2002
+@@ -7414,6 +7414,7 @@
+
+ # This can be used to rebuild libtool when needed
+ LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
++$ac_aux_dir/ltconfig $LIBTOOL_DEPS
+
+ # Always use our own libtool.
+ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
diff --git a/net/gnomenetstatus/files/patch-src_netstatus-iface.c b/net/gnomenetstatus/files/patch-src_netstatus-iface.c
new file mode 100644
index 000000000000..f332699155bc
--- /dev/null
+++ b/net/gnomenetstatus/files/patch-src_netstatus-iface.c
@@ -0,0 +1,114 @@
+--- src/netstatus-iface.c.orig Fri Oct 31 08:49:51 2003
++++ src/netstatus-iface.c Fri Jan 2 23:29:27 2004
+@@ -32,9 +32,12 @@
+
+ #include <libgnome/gnome-i18n.h>
+
++#include <sys/types.h>
++#include <sys/socket.h>
+ #include <sys/ioctl.h>
+ #include <net/if.h>
+ #include <net/if_arp.h>
++#include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <errno.h>
+ #include <unistd.h>
+@@ -577,6 +580,7 @@
+ iface);
+
+ netstatus_iface_monitor_timeout (iface);
++
+ }
+ }
+
+@@ -646,7 +650,11 @@
+ strncpy (if_req.ifr_name, iface->priv->name, IF_NAMESIZE - 1);
+ if_req.ifr_name [IF_NAMESIZE - 1] = '\0';
+ if (mask && ioctl (fd, SIOCGIFNETMASK, &if_req) == 0)
++#if !defined(__FreeBSD__)
+ *mask = g_strdup (inet_ntoa (((struct sockaddr_in *) &if_req.ifr_netmask)->sin_addr));
++#else
++ *mask = g_strdup (inet_ntoa (((struct sockaddr_in *) &if_req.ifr_addr)->sin_addr));
++#endif
+
+ close (fd);
+
+@@ -925,6 +933,7 @@
+ char **hw_addr)
+
+ {
++#ifdef SIOCGIFHWADDR
+ static struct HwType *hw_type = NULL;
+ struct ifreq if_req;
+ int fd;
+@@ -973,6 +982,9 @@
+ *hw_addr = hw_type->print_hw_addr (if_req.ifr_hwaddr.sa_data);
+
+ return hw_type;
++#else
++ return NULL;
++#endif
+ }
+
+ gboolean
+@@ -1083,8 +1095,11 @@
+ struct ifconf *if_conf;
+ GList *interfaces;
+ GList *loopbacks;
++ gchar *ptr;
+ int fd;
+- int i;
++ struct ifreq *if_req;
++ int len;
++ gboolean loopback;
+
+ if ((fd = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
+ {
+@@ -1105,12 +1120,25 @@
+ interfaces = NULL;
+ loopbacks = NULL;
+
+- for (i = 0; i < if_conf->ifc_len / sizeof (struct ifreq); i++)
++ for (ptr = if_conf->ifc_buf; ptr < if_conf->ifc_buf + if_conf->ifc_len;)
+ {
+- struct ifreq if_req = if_conf->ifc_req [i];
+- gboolean loopback = FALSE;
++ if_req = (struct ifreq *) ptr;
++ loopback = FALSE;
++ len = sizeof(struct sockaddr);
++#if defined(HAVE_SOCKADDR_SA_LEN) || defined(__FreeBSD__)
++ if (if_req->ifr_addr.sa_len > len)
++ len = if_req->ifr_addr.sa_len;
++#endif
++
++ ptr += sizeof(if_req->ifr_name) + len;
++
++ if (g_list_find_custom (interfaces, if_req->ifr_name,
++ (GCompareFunc) g_ascii_strcasecmp) != NULL
++ || g_list_find_custom (loopbacks, if_req->ifr_name,
++ (GCompareFunc) g_ascii_strcasecmp) != NULL)
++ continue;
+
+- if (ioctl (fd, SIOCGIFFLAGS, &if_req) < 0)
++ if (ioctl (fd, SIOCGIFFLAGS, if_req) < 0)
+ {
+ if (error)
+ *error = g_error_new (NETSTATUS_ERROR,
+@@ -1120,13 +1148,14 @@
+ }
+ else
+ {
+- loopback = (if_req.ifr_flags & IFF_LOOPBACK);
++ loopback = (if_req->ifr_flags & IFF_LOOPBACK);
+ }
+
+ if (!loopback)
+- interfaces = g_list_prepend (interfaces, g_strdup (if_req.ifr_name));
++ interfaces = g_list_prepend (interfaces, g_strdup (if_req->ifr_name));
+ else
+- loopbacks = g_list_prepend (loopbacks, g_strdup (if_req.ifr_name));
++ loopbacks = g_list_prepend (loopbacks, g_strdup (if_req->ifr_name));
++
+ }
+
+ interfaces = g_list_concat (interfaces, loopbacks);
diff --git a/net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c b/net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c
new file mode 100644
index 000000000000..3598a24e696d
--- /dev/null
+++ b/net/gnomenetstatus/files/patch-src_netstatus-sysdeps.c
@@ -0,0 +1,160 @@
+--- src/netstatus-sysdeps.c.orig Mon Jun 9 13:18:04 2003
++++ src/netstatus-sysdeps.c Fri Jan 2 23:29:16 2004
+@@ -27,10 +27,13 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <unistd.h>
+ #include <errno.h>
+ #include <glib.h>
+ #include <libgnome/gnome-i18n.h>
+
++#if !defined(__FreeBSD__)
++
+ static inline char *
+ parse_iface_name (const char *buf)
+ {
+@@ -90,6 +93,7 @@
+ }
+ }
+ }
++#endif
+
+ static inline int
+ parse_stats (char *buf,
+@@ -124,6 +128,8 @@
+ return TRUE;
+ }
+
++#if !defined(__FreeBSD__)
++
+ static inline FILE *
+ get_proc_net_dev_fh (void)
+ {
+@@ -206,3 +212,126 @@
+
+ return error_message;
+ }
++
++#else
++
++static inline void
++parse_header (char *buf,
++ int *prx_idx,
++ int *ptx_idx,
++ int *brx_idx,
++ int *btx_idx)
++{
++ char *p;
++ int i;
++
++ *prx_idx = *ptx_idx = -1;
++ *brx_idx = *btx_idx = -1;
++
++ p = strtok (buf, " \n\t");
++ for (i = 0; p; i++, p = strtok (NULL, " \t\n"))
++ {
++ if (!strcmp (p, "Ipkts"))
++ {
++ *prx_idx = i;
++ }
++ else if (!strcmp (p, "Ibytes"))
++ {
++ *brx_idx = i;
++ }
++ else if (!strcmp (p, "Opkts"))
++ {
++ *ptx_idx = i;
++ }
++ else if (!strcmp (p, "Obytes"))
++ {
++ *btx_idx = i;
++ }
++ }
++}
++
++char *
++netstatus_sysdeps_read_iface_statistics (const char *iface,
++ long *in_packets,
++ long *out_packets,
++ long *in_bytes,
++ long *out_bytes)
++{
++ gchar *buf;
++ gchar *cmd = NULL;
++ gchar **command_line;
++ int prx_idx, ptx_idx;
++ int brx_idx, btx_idx;
++ char *error_message = NULL;
++ gchar *dir = g_get_current_dir ();
++ gint pout;
++ GIOChannel *channel;
++ GError *err = NULL;
++
++ *in_packets = -1;
++ *out_packets = -1;
++ *in_bytes = -1;
++ *out_bytes = -1;
++
++ cmd = g_strdup_printf ("/usr/bin/netstat netstat -n -I %s -b -f inet", iface);
++ command_line = g_strsplit (cmd, " ", -1);
++ g_free (cmd);
++
++ if (g_spawn_async_with_pipes (dir, command_line, NULL,
++ G_SPAWN_FILE_AND_ARGV_ZERO, NULL,
++ NULL, NULL, NULL, &pout,
++ NULL, &err)) {
++ g_strfreev (command_line);
++ channel = g_io_channel_unix_new (pout);
++ g_io_channel_read_line (channel, &buf, NULL, NULL, NULL);
++
++ parse_header (buf, &prx_idx, &ptx_idx, &brx_idx, &btx_idx);
++ if (prx_idx == -1 || ptx_idx == -1 ||
++ brx_idx == -1 || btx_idx == -1)
++ {
++ if (buf)
++ g_free (buf);
++ g_io_channel_unref (channel);
++ g_io_channel_shutdown (channel, TRUE, NULL);
++ close (pout);
++ return g_strdup ("Could not parse netstat output. Unknown format");
++ }
++
++ if (buf)
++ g_free (buf);
++ g_io_channel_read_line (channel, &buf, NULL, NULL, NULL);
++
++ if (!parse_stats (buf, prx_idx, ptx_idx, in_packets, out_packets,
++ brx_idx, btx_idx, in_bytes, out_bytes))
++ {
++ if (error_message)
++ g_free (error_message);
++ error_message = g_strdup_printf (_("Could not parse interface statistics from '%s'. "
++ "prx_idx = %d; ptx_idx = %d; brx_idx = %d; btx_idx = %d;"),
++ buf, prx_idx, ptx_idx, brx_idx, btx_idx);
++ }
++
++ if (buf)
++ g_free (buf);
++
++ if ((*in_packets == -1 || *out_packets == -1 || *in_bytes == -1 || *out_bytes == -1) && !error_message)
++ error_message = g_strdup_printf ("Could not obtain information on interface '%s' from netstat", iface);
++
++ g_io_channel_unref (channel);
++ g_io_channel_shutdown (channel, TRUE, NULL);
++ close (pout);
++ }
++ else {
++ g_strfreev (command_line);
++ if (error_message)
++ g_free (error_message);
++ error_message = g_strdup_printf ("Error running /usr/bin/netstat for '%s': %s",
++ iface, err->message);
++ g_error_free (err);
++ }
++
++ g_free (dir);
++
++ return error_message;
++}
++#endif
diff --git a/net/gnomenetstatus/pkg-descr b/net/gnomenetstatus/pkg-descr
new file mode 100644
index 000000000000..85e70885cf36
--- /dev/null
+++ b/net/gnomenetstatus/pkg-descr
@@ -0,0 +1,2 @@
+Gnome-netstatus is an applet which provides information about a network
+interface on your panel.
diff --git a/net/gnomenetstatus/pkg-plist b/net/gnomenetstatus/pkg-plist
new file mode 100644
index 000000000000..e8b096d6eff7
--- /dev/null
+++ b/net/gnomenetstatus/pkg-plist
@@ -0,0 +1,40 @@
+etc/gconf/gconf.xml.defaults/apps/netstatus_applet/%gconf.xml
+etc/gconf/gconf.xml.defaults/schemas/apps/netstatus_applet/%gconf.xml
+etc/gconf/gconf.xml.defaults/schemas/apps/netstatus_applet/prefs/%gconf.xml
+etc/gconf/schemas/netstatus.schemas
+libdata/bonobo/servers/GNOME_NetstatusApplet_Factory.server
+libexec/gnome-netstatus-applet
+share/gnome/gnome-2.0/ui/GNOME_NetstatusApplet.xml
+share/gnome/gnome-netstatus/gnome-netstatus.glade
+share/gnome/icons/gnome-netstatus/gnome-netstatus-disconn.png
+share/gnome/icons/gnome-netstatus/gnome-netstatus-error.png
+share/gnome/icons/gnome-netstatus/gnome-netstatus-idle.png
+share/gnome/icons/gnome-netstatus/gnome-netstatus-rx.png
+share/gnome/icons/gnome-netstatus/gnome-netstatus-tx.png
+share/gnome/icons/gnome-netstatus/gnome-netstatus-txrx.png
+share/gnome/pixmaps/gnome-netstatus-tx.png
+share/locale/az/LC_MESSAGES/gnome-netstatus.mo
+share/locale/cs/LC_MESSAGES/gnome-netstatus.mo
+share/locale/de/LC_MESSAGES/gnome-netstatus.mo
+share/locale/el/LC_MESSAGES/gnome-netstatus.mo
+share/locale/es/LC_MESSAGES/gnome-netstatus.mo
+share/locale/fr/LC_MESSAGES/gnome-netstatus.mo
+share/locale/it/LC_MESSAGES/gnome-netstatus.mo
+share/locale/ja/LC_MESSAGES/gnome-netstatus.mo
+share/locale/ms/LC_MESSAGES/gnome-netstatus.mo
+share/locale/nl/LC_MESSAGES/gnome-netstatus.mo
+share/locale/pl/LC_MESSAGES/gnome-netstatus.mo
+share/locale/pt/LC_MESSAGES/gnome-netstatus.mo
+share/locale/ru/LC_MESSAGES/gnome-netstatus.mo
+share/locale/sr/LC_MESSAGES/gnome-netstatus.mo
+share/locale/sr@Latn/LC_MESSAGES/gnome-netstatus.mo
+share/locale/sv/LC_MESSAGES/gnome-netstatus.mo
+share/locale/tr/LC_MESSAGES/gnome-netstatus.mo
+share/locale/vi/LC_MESSAGES/gnome-netstatus.mo
+share/locale/wa/LC_MESSAGES/gnome-netstatus.mo
+share/locale/zh_CN/LC_MESSAGES/gnome-netstatus.mo
+@dirrm share/gnome/icons/gnome-netstatus
+@dirrm share/gnome/gnome-netstatus
+@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/netstatus_applet/prefs
+@dirrm etc/gconf/gconf.xml.defaults/schemas/apps/netstatus_applet
+@dirrm etc/gconf/gconf.xml.defaults/apps/netstatus_applet