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 int preferred_family = AF_UNSPEC;
25 void ip_parse_common_args(int *argcp, char ***argvp)
33 if (strcmp(opt,"--") == 0) {
45 if (matches(opt, "-family") == 0) {
50 if (strcmp(argv[1], "inet") == 0)
51 preferred_family = AF_INET;
52 else if (strcmp(argv[1], "inet6") == 0)
53 preferred_family = AF_INET6;
54 else if (strcmp(argv[1], "link") == 0)
55 preferred_family = AF_PACKET;
57 invarg(argv[1], "protocol family");
58 } else if (strcmp(opt, "-4") == 0) {
59 preferred_family = AF_INET;
60 } else if (strcmp(opt, "-6") == 0) {
61 preferred_family = AF_INET6;
62 } else if (strcmp(opt, "-0") == 0) {
63 preferred_family = AF_PACKET;
64 } else if (matches(opt, "-oneline") == 0) {
72 _SL_ = oneline ? '\\' : '\n' ;