[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-208-g01217
From: |
Mats Erik Andersson |
Subject: |
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-208-g01217fa |
Date: |
Sat, 17 Nov 2012 16:12:10 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".
The branch, master has been updated
via 01217fa19cb46a9013b89e93432f9dfbe48ddbad (commit)
from 4ebf95e90700da5cc244e7c8a18d66468c858cc6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=01217fa19cb46a9013b89e93432f9dfbe48ddbad
commit 01217fa19cb46a9013b89e93432f9dfbe48ddbad
Author: Mats Erik Andersson <address@hidden>
Date: Sat Nov 17 16:52:05 2012 +0100
ifconfig: Stub for BSD systems.
Quickly adapt the generic template to BSD systems.
diff --git a/ChangeLog b/ChangeLog
index 5f8b23c..9eb52af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-11-17 Mats Erik Andersson <address@hidden>
+
+ ifconfig: Implement stub for BSD systems.
+
+ * ifconfig/options.c (formats) <unix format>:
+ Add metric to printout.
+ * ifconfig/system.c [__DragonFly__ || __FreeBSD__ ||
+ __NetBSD__ || __OpenBSD__]: Include "system/bsd.c".
+ * ifconfig/system.h [__DragonFly__ || __FreeBSD__ ||
+ __NetBSD__ || __OpenBSD__]: Include "system/bsd.h".
+ * ifconfig/system/bsd.c, ifconfig/system/bsd.h:
+ New source files.
+
2012-11-16 Mats Erik Andersson <address@hidden>
syslogd: Adapt to legacy utmp.
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 7720c8d..f4a07cb 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -140,6 +140,7 @@ struct format formats[] = {
"${format}{check-existence}"
"${ifdisplay?}{"
"${name}: flags=${flags}{number}{%hx}<${flags}{string}{,}>"
+ "${metric?}{ metric ${metric}}"
"${mtu?}{ mtu ${mtu}}${\\n}"
"${addr?}{${\\t}inet ${addr}"
" netmask ${netmask}{0}{%#02x}${netmask}{1}{%02x}"
diff --git a/ifconfig/system.c b/ifconfig/system.c
index 525f16e..d8d1bf4 100644
--- a/ifconfig/system.c
+++ b/ifconfig/system.c
@@ -21,10 +21,13 @@
#if defined __linux__
# include "system/linux.c"
-#elif defined(__sun__)
+#elif defined __sun__
# include "system/solaris.c"
-#elif defined(__QNX__)
+#elif defined __QNX__
# include "system/qnx.c"
+# elif defined __DragonFly__ || defined __FreeBSD__ || \
+ defined __NetBSD__ || defined __OpenBSD__
+# include "system/bsd.c"
#else
# include "system/generic.c"
#endif
diff --git a/ifconfig/system.h b/ifconfig/system.h
index f5ac40f..0108aff 100644
--- a/ifconfig/system.h
+++ b/ifconfig/system.h
@@ -91,10 +91,13 @@ extern struct if_nameindex* (*system_if_nameindex) (void);
# if defined __linux__
# include "system/linux.h"
-# elif defined(__sun__)
+# elif defined __sun__
# include "system/solaris.h"
-# elif defined(__QNX__)
+# elif defined __QNX__
# include "system/qnx.h"
+# elif defined __DragonFly__ || defined __FreeBSD__ || \
+ defined __NetBSD__ || defined __OpenBSD__
+# include "system/bsd.h"
# else
# include "system/generic.h"
# endif
diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
new file mode 100644
index 0000000..7a50731
--- /dev/null
+++ b/ifconfig/system/bsd.c
@@ -0,0 +1,75 @@
+/* generic.c -- generic system code for ifconfig
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010, 2011, 2012 Free Software Foundation, Inc.
+
+ This file is part of GNU Inetutils.
+
+ GNU Inetutils is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or (at
+ your option) any later version.
+
+ GNU Inetutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see `http://www.gnu.org/licenses/'. */
+
+#include <config.h>
+
+#include <unistd.h>
+#include "../ifconfig.h"
+
+
+/* Output format stuff. */
+
+const char *system_default_format = "unix";
+
+
+/* Argument parsing stuff. */
+
+const char *system_help = "\
+NAME [ADDR [DSTADDR]] [broadcast BRDADDR] [netmask MASK] [metric N] [mtu N]";
+
+struct argp_child system_argp_child;
+
+int
+system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
+{
+ return 0;
+}
+
+int
+system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
+{
+ return 0;
+}
+
+int
+system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
+{
+ return 0;
+}
+
+
+/* System hooks. */
+
+struct if_nameindex* (*system_if_nameindex) (void) = if_nameindex;
+
+void
+system_fh_metric (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFMETRIC
+ if (ioctl (form->sfd, SIOCGIFMETRIC, form->ifr) < 0)
+ error (EXIT_FAILURE, errno,
+ "SIOCGIFMETRIC failed for interface `%s'",
+ form->ifr->ifr_name);
+ else
+ put_int (form, argc, argv, form->ifr->ifr_metric);
+#else
+ *column += printf ("(not available)");
+ had_output = 1;
+#endif
+}
diff --git a/ifconfig/system/generic.h b/ifconfig/system/bsd.h
similarity index 75%
copy from ifconfig/system/generic.h
copy to ifconfig/system/bsd.h
index ac546e5..e6aeec2 100644
--- a/ifconfig/system/generic.h
+++ b/ifconfig/system/bsd.h
@@ -17,10 +17,11 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see `http://www.gnu.org/licenses/'. */
-/* Written by Marcus Brinkmann. */
-
-#ifndef IFCONFIG_SYSTEM_GENERIC_H
-# define IFCONFIG_SYSTEM_GENERIC_H
+#ifndef IFCONFIG_SYSTEM_BSD_H
+# define IFCONFIG_SYSTEM_BSD_H
+# include "../printif.h"
+# include "../options.h"
+# include <sys/sockio.h>
/* Option support. */
@@ -40,14 +41,21 @@ struct system_ifconfig
format_handler entries. They are inserted at the beginning of the
default list, so they override generic implementations if they have
the same name. For example:
- #define SYSTEN_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
+ #define SYSTEM_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
{ "newline", system_fh_newline },
Define some architecture symbol like "foobar", so it can be tested
for in generic format strings with ${exists?}{foobar?}. */
-# undef SYSTEM_FORMAT_HANDLER
+# define SYSTEM_FORMAT_HANDLER \
+ {"bsd", fh_nothing}, \
+ {"dragonflybsd", fh_nothing}, \
+ {"freebsd", fh_nothing}, \
+ {"netbsd", fh_nothing}, \
+ {"openbsd", fh_nothing}, \
+ {"metric", system_fh_metric},
/* Prototype system_fh_* functions here.
void system_fh_newline (format_data_t, int, char **);
*/
+void system_fh_metric (format_data_t form, int argc, char *argv[]);
#endif
diff --git a/ifconfig/system/generic.h b/ifconfig/system/generic.h
index ac546e5..986226f 100644
--- a/ifconfig/system/generic.h
+++ b/ifconfig/system/generic.h
@@ -40,7 +40,7 @@ struct system_ifconfig
format_handler entries. They are inserted at the beginning of the
default list, so they override generic implementations if they have
the same name. For example:
- #define SYSTEN_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
+ #define SYSTEM_FORMAT_HANDLER { "foobar", system_fh_nothing }, \
{ "newline", system_fh_newline },
Define some architecture symbol like "foobar", so it can be tested
for in generic format strings with ${exists?}{foobar?}. */
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 13 +++++++++++++
ifconfig/options.c | 1 +
ifconfig/system.c | 7 +++++--
ifconfig/system.h | 7 +++++--
ifconfig/system/{qnx.c => bsd.c} | 34 +++++++++++++++++++---------------
ifconfig/system/{generic.h => bsd.h} | 20 ++++++++++++++------
ifconfig/system/generic.h | 2 +-
7 files changed, 58 insertions(+), 26 deletions(-)
copy ifconfig/system/{qnx.c => bsd.c} (72%)
copy ifconfig/system/{generic.h => bsd.h} (75%)
hooks/post-receive
--
GNU Inetutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-208-g01217fa,
Mats Erik Andersson <=