Commit ec7aff5c authored by Stephen Hemminger's avatar Stephen Hemminger

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
parent 99bb68ff
...@@ -18,12 +18,12 @@ ...@@ -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));
...@@ -66,7 +66,8 @@ static int do_cmd(const char *argv0, int argc, char **argv) ...@@ -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 ...@@ -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;
} }
...@@ -122,13 +124,15 @@ main(int argc, char **argv) ...@@ -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; ...@@ -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;
......
...@@ -26,18 +26,18 @@ ...@@ -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 };
...@@ -89,7 +89,7 @@ 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,10 +105,9 @@ static int do_cmd(const char *argv0, int argc, char **argv) ...@@ -105,10 +105,9 @@ 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);
return EXIT_FAILURE; return EXIT_FAILURE;
...@@ -124,7 +123,8 @@ static int batch(const char *name) ...@@ -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) ...@@ -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) ...@@ -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;
} }
...@@ -269,13 +271,15 @@ int main(int argc, char **argv) ...@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment