ISO C does not allow unnamed union members.
This commit is contained in:
parent
77a9f6dd96
commit
c508bf7a54
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144818
@ -502,25 +502,25 @@ ifconfig(int argc, char *const *argv, const struct afswtch *afp)
|
|||||||
*/
|
*/
|
||||||
p = (setaddr ? &setifdstaddr_cmd : &setifaddr_cmd);
|
p = (setaddr ? &setifdstaddr_cmd : &setifaddr_cmd);
|
||||||
}
|
}
|
||||||
if (p->c_func || p->c_func2) {
|
if (p->c_u.c_func || p->c_u.c_func2) {
|
||||||
if (p->c_parameter == NEXTARG) {
|
if (p->c_parameter == NEXTARG) {
|
||||||
if (argv[1] == NULL)
|
if (argv[1] == NULL)
|
||||||
errx(1, "'%s' requires argument",
|
errx(1, "'%s' requires argument",
|
||||||
p->c_name);
|
p->c_name);
|
||||||
p->c_func(argv[1], 0, s, afp);
|
p->c_u.c_func(argv[1], 0, s, afp);
|
||||||
argc--, argv++;
|
argc--, argv++;
|
||||||
} else if (p->c_parameter == OPTARG) {
|
} else if (p->c_parameter == OPTARG) {
|
||||||
p->c_func(argv[1], 0, s, afp);
|
p->c_u.c_func(argv[1], 0, s, afp);
|
||||||
if (argv[1] != NULL)
|
if (argv[1] != NULL)
|
||||||
argc--, argv++;
|
argc--, argv++;
|
||||||
} else if (p->c_parameter == NEXTARG2) {
|
} else if (p->c_parameter == NEXTARG2) {
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
errx(1, "'%s' requires 2 arguments",
|
errx(1, "'%s' requires 2 arguments",
|
||||||
p->c_name);
|
p->c_name);
|
||||||
p->c_func2(argv[1], argv[2], s, afp);
|
p->c_u.c_func2(argv[1], argv[2], s, afp);
|
||||||
argc -= 2, argv += 2;
|
argc -= 2, argv += 2;
|
||||||
} else
|
} else
|
||||||
p->c_func(*argv, p->c_parameter, s, afp);
|
p->c_u.c_func(*argv, p->c_parameter, s, afp);
|
||||||
}
|
}
|
||||||
argc--, argv++;
|
argc--, argv++;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ struct cmd {
|
|||||||
union {
|
union {
|
||||||
c_func *c_func;
|
c_func *c_func;
|
||||||
c_func2 *c_func2;
|
c_func2 *c_func2;
|
||||||
};
|
} c_u;
|
||||||
struct cmd *c_next;
|
struct cmd *c_next;
|
||||||
};
|
};
|
||||||
void cmd_register(struct cmd *);
|
void cmd_register(struct cmd *);
|
||||||
|
Loading…
Reference in New Issue
Block a user