mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-03 09:02:09 +08:00
IFCONFIG(8): Workaround for struct option confict
This commit is contained in:
parent
9a3fa151b2
commit
4e14deda1c
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user