summaryrefslogtreecommitdiffstats
path: root/freebsd/sbin/ifconfig
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-18 15:52:13 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-31 13:18:49 +0100
commit4e14deda1cded14091ed2b37e1144c7f31a9b2de (patch)
tree722df13c503c5a098cdb36d3aef157c85f22a7fc /freebsd/sbin/ifconfig
parentUse unmodified FreeBSD versions for port_*.h (diff)
downloadrtems-libbsd-4e14deda1cded14091ed2b37e1144c7f31a9b2de.tar.bz2
IFCONFIG(8): Workaround for struct option confict
Diffstat (limited to 'freebsd/sbin/ifconfig')
-rw-r--r--freebsd/sbin/ifconfig/af_inet6.c4
-rw-r--r--freebsd/sbin/ifconfig/ifclone.c4
-rw-r--r--freebsd/sbin/ifconfig/ifconfig.c21
-rw-r--r--freebsd/sbin/ifconfig/ifconfig.h12
-rw-r--r--freebsd/sbin/ifconfig/ifgroup.c4
5 files changed, 2 insertions, 43 deletions
diff --git a/freebsd/sbin/ifconfig/af_inet6.c b/freebsd/sbin/ifconfig/af_inet6.c
index 9eadbec1..a08478e8 100644
--- a/freebsd/sbin/ifconfig/af_inet6.c
+++ b/freebsd/sbin/ifconfig/af_inet6.c
@@ -531,11 +531,7 @@ in6_Lopt_cb(const char *optarg __unused)
{
ip6lifetime++; /* print IPv6 address lifetime */
}
-#ifdef __rtems__
-static struct ifconfig_option in6_Lopt = { .opt = "L", .opt_usage = "[-L]", .cb = in6_Lopt_cb };
-#else
static struct option in6_Lopt = { .opt = "L", .opt_usage = "[-L]", .cb = in6_Lopt_cb };
-#endif
static __constructor void
inet6_ctor(void)
diff --git a/freebsd/sbin/ifconfig/ifclone.c b/freebsd/sbin/ifconfig/ifclone.c
index 2d49780d..3cfeee25 100644
--- a/freebsd/sbin/ifconfig/ifclone.c
+++ b/freebsd/sbin/ifconfig/ifclone.c
@@ -179,11 +179,7 @@ clone_Copt_cb(const char *optarg __unused)
list_cloners();
exit(0);
}
-#ifdef __rtems__
-static struct ifconfig_option clone_Copt = { .opt = "C", .opt_usage = "[-C]", .cb = clone_Copt_cb };
-#else
static struct option clone_Copt = { .opt = "C", .opt_usage = "[-C]", .cb = clone_Copt_cb };
-#endif
static __constructor void
clone_ctor(void)
diff --git a/freebsd/sbin/ifconfig/ifconfig.c b/freebsd/sbin/ifconfig/ifconfig.c
index 078eae98..dfbe1981 100644
--- a/freebsd/sbin/ifconfig/ifconfig.c
+++ b/freebsd/sbin/ifconfig/ifconfig.c
@@ -43,7 +43,9 @@ static const char rcsid[] =
#ifdef __rtems__
#define __need_getopt_newlib
+#define option getopt_option
#include <getopt.h>
+#undef option
#endif /* __rtems__ */
#include <rtems/bsd/sys/param.h>
#include <sys/ioctl.h>
@@ -114,16 +116,6 @@ static struct afswtch *af_getbyname(const char *name);
static struct afswtch *af_getbyfamily(int af);
static void af_other_status(int);
-#ifdef __rtems__
-static struct ifconfig_option *opts = NULL;
-
-void
-opt_register(struct ifconfig_option *p)
-{
- p->next = opts;
- opts = p;
-}
-#else
static struct option *opts = NULL;
void
@@ -132,17 +124,12 @@ opt_register(struct option *p)
p->next = opts;
opts = p;
}
-#endif
static void
usage(void)
{
char options[1024];
- #ifdef __rtems__
- struct ifconfig_option *p;
- #else
struct option *p;
- #endif
/* XXX not right but close enough for now */
options[0] = '\0';
@@ -190,11 +177,7 @@ main(int argc, char *argv[])
const struct sockaddr_dl *sdl;
char options[1024], *cp;
const char *ifname;
-#ifdef __rtems__
- struct ifconfig_option *p;
-#else
struct option *p;
-#endif
size_t iflen;
#ifdef __rtems__
struct getopt_data getopt_data;
diff --git a/freebsd/sbin/ifconfig/ifconfig.h b/freebsd/sbin/ifconfig/ifconfig.h
index 150367f7..d6f53499 100644
--- a/freebsd/sbin/ifconfig/ifconfig.h
+++ b/freebsd/sbin/ifconfig/ifconfig.h
@@ -117,25 +117,13 @@ struct afswtch {
};
void af_register(struct afswtch *);
-#ifdef __rtems__
-struct ifconfig_option {
-#else
struct option {
-#endif
const char *opt;
const char *opt_usage;
void (*cb)(const char *arg);
- #ifdef __rtems__
- struct ifconfig_option *next;
- #else
struct option *next;
- #endif
};
-#ifdef __rtems__
-void opt_register(struct ifconfig_option *);
-#else
void opt_register(struct option *);
-#endif
extern struct ifreq ifr;
extern char name[IFNAMSIZ]; /* name of interface */
diff --git a/freebsd/sbin/ifconfig/ifgroup.c b/freebsd/sbin/ifconfig/ifgroup.c
index 0c328e94..619c8f74 100644
--- a/freebsd/sbin/ifconfig/ifgroup.c
+++ b/freebsd/sbin/ifconfig/ifgroup.c
@@ -170,11 +170,7 @@ static struct afswtch af_group = {
.af_af = AF_UNSPEC,
.af_other_status = getifgroups,
};
-#ifdef __rtems__
-static struct ifconfig_option group_gopt = { "g:", "[-g groupname]", printgroup };
-#else
static struct option group_gopt = { "g:", "[-g groupname]", printgroup };
-#endif
static __constructor void
group_ctor(void)