1 /* vi: set sw=4 ts=4: */
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; either version
6 * 2 of the License, or (at your option) any later version.
8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
12 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
15 #include "ip_common.h" /* #include "libbb.h" is inside */
18 family_t preferred_family
= AF_UNSPEC
;
22 char** FAST_FUNC
ip_parse_common_args(char **argv
)
24 static const char ip_common_commands
[] ALIGN1
=
38 static const family_t af_numbers
[] = { AF_INET
, AF_INET6
, AF_PACKET
};
49 if (!opt
[0]) { /* "--" */
54 arg
= index_in_substrings(ip_common_commands
, opt
);
57 if (arg
== ARG_oneline
) {
62 if (arg
== ARG_family
) {
63 static const char families
[] ALIGN1
=
64 "inet" "\0" "inet6" "\0" "link" "\0";
68 arg
= index_in_strings(families
, *argv
);
70 invarg(*argv
, "protocol family");
71 /* now arg == 0, 1 or 2 */
74 /* now arg == 0, 1 or 2 */
76 preferred_family
= af_numbers
[arg
];
79 _SL_
= oneline
? '\\' : '\n';