ip: fix all the checkpatch warnings
Zhang Shengju some places where tabs were not being used. Go ahead and fix all the trival checkpatch warnings in ip/ip.c Also fix bridge.c
This commit is contained in:
parent
99bb68ff66
commit
ec7aff5c4f
|
|
@ -18,12 +18,12 @@
|
||||||
struct rtnl_handle rth = { .fd = -1 };
|
struct rtnl_handle rth = { .fd = -1 };
|
||||||
int preferred_family = AF_UNSPEC;
|
int preferred_family = AF_UNSPEC;
|
||||||
int resolve_hosts;
|
int resolve_hosts;
|
||||||
int oneline = 0;
|
int oneline;
|
||||||
int show_stats;
|
int show_stats;
|
||||||
int show_details;
|
int show_details;
|
||||||
int compress_vlans;
|
int compress_vlans;
|
||||||
int timestamp;
|
int timestamp;
|
||||||
char * _SL_ = NULL;
|
const char *_SL_;
|
||||||
|
|
||||||
static void usage(void) __attribute__((noreturn));
|
static void usage(void) __attribute__((noreturn));
|
||||||
|
|
||||||
|
|
@ -31,10 +31,10 @@ static void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
"Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||||
"where OBJECT := { link | fdb | mdb | vlan | monitor }\n"
|
"where OBJECT := { link | fdb | mdb | vlan | monitor }\n"
|
||||||
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n"
|
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n"
|
||||||
" -o[neline] | -t[imestamp] | -n[etns] name |\n"
|
" -o[neline] | -t[imestamp] | -n[etns] name |\n"
|
||||||
" -c[ompressvlans] }\n");
|
" -c[ompressvlans] }\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,9 +48,9 @@ static const struct cmd {
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
int (*func)(int argc, char **argv);
|
int (*func)(int argc, char **argv);
|
||||||
} cmds[] = {
|
} cmds[] = {
|
||||||
{ "link", do_link },
|
{ "link", do_link },
|
||||||
{ "fdb", do_fdb },
|
{ "fdb", do_fdb },
|
||||||
{ "mdb", do_mdb },
|
{ "mdb", do_mdb },
|
||||||
{ "vlan", do_vlan },
|
{ "vlan", do_vlan },
|
||||||
{ "monitor", do_monitor },
|
{ "monitor", do_monitor },
|
||||||
{ "help", do_help },
|
{ "help", do_help },
|
||||||
|
|
@ -66,7 +66,8 @@ static int do_cmd(const char *argv0, int argc, char **argv)
|
||||||
return c->func(argc-1, argv+1);
|
return c->func(argc-1, argv+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Object \"%s\" is unknown, try \"bridge help\".\n", argv0);
|
fprintf(stderr,
|
||||||
|
"Object \"%s\" is unknown, try \"bridge help\".\n", argv0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,8 +75,9 @@ int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
while (argc > 1) {
|
while (argc > 1) {
|
||||||
char *opt = argv[1];
|
const char *opt = argv[1];
|
||||||
if (strcmp(opt,"--") == 0) {
|
|
||||||
|
if (strcmp(opt, "--") == 0) {
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +100,7 @@ main(int argc, char **argv)
|
||||||
++oneline;
|
++oneline;
|
||||||
} else if (matches(opt, "-timestamp") == 0) {
|
} else if (matches(opt, "-timestamp") == 0) {
|
||||||
++timestamp;
|
++timestamp;
|
||||||
} else if (matches(opt, "-family") == 0) {
|
} else if (matches(opt, "-family") == 0) {
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
|
|
@ -122,13 +124,15 @@ main(int argc, char **argv)
|
||||||
} else if (matches(opt, "-compressvlans") == 0) {
|
} else if (matches(opt, "-compressvlans") == 0) {
|
||||||
++compress_vlans;
|
++compress_vlans;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Option \"%s\" is unknown, try \"bridge help\".\n", opt);
|
fprintf(stderr,
|
||||||
|
"Option \"%s\" is unknown, try \"bridge help\".\n",
|
||||||
|
opt);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SL_ = oneline ? "\\" : "\n" ;
|
_SL_ = oneline ? "\\" : "\n";
|
||||||
|
|
||||||
if (rtnl_open(&rth, 0) < 0)
|
if (rtnl_open(&rth, 0) < 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ extern int resolve_hosts;
|
||||||
extern int oneline;
|
extern int oneline;
|
||||||
extern int timestamp;
|
extern int timestamp;
|
||||||
extern int timestamp_short;
|
extern int timestamp_short;
|
||||||
extern char * _SL_;
|
extern const char * _SL_;
|
||||||
extern int max_flush_loops;
|
extern int max_flush_loops;
|
||||||
extern int batch_mode;
|
extern int batch_mode;
|
||||||
extern bool do_all;
|
extern bool do_all;
|
||||||
|
|
|
||||||
48
ip/ip.c
48
ip/ip.c
|
|
@ -26,18 +26,18 @@
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
|
||||||
int preferred_family = AF_UNSPEC;
|
int preferred_family = AF_UNSPEC;
|
||||||
int human_readable = 0;
|
int human_readable;
|
||||||
int use_iec = 0;
|
int use_iec;
|
||||||
int show_stats = 0;
|
int show_stats;
|
||||||
int show_details = 0;
|
int show_details;
|
||||||
int resolve_hosts = 0;
|
int resolve_hosts;
|
||||||
int oneline = 0;
|
int oneline;
|
||||||
int timestamp = 0;
|
int timestamp;
|
||||||
char * _SL_ = NULL;
|
const char *_SL_;
|
||||||
int force = 0;
|
int force;
|
||||||
int max_flush_loops = 10;
|
int max_flush_loops = 10;
|
||||||
int batch_mode = 0;
|
int batch_mode;
|
||||||
bool do_all = false;
|
bool do_all;
|
||||||
|
|
||||||
struct rtnl_handle rth = { .fd = -1 };
|
struct rtnl_handle rth = { .fd = -1 };
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ static void usage(void)
|
||||||
static int do_help(int argc, char **argv)
|
static int do_help(int argc, char **argv)
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct cmd {
|
static const struct cmd {
|
||||||
|
|
@ -89,7 +89,7 @@ static const struct cmd {
|
||||||
{ "tap", do_iptuntap },
|
{ "tap", do_iptuntap },
|
||||||
{ "token", do_iptoken },
|
{ "token", do_iptoken },
|
||||||
{ "tcpmetrics", do_tcp_metrics },
|
{ "tcpmetrics", do_tcp_metrics },
|
||||||
{ "tcp_metrics",do_tcp_metrics },
|
{ "tcp_metrics", do_tcp_metrics },
|
||||||
{ "monitor", do_ipmonitor },
|
{ "monitor", do_ipmonitor },
|
||||||
{ "xfrm", do_xfrm },
|
{ "xfrm", do_xfrm },
|
||||||
{ "mroute", do_multiroute },
|
{ "mroute", do_multiroute },
|
||||||
|
|
@ -105,9 +105,8 @@ static int do_cmd(const char *argv0, int argc, char **argv)
|
||||||
const struct cmd *c;
|
const struct cmd *c;
|
||||||
|
|
||||||
for (c = cmds; c->cmd; ++c) {
|
for (c = cmds; c->cmd; ++c) {
|
||||||
if (matches(argv0, c->cmd) == 0) {
|
if (matches(argv0, c->cmd) == 0)
|
||||||
return -(c->func(argc-1, argv+1));
|
return -(c->func(argc-1, argv+1));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Object \"%s\" is unknown, try \"ip help\".\n", argv0);
|
fprintf(stderr, "Object \"%s\" is unknown, try \"ip help\".\n", argv0);
|
||||||
|
|
@ -124,7 +123,8 @@ static int batch(const char *name)
|
||||||
|
|
||||||
if (name && strcmp(name, "-") != 0) {
|
if (name && strcmp(name, "-") != 0) {
|
||||||
if (freopen(name, "r", stdin) == NULL) {
|
if (freopen(name, "r", stdin) == NULL) {
|
||||||
fprintf(stderr, "Cannot open file \"%s\" for reading: %s\n",
|
fprintf(stderr,
|
||||||
|
"Cannot open file \"%s\" for reading: %s\n",
|
||||||
name, strerror(errno));
|
name, strerror(errno));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +145,8 @@ static int batch(const char *name)
|
||||||
continue; /* blank line */
|
continue; /* blank line */
|
||||||
|
|
||||||
if (do_cmd(largv[0], largc, largv)) {
|
if (do_cmd(largv[0], largc, largv)) {
|
||||||
fprintf(stderr, "Command failed %s:%d\n", name, cmdlineno);
|
fprintf(stderr, "Command failed %s:%d\n",
|
||||||
|
name, cmdlineno);
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
if (!force)
|
if (!force)
|
||||||
break;
|
break;
|
||||||
|
|
@ -172,7 +173,8 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
while (argc > 1) {
|
while (argc > 1) {
|
||||||
char *opt = argv[1];
|
char *opt = argv[1];
|
||||||
if (strcmp(opt,"--") == 0) {
|
|
||||||
|
if (strcmp(opt, "--") == 0) {
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -185,8 +187,8 @@ int main(int argc, char **argv)
|
||||||
argv++;
|
argv++;
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
usage();
|
usage();
|
||||||
max_flush_loops = atoi(argv[1]);
|
max_flush_loops = atoi(argv[1]);
|
||||||
} else if (matches(opt, "-family") == 0) {
|
} else if (matches(opt, "-family") == 0) {
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
|
|
@ -269,13 +271,15 @@ int main(int argc, char **argv)
|
||||||
} else if (matches(opt, "-all") == 0) {
|
} else if (matches(opt, "-all") == 0) {
|
||||||
do_all = true;
|
do_all = true;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Option \"%s\" is unknown, try \"ip -help\".\n", opt);
|
fprintf(stderr,
|
||||||
|
"Option \"%s\" is unknown, try \"ip -help\".\n",
|
||||||
|
opt);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SL_ = oneline ? "\\" : "\n" ;
|
_SL_ = oneline ? "\\" : "\n";
|
||||||
|
|
||||||
if (batch_file)
|
if (batch_file)
|
||||||
return batch(batch_file);
|
return batch(batch_file);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue