IFCONFIG(8): Workaround for struct option confict

This commit is contained in:
Sebastian Huber 2013-10-18 15:52:13 +02:00
parent 9a3fa151b2
commit 4e14deda1c
5 changed files with 2 additions and 43 deletions

View File

@ -531,11 +531,7 @@ in6_Lopt_cb(const char *optarg __unused)
{ {
ip6lifetime++; /* print IPv6 address lifetime */ 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 }; static struct option in6_Lopt = { .opt = "L", .opt_usage = "[-L]", .cb = in6_Lopt_cb };
#endif
static __constructor void static __constructor void
inet6_ctor(void) inet6_ctor(void)

View File

@ -179,11 +179,7 @@ clone_Copt_cb(const char *optarg __unused)
list_cloners(); list_cloners();
exit(0); 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 }; static struct option clone_Copt = { .opt = "C", .opt_usage = "[-C]", .cb = clone_Copt_cb };
#endif
static __constructor void static __constructor void
clone_ctor(void) clone_ctor(void)

View File

@ -43,7 +43,9 @@ static const char rcsid[] =
#ifdef __rtems__ #ifdef __rtems__
#define __need_getopt_newlib #define __need_getopt_newlib
#define option getopt_option
#include <getopt.h> #include <getopt.h>
#undef option
#endif /* __rtems__ */ #endif /* __rtems__ */
#include <rtems/bsd/sys/param.h> #include <rtems/bsd/sys/param.h>
#include <sys/ioctl.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 struct afswtch *af_getbyfamily(int af);
static void af_other_status(int); 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; static struct option *opts = NULL;
void void
@ -132,17 +124,12 @@ opt_register(struct option *p)
p->next = opts; p->next = opts;
opts = p; opts = p;
} }
#endif
static void static void
usage(void) usage(void)
{ {
char options[1024]; char options[1024];
#ifdef __rtems__
struct ifconfig_option *p;
#else
struct option *p; struct option *p;
#endif
/* XXX not right but close enough for now */ /* XXX not right but close enough for now */
options[0] = '\0'; options[0] = '\0';
@ -190,11 +177,7 @@ main(int argc, char *argv[])
const struct sockaddr_dl *sdl; const struct sockaddr_dl *sdl;
char options[1024], *cp; char options[1024], *cp;
const char *ifname; const char *ifname;
#ifdef __rtems__
struct ifconfig_option *p;
#else
struct option *p; struct option *p;
#endif
size_t iflen; size_t iflen;
#ifdef __rtems__ #ifdef __rtems__
struct getopt_data getopt_data; struct getopt_data getopt_data;

View File

@ -117,25 +117,13 @@ struct afswtch {
}; };
void af_register(struct afswtch *); void af_register(struct afswtch *);
#ifdef __rtems__
struct ifconfig_option {
#else
struct option { struct option {
#endif
const char *opt; const char *opt;
const char *opt_usage; const char *opt_usage;
void (*cb)(const char *arg); void (*cb)(const char *arg);
#ifdef __rtems__
struct ifconfig_option *next;
#else
struct option *next; struct option *next;
#endif
}; };
#ifdef __rtems__
void opt_register(struct ifconfig_option *);
#else
void opt_register(struct option *); void opt_register(struct option *);
#endif
extern struct ifreq ifr; extern struct ifreq ifr;
extern char name[IFNAMSIZ]; /* name of interface */ extern char name[IFNAMSIZ]; /* name of interface */

View File

@ -170,11 +170,7 @@ static struct afswtch af_group = {
.af_af = AF_UNSPEC, .af_af = AF_UNSPEC,
.af_other_status = getifgroups, .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 }; static struct option group_gopt = { "g:", "[-g groupname]", printgroup };
#endif
static __constructor void static __constructor void
group_ctor(void) group_ctor(void)