clang-tidy: fix wrong identation

Found with readability-misleading-indentation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
pull/250/head
Rosen Penev 2020-10-12 00:26:08 -07:00
parent 17a5fe6022
commit d5320d554e
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B
5 changed files with 159 additions and 151 deletions

View File

@ -471,32 +471,34 @@ int main(int argc, char *argv[])
#endif #endif
/* argument parsing */ /* argument parsing */
while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1) while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1)
switch (opt) { switch (opt) {
case 'v': case 'v':
++s.verbose; ++s.verbose;
break; break;
case 'c': case 'c':
s.cachefile = optarg; s.cachefile = optarg;
break; break;
case 'r': case 'r':
s.ranges = optarg; s.ranges = optarg;
break; break;
case 'a': case 'a':
s.current_sa = strtoul(optarg, 0, 0); s.current_sa = strtoul(optarg, 0, 0);
break; break;
case 'p': case 'p':
#ifdef _GNU_SOURCE #ifdef _GNU_SOURCE
if (asprintf(&program_invocation_name, "%s.%s", program_invocation_short_name, optarg) < 0) if (asprintf(&program_invocation_name, "%s.%s",
err(1, "asprintf(program invocation name)"); program_invocation_short_name, optarg) < 0)
err(1, "asprintf(program invocation name)");
#else #else
err(0, "compile with -D_GNU_SOURCE to use -p"); err(0, "compile with -D_GNU_SOURCE to use -p");
#endif #endif
break; break;
default: default:
fputs(help_msg, stderr); fputs(help_msg, stderr);
exit(1); exit(1);
break; break;
} }
if (argv[optind]) if (argv[optind])
s.name = strtoull(argv[optind++], 0, 16); s.name = strtoull(argv[optind++], 0, 16);
if (argv[optind]) if (argv[optind])

View File

@ -598,44 +598,47 @@ static int j1939cat_parse_args(struct j1939cat_priv *priv, int argc, char *argv[
/* argument parsing */ /* argument parsing */
while ((opt = getopt(argc, argv, optstring)) != -1) while ((opt = getopt(argc, argv, optstring)) != -1)
switch (opt) { switch (opt) {
case 'i': case 'i':
priv->infile = open(optarg, O_RDONLY); priv->infile = open(optarg, O_RDONLY);
if (priv->infile == -1) if (priv->infile == -1)
err(EXIT_FAILURE, "can't open input file"); err(EXIT_FAILURE, "can't open input file");
priv->todo_filesize = 1; priv->todo_filesize = 1;
break; break;
case 's': case 's':
priv->max_transfer = strtoul(optarg, NULL, 0); priv->max_transfer = strtoul(optarg, NULL, 0);
if (priv->max_transfer > J1939_MAX_ETP_PACKET_SIZE) if (priv->max_transfer > J1939_MAX_ETP_PACKET_SIZE)
err(EXIT_FAILURE, "used value (%zu) is bigger then allowed maximal size: %u.\n", err(EXIT_FAILURE,
priv->max_transfer, J1939_MAX_ETP_PACKET_SIZE); "used value (%zu) is bigger then allowed maximal size: %u.\n",
break; priv->max_transfer,
case 'r': J1939_MAX_ETP_PACKET_SIZE);
priv->todo_recv = 1; break;
break; case 'r':
case 'p': priv->todo_recv = 1;
priv->todo_prio = strtoul(optarg, NULL, 0); break;
break; case 'p':
case 'P': priv->todo_prio = strtoul(optarg, NULL, 0);
priv->polltimeout = strtoul(optarg, NULL, 0); break;
break; case 'P':
case 'c': priv->polltimeout = strtoul(optarg, NULL, 0);
priv->todo_connect = 1; break;
break; case 'c':
case 'R': priv->todo_connect = 1;
priv->repeat = strtoul(optarg, NULL, 0); break;
if (priv->repeat < 1) case 'R':
err(EXIT_FAILURE, "send/repeat count can't be less then 1\n"); priv->repeat = strtoul(optarg, NULL, 0);
break; if (priv->repeat < 1)
case 'B': err(EXIT_FAILURE,
priv->todo_broadcast = 1; "send/repeat count can't be less then 1\n");
break; break;
case 'h': /*fallthrough*/ case 'B':
default: priv->todo_broadcast = 1;
fputs(help_msg, stderr); break;
return EXIT_FAILURE; case 'h': /*fallthrough*/
} default:
fputs(help_msg, stderr);
return EXIT_FAILURE;
}
if (argv[optind]) { if (argv[optind]) {
if (strcmp("-", argv[optind])) if (strcmp("-", argv[optind]))

View File

@ -107,30 +107,32 @@ int main(int argc, char **argv)
/* argument parsing */ /* argument parsing */
while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1) while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1)
switch (opt) { switch (opt) {
case 'v': case 'v':
++s.verbose; ++s.verbose;
break; break;
case 'b': case 'b':
s.pkt_len = strtoul(optarg, 0, 0); s.pkt_len = strtoul(optarg, 0, 0);
break; break;
case 'P': case 'P':
++s.promisc; ++s.promisc;
break; break;
case 't': case 't':
if (optarg) { if (optarg) {
if (!strchr("adzA", optarg[0])) if (!strchr("adzA", optarg[0]))
err(1, "unknown time option '%c'", optarg[0]); err(1, "unknown time option '%c'",
s.time = optarg[0]; optarg[0]);
} else { s.time = optarg[0];
s.time = 'z'; } 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]) { if (argv[optind]) {
optarg = argv[optind]; optarg = argv[optind];
ret = libj1939_str2addr(optarg, 0, &s.addr); ret = libj1939_str2addr(optarg, 0, &s.addr);

View File

@ -99,27 +99,27 @@ int main(int argc, char **argv)
#endif #endif
/* argument parsing */ /* argument parsing */
while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1) while ((opt = getopt_long(argc, argv, optstring, long_opts, NULL)) != -1)
switch (opt) { switch (opt) {
case 'v': case 'v':
++s.verbose; ++s.verbose;
break; break;
case 's': case 's':
s.pkt_len = strtoul(optarg, 0, 0); s.pkt_len = strtoul(optarg, 0, 0);
if (!s.pkt_len) if (!s.pkt_len)
err(1, "packet size of %s", optarg); err(1, "packet size of %s", optarg);
break; break;
case 'p': case 'p':
s.priority = strtoul(optarg, 0, 0); s.priority = strtoul(optarg, 0, 0);
s.defined |= DEF_PRIO; s.defined |= DEF_PRIO;
break; break;
case 'S': case 'S':
s.sendflags |= MSG_SYN; s.sendflags |= MSG_SYN;
break; break;
default: default:
fputs(help_msg, stderr); fputs(help_msg, stderr);
exit(1); exit(1);
break; break;
} }
if (argv[optind]) { if (argv[optind]) {
optarg = argv[optind++]; optarg = argv[optind++];

View File

@ -101,52 +101,53 @@ int main(int argc, char *argv[])
/* argument parsing */ /* argument parsing */
while ((opt = getopt(argc, argv, optstring)) != -1) while ((opt = getopt(argc, argv, optstring)) != -1)
switch (opt) { switch (opt) {
case 'v': case 'v':
verbose = 1; verbose = 1;
break; break;
case 's': case 's':
todo_send = strtoul(optarg ?: "8", NULL, 0); todo_send = strtoul(optarg ?: "8", NULL, 0);
if (todo_send > sizeof(dat)) if (todo_send > sizeof(dat))
err(1, "Unsupported size. max: %zu", sizeof(dat)); err(1, "Unsupported size. max: %zu",
break; sizeof(dat));
case 'r': break;
todo_recv = 1; case 'r':
break; todo_recv = 1;
case 'e': break;
todo_echo = 1; case 'e':
break; todo_echo = 1;
case 'p': break;
todo_prio = strtoul(optarg, NULL, 0); case 'p':
break; todo_prio = strtoul(optarg, NULL, 0);
case 'P': break;
todo_promisc = 1; case 'P':
break; todo_promisc = 1;
case 'c': break;
todo_connect = 1; case 'c':
break; todo_connect = 1;
case 'n': break;
todo_names = 1; case 'n':
break; todo_names = 1;
case 'b': break;
todo_rebind = 1; case 'b':
break; todo_rebind = 1;
case 'B': break;
todo_broadcast = 1; case 'B':
break; todo_broadcast = 1;
case 'o': break;
no_bind = 1; case 'o':
break; no_bind = 1;
case 'w': break;
schedule_oneshot_itimer(strtod(optarg ?: "1", NULL)); case 'w':
signal(SIGALRM, onsigalrm); schedule_oneshot_itimer(strtod(optarg ?: "1", NULL));
todo_wait = 1; signal(SIGALRM, onsigalrm);
break; todo_wait = 1;
default: break;
fputs(help_msg, stderr); default:
exit(1); fputs(help_msg, stderr);
break; exit(1);
} break;
}
if (argv[optind]) { if (argv[optind]) {
if (strcmp("-", argv[optind])) if (strcmp("-", argv[optind]))