1 /* vi: set sw=4 ts=4: */
3 * ip.c "ip" utility frontend.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
10 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
15 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
18 #include "ip_common.h" /* #include "libbb.h" is inside */
21 family_t preferred_family = AF_UNSPEC;
25 char **ip_parse_common_args(char **argv)
27 static const char ip_common_commands[] ALIGN1 =
41 static const family_t af_numbers[] = { AF_INET, AF_INET6, AF_PACKET };
52 if (!opt[0]) { /* "--" */
57 arg = index_in_strings(ip_common_commands, opt);
60 if (arg == ARG_oneline) {
65 if (arg == ARG_family) {
66 static const char families[] ALIGN1 =
67 "inet" "\0" "inet6" "\0" "link" "\0";
71 arg = index_in_strings(families, *argv);
73 invarg(*argv, "protocol family");
74 /* now arg == 0, 1 or 2 */
77 /* now arg == 0, 1 or 2 */
79 preferred_family = af_numbers[arg];
82 _SL_ = oneline ? '\\' : '\n';