clang-tidy: fix wrong identation
Found with readability-misleading-indentation Signed-off-by: Rosen Penev <rosenp@gmail.com>pull/250/head
parent
17a5fe6022
commit
d5320d554e
48
j1939acd.c
48
j1939acd.c
|
|
@ -471,32 +471,34 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
/* argument parsing */
|
||||
while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1)
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
++s.verbose;
|
||||
break;
|
||||
case 'c':
|
||||
s.cachefile = optarg;
|
||||
break;
|
||||
case 'r':
|
||||
s.ranges = optarg;
|
||||
break;
|
||||
case 'a':
|
||||
s.current_sa = strtoul(optarg, 0, 0);
|
||||
break;
|
||||
case 'p':
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
++s.verbose;
|
||||
break;
|
||||
case 'c':
|
||||
s.cachefile = optarg;
|
||||
break;
|
||||
case 'r':
|
||||
s.ranges = optarg;
|
||||
break;
|
||||
case 'a':
|
||||
s.current_sa = strtoul(optarg, 0, 0);
|
||||
break;
|
||||
case 'p':
|
||||
#ifdef _GNU_SOURCE
|
||||
if (asprintf(&program_invocation_name, "%s.%s", program_invocation_short_name, optarg) < 0)
|
||||
err(1, "asprintf(program invocation name)");
|
||||
if (asprintf(&program_invocation_name, "%s.%s",
|
||||
program_invocation_short_name, optarg) < 0)
|
||||
err(1, "asprintf(program invocation name)");
|
||||
#else
|
||||
err(0, "compile with -D_GNU_SOURCE to use -p");
|
||||
err(0, "compile with -D_GNU_SOURCE to use -p");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (argv[optind])
|
||||
s.name = strtoull(argv[optind++], 0, 16);
|
||||
if (argv[optind])
|
||||
|
|
|
|||
79
j1939cat.c
79
j1939cat.c
|
|
@ -598,44 +598,47 @@ static int j1939cat_parse_args(struct j1939cat_priv *priv, int argc, char *argv[
|
|||
|
||||
/* argument parsing */
|
||||
while ((opt = getopt(argc, argv, optstring)) != -1)
|
||||
switch (opt) {
|
||||
case 'i':
|
||||
priv->infile = open(optarg, O_RDONLY);
|
||||
if (priv->infile == -1)
|
||||
err(EXIT_FAILURE, "can't open input file");
|
||||
priv->todo_filesize = 1;
|
||||
break;
|
||||
case 's':
|
||||
priv->max_transfer = strtoul(optarg, NULL, 0);
|
||||
if (priv->max_transfer > J1939_MAX_ETP_PACKET_SIZE)
|
||||
err(EXIT_FAILURE, "used value (%zu) is bigger then allowed maximal size: %u.\n",
|
||||
priv->max_transfer, J1939_MAX_ETP_PACKET_SIZE);
|
||||
break;
|
||||
case 'r':
|
||||
priv->todo_recv = 1;
|
||||
break;
|
||||
case 'p':
|
||||
priv->todo_prio = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'P':
|
||||
priv->polltimeout = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'c':
|
||||
priv->todo_connect = 1;
|
||||
break;
|
||||
case 'R':
|
||||
priv->repeat = strtoul(optarg, NULL, 0);
|
||||
if (priv->repeat < 1)
|
||||
err(EXIT_FAILURE, "send/repeat count can't be less then 1\n");
|
||||
break;
|
||||
case 'B':
|
||||
priv->todo_broadcast = 1;
|
||||
break;
|
||||
case 'h': /*fallthrough*/
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
switch (opt) {
|
||||
case 'i':
|
||||
priv->infile = open(optarg, O_RDONLY);
|
||||
if (priv->infile == -1)
|
||||
err(EXIT_FAILURE, "can't open input file");
|
||||
priv->todo_filesize = 1;
|
||||
break;
|
||||
case 's':
|
||||
priv->max_transfer = strtoul(optarg, NULL, 0);
|
||||
if (priv->max_transfer > J1939_MAX_ETP_PACKET_SIZE)
|
||||
err(EXIT_FAILURE,
|
||||
"used value (%zu) is bigger then allowed maximal size: %u.\n",
|
||||
priv->max_transfer,
|
||||
J1939_MAX_ETP_PACKET_SIZE);
|
||||
break;
|
||||
case 'r':
|
||||
priv->todo_recv = 1;
|
||||
break;
|
||||
case 'p':
|
||||
priv->todo_prio = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'P':
|
||||
priv->polltimeout = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'c':
|
||||
priv->todo_connect = 1;
|
||||
break;
|
||||
case 'R':
|
||||
priv->repeat = strtoul(optarg, NULL, 0);
|
||||
if (priv->repeat < 1)
|
||||
err(EXIT_FAILURE,
|
||||
"send/repeat count can't be less then 1\n");
|
||||
break;
|
||||
case 'B':
|
||||
priv->todo_broadcast = 1;
|
||||
break;
|
||||
case 'h': /*fallthrough*/
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (argv[optind]) {
|
||||
if (strcmp("-", argv[optind]))
|
||||
|
|
|
|||
48
j1939spy.c
48
j1939spy.c
|
|
@ -107,30 +107,32 @@ int main(int argc, char **argv)
|
|||
|
||||
/* argument parsing */
|
||||
while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1)
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
++s.verbose;
|
||||
break;
|
||||
case 'b':
|
||||
s.pkt_len = strtoul(optarg, 0, 0);
|
||||
break;
|
||||
case 'P':
|
||||
++s.promisc;
|
||||
break;
|
||||
case 't':
|
||||
if (optarg) {
|
||||
if (!strchr("adzA", optarg[0]))
|
||||
err(1, "unknown time option '%c'", optarg[0]);
|
||||
s.time = optarg[0];
|
||||
} else {
|
||||
s.time = 'z';
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
++s.verbose;
|
||||
break;
|
||||
case 'b':
|
||||
s.pkt_len = strtoul(optarg, 0, 0);
|
||||
break;
|
||||
case 'P':
|
||||
++s.promisc;
|
||||
break;
|
||||
case 't':
|
||||
if (optarg) {
|
||||
if (!strchr("adzA", optarg[0]))
|
||||
err(1, "unknown time option '%c'",
|
||||
optarg[0]);
|
||||
s.time = optarg[0];
|
||||
} else {
|
||||
s.time = 'z';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (argv[optind]) {
|
||||
optarg = argv[optind];
|
||||
ret = libj1939_str2addr(optarg, 0, &s.addr);
|
||||
|
|
|
|||
42
j1939sr.c
42
j1939sr.c
|
|
@ -99,27 +99,27 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
/* argument parsing */
|
||||
while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1)
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
++s.verbose;
|
||||
break;
|
||||
case 's':
|
||||
s.pkt_len = strtoul(optarg, 0, 0);
|
||||
if (!s.pkt_len)
|
||||
err(1, "packet size of %s", optarg);
|
||||
break;
|
||||
case 'p':
|
||||
s.priority = strtoul(optarg, 0, 0);
|
||||
s.defined |= DEF_PRIO;
|
||||
break;
|
||||
case 'S':
|
||||
s.sendflags |= MSG_SYN;
|
||||
break;
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
++s.verbose;
|
||||
break;
|
||||
case 's':
|
||||
s.pkt_len = strtoul(optarg, 0, 0);
|
||||
if (!s.pkt_len)
|
||||
err(1, "packet size of %s", optarg);
|
||||
break;
|
||||
case 'p':
|
||||
s.priority = strtoul(optarg, 0, 0);
|
||||
s.defined |= DEF_PRIO;
|
||||
break;
|
||||
case 'S':
|
||||
s.sendflags |= MSG_SYN;
|
||||
break;
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (argv[optind]) {
|
||||
optarg = argv[optind++];
|
||||
|
|
|
|||
93
testj1939.c
93
testj1939.c
|
|
@ -101,52 +101,53 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* argument parsing */
|
||||
while ((opt = getopt(argc, argv, optstring)) != -1)
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
case 's':
|
||||
todo_send = strtoul(optarg ?: "8", NULL, 0);
|
||||
if (todo_send > sizeof(dat))
|
||||
err(1, "Unsupported size. max: %zu", sizeof(dat));
|
||||
break;
|
||||
case 'r':
|
||||
todo_recv = 1;
|
||||
break;
|
||||
case 'e':
|
||||
todo_echo = 1;
|
||||
break;
|
||||
case 'p':
|
||||
todo_prio = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'P':
|
||||
todo_promisc = 1;
|
||||
break;
|
||||
case 'c':
|
||||
todo_connect = 1;
|
||||
break;
|
||||
case 'n':
|
||||
todo_names = 1;
|
||||
break;
|
||||
case 'b':
|
||||
todo_rebind = 1;
|
||||
break;
|
||||
case 'B':
|
||||
todo_broadcast = 1;
|
||||
break;
|
||||
case 'o':
|
||||
no_bind = 1;
|
||||
break;
|
||||
case 'w':
|
||||
schedule_oneshot_itimer(strtod(optarg ?: "1", NULL));
|
||||
signal(SIGALRM, onsigalrm);
|
||||
todo_wait = 1;
|
||||
break;
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break;
|
||||
case 's':
|
||||
todo_send = strtoul(optarg ?: "8", NULL, 0);
|
||||
if (todo_send > sizeof(dat))
|
||||
err(1, "Unsupported size. max: %zu",
|
||||
sizeof(dat));
|
||||
break;
|
||||
case 'r':
|
||||
todo_recv = 1;
|
||||
break;
|
||||
case 'e':
|
||||
todo_echo = 1;
|
||||
break;
|
||||
case 'p':
|
||||
todo_prio = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'P':
|
||||
todo_promisc = 1;
|
||||
break;
|
||||
case 'c':
|
||||
todo_connect = 1;
|
||||
break;
|
||||
case 'n':
|
||||
todo_names = 1;
|
||||
break;
|
||||
case 'b':
|
||||
todo_rebind = 1;
|
||||
break;
|
||||
case 'B':
|
||||
todo_broadcast = 1;
|
||||
break;
|
||||
case 'o':
|
||||
no_bind = 1;
|
||||
break;
|
||||
case 'w':
|
||||
schedule_oneshot_itimer(strtod(optarg ?: "1", NULL));
|
||||
signal(SIGALRM, onsigalrm);
|
||||
todo_wait = 1;
|
||||
break;
|
||||
default:
|
||||
fputs(help_msg, stderr);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (argv[optind]) {
|
||||
if (strcmp("-", argv[optind]))
|
||||
|
|
|
|||
Loading…
Reference in New Issue