candump: convert towards kernel coding style

pull/482/head
Marc Kleine-Budde 2023-12-06 10:12:30 +01:00
parent fe6ee6d33f
commit 697901f9ef
1 changed files with 18 additions and 19 deletions

View File

@ -106,7 +106,7 @@ struct if_info { /* bundled information per open socket */
static struct if_info sock_info[MAXSOCK]; static struct if_info sock_info[MAXSOCK];
static char *progname; static char *progname;
static char devname[MAXIFNAMES][IFNAMSIZ+1]; static char devname[MAXIFNAMES][IFNAMSIZ + 1];
static int dindex[MAXIFNAMES]; static int dindex[MAXIFNAMES];
static int max_devname_len; /* to prevent frazzled device name output */ static int max_devname_len; /* to prevent frazzled device name output */
static const int canfd_on = 1; static const int canfd_on = 1;
@ -175,7 +175,6 @@ static void sigterm(int signo)
static int idx2dindex(int ifidx, int socket) static int idx2dindex(int ifidx, int socket)
{ {
int i; int i;
struct ifreq ifr; struct ifreq ifr;
@ -474,8 +473,8 @@ int main(int argc, char **argv)
} }
for (i = 0; i < currmax; i++) { for (i = 0; i < currmax; i++) {
struct if_info* obj = &sock_info[i]; struct if_info *obj = &sock_info[i];
ptr = argv[optind+i]; ptr = argv[optind + i];
nptr = strchr(ptr, ','); nptr = strchr(ptr, ',');
pr_debug("open %d '%s'.\n", i, ptr); pr_debug("open %d '%s'.\n", i, ptr);
@ -715,7 +714,7 @@ int main(int argc, char **argv)
} }
for (i = 0; i < num_events; i++) { /* check waiting CAN RAW sockets */ for (i = 0; i < num_events; i++) { /* check waiting CAN RAW sockets */
struct if_info* obj = events_pending[i].data.ptr; struct if_info *obj = events_pending[i].data.ptr;
int idx; int idx;
char *extra_info = ""; char *extra_info = "";
@ -838,9 +837,9 @@ int main(int argc, char **argv)
if (extra_msg_info) { if (extra_msg_info) {
if (msg.msg_flags & MSG_DONTROUTE) if (msg.msg_flags & MSG_DONTROUTE)
printf (" TX %s", extra_m_info[frame.flags & 3]); printf(" TX %s", extra_m_info[frame.flags & 3]);
else else
printf (" RX %s", extra_m_info[frame.flags & 3]); printf(" RX %s", extra_m_info[frame.flags & 3]);
} }
printf("%s ", (color == 1) ? col_off : ""); printf("%s ", (color == 1) ? col_off : "");
@ -850,7 +849,7 @@ int main(int argc, char **argv)
printf("%s", (color > 1) ? col_off : ""); printf("%s", (color > 1) ? col_off : "");
printf("\n"); printf("\n");
out_fflush: out_fflush:
fflush(stdout); fflush(stdout);
} }
} }