commit
7759b00c58
15
asc2log.c
15
asc2log.c
|
|
@ -42,18 +42,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <libgen.h>
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/error.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, int dplace
|
|||
int interface;
|
||||
static struct timeval tv; /* current frame timestamp */
|
||||
static struct timeval read_tv; /* frame timestamp from ASC file */
|
||||
struct canfd_frame cf;
|
||||
struct canfd_frame cf = {};
|
||||
unsigned char brs, esi, ctmp;
|
||||
unsigned int flags;
|
||||
int dlc, dlen = 0;
|
||||
|
|
@ -241,8 +241,6 @@ void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, int dplace
|
|||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 59 c0 \
|
||||
100000 214 223040 80000000 46500250 460a0250 20011736 20010205 */
|
||||
|
||||
memset(&cf, 0, sizeof(cf));
|
||||
|
||||
/* check for valid line without symbolic name */
|
||||
if (sscanf(buf, "%lu.%lu %*s %d %2s %s %hhx %hhx %x %d ",
|
||||
&read_tv.tv_sec, &read_tv.tv_usec, &interface,
|
||||
|
|
@ -335,7 +333,6 @@ void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, int dplace
|
|||
calc_tv(&tv, &read_tv, date_tvp, timestamps, dplace);
|
||||
prframe(outfile, &tv, interface, &cf, dlen, extra_info);
|
||||
fflush(outfile);
|
||||
return;
|
||||
|
||||
/* No support for really strange CANFD ErrorFrames format m( */
|
||||
}
|
||||
|
|
@ -359,7 +356,6 @@ int get_date(struct timeval *tv, char *date) {
|
|||
before parsing the real year value (hack) */
|
||||
if (!strptime(date, "%B %d %I:%M:%S.%Y %p %Y", &tms))
|
||||
return 1;
|
||||
else
|
||||
sscanf(date, "%*s %*d %*d:%*d:%*d.%3u ", &msecs);
|
||||
}
|
||||
|
||||
|
|
@ -377,7 +373,6 @@ int get_date(struct timeval *tv, char *date) {
|
|||
before parsing the real year value (hack) */
|
||||
if (!strptime(date, "%B %d %H:%M:%S.%Y %Y", &tms))
|
||||
return 1;
|
||||
else
|
||||
sscanf(date, "%*s %*d %*d:%*d:%*d.%3u ", &msecs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
bcmserver.c
16
bcmserver.c
|
|
@ -108,21 +108,21 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/bcm.h>
|
||||
|
|
|
|||
|
|
@ -18,16 +18,16 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libgen.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/can/netlink.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* imported from kernel */
|
||||
|
||||
|
|
@ -691,7 +691,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(can_calc_consts); i++) {
|
||||
if (name && strcmp(can_calc_consts[i].bittiming_const.name, name))
|
||||
if (name &&
|
||||
strcmp(can_calc_consts[i].bittiming_const.name, name) != 0)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
|
|
|
|||
16
canbusload.c
16
canbusload.c
|
|
@ -42,21 +42,21 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
|
|
|
|||
20
candump.c
20
candump.c
|
|
@ -42,23 +42,23 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
|
|
@ -417,7 +417,7 @@ int main(int argc, char **argv)
|
|||
printf("using interface name '%s'.\n", ifr.ifr_name);
|
||||
#endif
|
||||
|
||||
if (strcmp(ANYDEV, ifr.ifr_name)) {
|
||||
if (strcmp(ANYDEV, ifr.ifr_name) != 0) {
|
||||
if (ioctl(s[i], SIOCGIFINDEX, &ifr) < 0) {
|
||||
perror("SIOCGIFINDEX");
|
||||
exit(1);
|
||||
|
|
|
|||
40
canfdtest.c
40
canfdtest.c
|
|
@ -17,24 +17,24 @@
|
|||
* Send feedback to <linux-can@vger.kernel.org>
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <sched.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <libgen.h>
|
||||
#include <getopt.h>
|
||||
#include <time.h>
|
||||
#include <sched.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
|
|
@ -181,21 +181,19 @@ static int send_frame(struct can_frame *frame)
|
|||
|
||||
while ((ret = send(sockfd, frame, sizeof(*frame), 0))
|
||||
!= sizeof(*frame)) {
|
||||
if (ret < 0) {
|
||||
if (ret >= 0) {
|
||||
fprintf(stderr, "send returned %d", ret);
|
||||
return -1;
|
||||
}
|
||||
if (errno != ENOBUFS) {
|
||||
perror("send failed");
|
||||
return -1;
|
||||
} else {
|
||||
}
|
||||
if (verbose) {
|
||||
printf("N");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "send returned %d", ret);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +330,8 @@ static int can_echo_gen(void)
|
|||
if (recv_tx_pos == inflight_count)
|
||||
recv_tx_pos = 0;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (!recv_tx[recv_rx_pos]) {
|
||||
printf("RX before TX!\n");
|
||||
print_frame(&rx_frame, 0);
|
||||
|
|
@ -343,7 +342,6 @@ static int can_echo_gen(void)
|
|||
recv_rx_pos++;
|
||||
if (recv_rx_pos == inflight_count)
|
||||
recv_rx_pos = 0;
|
||||
}
|
||||
|
||||
loops++;
|
||||
if (test_loops && loops >= test_loops)
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@
|
|||
*/
|
||||
|
||||
#include "canframelen.h"
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* Functions and types for CRC checks.
|
||||
|
|
|
|||
26
cangen.c
26
cangen.c
|
|
@ -42,28 +42,28 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <poll.h>
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include "lib.h"
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
#include "lib.h"
|
||||
|
||||
#define DEFAULT_GAP 200 /* ms */
|
||||
#define DEFAULT_BURST_COUNT 1
|
||||
|
|
@ -297,7 +297,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
ts.tv_sec = gap / 1000;
|
||||
ts.tv_nsec = (long)(((long long)(gap * 1000000)) % 1000000000ll);
|
||||
ts.tv_nsec = (long)(((long long)(gap * 1000000)) % 1000000000LL);
|
||||
|
||||
/* recognize obviously missing commandline option */
|
||||
if (id_mode == MODE_FIX && frame.can_id > 0x7FF && !extended) {
|
||||
|
|
@ -468,7 +468,7 @@ resend:
|
|||
if (poll(&fds, 1, polltimeout) < 0) {
|
||||
perror("poll");
|
||||
return 1;
|
||||
} else
|
||||
}
|
||||
goto resend;
|
||||
} else
|
||||
enobufs_count++;
|
||||
|
|
|
|||
22
cangw.c
22
cangw.c
|
|
@ -42,17 +42,17 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libgen.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <libgen.h>
|
||||
#include <linux/can/gw.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/can/gw.h>
|
||||
#include <net/if.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
enum {
|
||||
UNSPEC,
|
||||
|
|
@ -706,8 +706,8 @@ int main(int argc, char **argv)
|
|||
struct can_filter filter;
|
||||
struct sockaddr_nl nladdr;
|
||||
|
||||
struct cgw_csum_xor cs_xor;
|
||||
struct cgw_csum_crc8 cs_crc8;
|
||||
struct cgw_csum_xor cs_xor = {};
|
||||
struct cgw_csum_crc8 cs_crc8 = {};
|
||||
char crc8tab[513] = {0};
|
||||
|
||||
struct modattr modmsg[CGW_MOD_FUNCS];
|
||||
|
|
@ -717,8 +717,6 @@ int main(int argc, char **argv)
|
|||
int i;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
memset(&cs_xor, 0, sizeof(cs_xor));
|
||||
memset(&cs_crc8, 0, sizeof(cs_crc8));
|
||||
|
||||
while ((opt = getopt(argc, argv, "ADFLs:d:Xteiu:l:f:c:p:x:m:M:?")) != -1) {
|
||||
switch (opt) {
|
||||
|
|
|
|||
|
|
@ -42,29 +42,29 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
|
@ -300,7 +300,6 @@ int main(int argc, char **argv)
|
|||
//printf("accepted\n");
|
||||
if (!fork())
|
||||
break;
|
||||
else
|
||||
close(accsocket);
|
||||
}
|
||||
else if (errno != EINTR) {
|
||||
|
|
@ -357,15 +356,14 @@ int main(int argc, char **argv)
|
|||
|
||||
addr.can_family = AF_CAN;
|
||||
|
||||
if (strcmp(ANYDEV, argv[optind+i])) {
|
||||
if (strcmp(ANYDEV, argv[optind + i]) != 0) {
|
||||
strcpy(ifr.ifr_name, argv[optind+i]);
|
||||
if (ioctl(s[i], SIOCGIFINDEX, &ifr) < 0) {
|
||||
perror("SIOCGIFINDEX");
|
||||
exit(1);
|
||||
}
|
||||
addr.can_ifindex = ifr.ifr_ifindex;
|
||||
}
|
||||
else
|
||||
} else
|
||||
addr.can_ifindex = 0; /* any can interface */
|
||||
|
||||
if (bind(s[i], (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
|
|
|
|||
14
canplayer.c
14
canplayer.c
|
|
@ -42,19 +42,19 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <libgen.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ int add_assignment(char *mode, int socket, char *txname, char *rxname,
|
|||
}
|
||||
strcpy(asgn[i].rxif, rxname);
|
||||
|
||||
if (strcmp(txname, "stdout")) {
|
||||
if (strcmp(txname, "stdout") != 0) {
|
||||
strcpy(ifr.ifr_name, txname);
|
||||
if (ioctl(socket, SIOCGIFINDEX, &ifr) < 0) {
|
||||
perror("SIOCGIFINDEX");
|
||||
|
|
|
|||
24
cansniffer.c
24
cansniffer.c
|
|
@ -42,25 +42,25 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
|
|
@ -333,7 +333,7 @@ int main(int argc, char **argv)
|
|||
|
||||
addr.can_family = AF_CAN;
|
||||
|
||||
if (strcmp(ANYDEV, argv[optind]))
|
||||
if (strcmp(ANYDEV, argv[optind]) != 0)
|
||||
addr.can_ifindex = if_nametoindex(argv[optind]);
|
||||
else
|
||||
addr.can_ifindex = 0; /* any can interface */
|
||||
|
|
|
|||
42
isotpdump.c
42
isotpdump.c
|
|
@ -42,23 +42,23 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <time.h>
|
||||
#include <strings.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "terminal.h"
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
#include <linux/sockios.h>
|
||||
#include "terminal.h"
|
||||
|
||||
#define NO_CAN_ID 0xFFFFFFFFU
|
||||
|
||||
|
|
@ -335,15 +335,17 @@ int main(int argc, char **argv)
|
|||
if (nbytes < 0) {
|
||||
perror("read");
|
||||
return 1;
|
||||
} else if (nbytes != CAN_MTU && nbytes != CANFD_MTU) {
|
||||
}
|
||||
if (nbytes != CAN_MTU && nbytes != CANFD_MTU) {
|
||||
fprintf(stderr, "read: incomplete CAN frame %zu %d\n", sizeof(frame), nbytes);
|
||||
return 1;
|
||||
} else {
|
||||
|
||||
if (frame.can_id == src && ext && !extany && extaddr != frame.data[0])
|
||||
}
|
||||
if (frame.can_id == src && ext && !extany &&
|
||||
extaddr != frame.data[0])
|
||||
continue;
|
||||
|
||||
if (frame.can_id == dst && rx_ext && !rx_extany && rx_extaddr != frame.data[0])
|
||||
if (frame.can_id == dst && rx_ext && !rx_extany &&
|
||||
rx_extaddr != frame.data[0])
|
||||
continue;
|
||||
|
||||
if (color)
|
||||
|
|
@ -352,9 +354,7 @@ int main(int argc, char **argv)
|
|||
if (timestamp) {
|
||||
ioctl(s, SIOCGSTAMP, &tv);
|
||||
|
||||
|
||||
switch (timestamp) {
|
||||
|
||||
case 'a': /* absolute with timestamp */
|
||||
printf("(%lu.%06lu) ", tv.tv_sec, tv.tv_usec);
|
||||
break;
|
||||
|
|
@ -365,10 +365,10 @@ int main(int argc, char **argv)
|
|||
char timestring[25];
|
||||
|
||||
tm = *localtime(&tv.tv_sec);
|
||||
strftime(timestring, 24, "%Y-%m-%d %H:%M:%S", &tm);
|
||||
strftime(timestring, 24, "%Y-%m-%d %H:%M:%S",
|
||||
&tm);
|
||||
printf("(%s.%06lu) ", timestring, tv.tv_usec);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
case 'd': /* delta */
|
||||
case 'z': /* starting with zero */
|
||||
|
|
@ -383,12 +383,13 @@ int main(int argc, char **argv)
|
|||
diff.tv_sec--, diff.tv_usec += 1000000;
|
||||
if (diff.tv_sec < 0)
|
||||
diff.tv_sec = diff.tv_usec = 0;
|
||||
printf("(%lu.%06lu) ", diff.tv_sec, diff.tv_usec);
|
||||
printf("(%lu.%06lu) ", diff.tv_sec,
|
||||
diff.tv_usec);
|
||||
|
||||
if (timestamp == 'd')
|
||||
last_tv = tv; /* update for delta calculation */
|
||||
}
|
||||
break;
|
||||
last_tv =
|
||||
tv; /* update for delta calculation */
|
||||
} break;
|
||||
|
||||
default: /* no timestamp output */
|
||||
break;
|
||||
|
|
@ -502,7 +503,6 @@ int main(int argc, char **argv)
|
|||
printf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
close(s);
|
||||
|
||||
|
|
|
|||
17
isotpperf.c
17
isotpperf.c
|
|
@ -42,18 +42,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <libgen.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/raw.h>
|
||||
|
|
@ -223,12 +223,14 @@ int main(int argc, char **argv)
|
|||
ret = nbytes;
|
||||
running = 0;
|
||||
continue;
|
||||
} else if (nbytes != CAN_MTU && nbytes != CANFD_MTU) {
|
||||
}
|
||||
if (nbytes != CAN_MTU && nbytes != CANFD_MTU) {
|
||||
fprintf(stderr, "read: incomplete CAN frame %zu %d\n", sizeof(frame), nbytes);
|
||||
ret = nbytes;
|
||||
running = 0;
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (rcvlen) {
|
||||
/* make sure to process only the detected PDU CAN frame type */
|
||||
if (canfd_on && (nbytes != CANFD_MTU))
|
||||
|
|
@ -409,7 +411,6 @@ int main(int argc, char **argv)
|
|||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
close(s);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,16 +42,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/isotp.h>
|
||||
|
|
|
|||
|
|
@ -42,16 +42,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/isotp.h>
|
||||
|
|
|
|||
|
|
@ -57,22 +57,22 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/isotp.h>
|
||||
|
|
|
|||
|
|
@ -42,23 +42,23 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "terminal.h"
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/isotp.h>
|
||||
#include <linux/sockios.h>
|
||||
#include "terminal.h"
|
||||
|
||||
#define NO_CAN_ID 0xFFFFFFFFU
|
||||
|
||||
|
|
|
|||
16
isotptun.c
16
isotptun.c
|
|
@ -48,21 +48,21 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/isotp.h>
|
||||
|
|
|
|||
27
j1939acd.c
27
j1939acd.c
|
|
@ -10,22 +10,22 @@
|
|||
* as published by the Free Software Foundation
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <err.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <getopt.h>
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/j1939.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libj1939.h"
|
||||
|
||||
|
|
@ -383,9 +383,8 @@ static inline int addr_status_mine(int sa)
|
|||
{
|
||||
if (sa == s.current_sa)
|
||||
return '*';
|
||||
else if (addr[sa].flags & F_USE)
|
||||
if (addr[sa].flags & F_USE)
|
||||
return '+';
|
||||
else
|
||||
return '-';
|
||||
}
|
||||
|
||||
|
|
@ -487,7 +486,8 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
case 'p':
|
||||
#ifdef _GNU_SOURCE
|
||||
if (asprintf(&program_invocation_name, "%s.%s", program_invocation_short_name, optarg) < 0)
|
||||
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");
|
||||
|
|
@ -498,6 +498,7 @@ int main(int argc, char *argv[])
|
|||
exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (argv[optind])
|
||||
s.name = strtoull(argv[optind++], 0, 16);
|
||||
if (argv[optind])
|
||||
|
|
|
|||
28
j1939cat.c
28
j1939cat.c
|
|
@ -8,16 +8,16 @@
|
|||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <net/if.h>
|
||||
#include <poll.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <linux/errqueue.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/net_tstamp.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/socket.h>
|
||||
|
||||
#include "libj1939.h"
|
||||
|
|
@ -212,7 +212,6 @@ static int j1939cat_extract_serr(struct j1939cat_priv *priv)
|
|||
|
||||
if (serr->ee_info == SCM_TSTAMP_SCHED)
|
||||
return -EINTR;
|
||||
else
|
||||
return 0;
|
||||
case SO_EE_ORIGIN_LOCAL:
|
||||
/*
|
||||
|
|
@ -319,11 +318,10 @@ static int j1939cat_send_loop(struct j1939cat_priv *priv, int out_fd, char *buf,
|
|||
ret = poll(&fds, 1, priv->polltimeout);
|
||||
if (ret == -EINTR)
|
||||
continue;
|
||||
else if (ret < 0)
|
||||
if (ret < 0)
|
||||
return -errno;
|
||||
else if (!ret)
|
||||
if (!ret)
|
||||
return -ETIME;
|
||||
|
||||
if (!(fds.revents & events)) {
|
||||
warn("%s: something else is wrong", __func__);
|
||||
return -EIO;
|
||||
|
|
@ -333,11 +331,10 @@ static int j1939cat_send_loop(struct j1939cat_priv *priv, int out_fd, char *buf,
|
|||
ret = j1939cat_recv_err(priv);
|
||||
if (ret == -EINTR)
|
||||
continue;
|
||||
else if (ret)
|
||||
if (ret)
|
||||
return ret;
|
||||
else if ((priv->repeat - 1) == stats->tskey)
|
||||
if ((priv->repeat - 1) == stats->tskey)
|
||||
tx_done = true;
|
||||
|
||||
}
|
||||
|
||||
if (fds.revents & POLLOUT) {
|
||||
|
|
@ -611,8 +608,10 @@ static int j1939cat_parse_args(struct j1939cat_priv *priv, int argc, char *argv[
|
|||
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);
|
||||
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;
|
||||
|
|
@ -629,7 +628,8 @@ static int j1939cat_parse_args(struct j1939cat_priv *priv, int argc, char *argv[
|
|||
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");
|
||||
err(EXIT_FAILURE,
|
||||
"send/repeat count can't be less then 1\n");
|
||||
break;
|
||||
case 'B':
|
||||
priv->todo_broadcast = 1;
|
||||
|
|
@ -641,13 +641,13 @@ static int j1939cat_parse_args(struct j1939cat_priv *priv, int argc, char *argv[
|
|||
}
|
||||
|
||||
if (argv[optind]) {
|
||||
if (strcmp("-", argv[optind]))
|
||||
if (strcmp("-", argv[optind]) != 0)
|
||||
libj1939_parse_canaddr(argv[optind], &priv->sockname);
|
||||
optind++;
|
||||
}
|
||||
|
||||
if (argv[optind]) {
|
||||
if (strcmp("-", argv[optind])) {
|
||||
if (strcmp("-", argv[optind]) != 0) {
|
||||
libj1939_parse_canaddr(argv[optind], &priv->peername);
|
||||
priv->valid_peername = 1;
|
||||
}
|
||||
|
|
|
|||
18
j1939spy.c
18
j1939spy.c
|
|
@ -10,19 +10,19 @@
|
|||
* as published by the Free Software Foundation
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <err.h>
|
||||
#include <sys/socket.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libj1939.h"
|
||||
|
||||
|
|
@ -120,7 +120,8 @@ int main(int argc, char **argv)
|
|||
case 't':
|
||||
if (optarg) {
|
||||
if (!strchr("adzA", optarg[0]))
|
||||
err(1, "unknown time option '%c'", optarg[0]);
|
||||
err(1, "unknown time option '%c'",
|
||||
optarg[0]);
|
||||
s.time = optarg[0];
|
||||
} else {
|
||||
s.time = 'z';
|
||||
|
|
@ -131,6 +132,7 @@ int main(int argc, char **argv)
|
|||
exit(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (argv[optind]) {
|
||||
optarg = argv[optind];
|
||||
ret = libj1939_str2addr(optarg, 0, &s.addr);
|
||||
|
|
|
|||
14
j1939sr.c
14
j1939sr.c
|
|
@ -10,20 +10,20 @@
|
|||
* as published by the Free Software Foundation
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <err.h>
|
||||
#include <getopt.h>
|
||||
#include <poll.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libj1939.h"
|
||||
|
||||
|
|
|
|||
4
lib.c
4
lib.c
|
|
@ -42,13 +42,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/socket.h> /* for sa_family_t */
|
||||
#include <linux/can.h>
|
||||
#include <linux/can/error.h>
|
||||
#include <sys/socket.h> /* for sa_family_t */
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
|
|
|||
12
libj1939.c
12
libj1939.c
|
|
@ -10,16 +10,16 @@
|
|||
* as published by the Free Software Foundation
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <err.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ static const char *libj1939_ifnam(int ifindex)
|
|||
*/
|
||||
libj1939_cleanup();
|
||||
return libj1939_ifnam(ifindex);
|
||||
} else
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ static int libj1939_ifindex(const char *str)
|
|||
if (cached) {
|
||||
libj1939_cleanup();
|
||||
return libj1939_ifindex(str);
|
||||
} else
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,15 +42,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/time.h>
|
||||
#include <linux/can.h>
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <linux/can.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -42,18 +42,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/tty.h>
|
||||
#include <net/if.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/socket.h>
|
||||
#include <termios.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void print_usage(char *prg)
|
||||
{
|
||||
|
|
|
|||
28
slcand.c
28
slcand.c
|
|
@ -22,25 +22,25 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/tty.h>
|
||||
#include <net/if.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <fcntl.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <termios.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/serial.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Change this to whatever your daemon is called */
|
||||
#define DAEMON_NAME "slcand"
|
||||
|
|
|
|||
25
testj1939.c
25
testj1939.c
|
|
@ -10,20 +10,20 @@
|
|||
* as published by the Free Software Foundation
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <err.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <getopt.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libj1939.h"
|
||||
|
||||
|
|
@ -108,7 +108,8 @@ int main(int argc, char *argv[])
|
|||
case 's':
|
||||
todo_send = strtoul(optarg ?: "8", NULL, 0);
|
||||
if (todo_send > sizeof(dat))
|
||||
err(1, "Unsupported size. max: %zu", sizeof(dat));
|
||||
err(1, "Unsupported size. max: %zu",
|
||||
sizeof(dat));
|
||||
break;
|
||||
case 'r':
|
||||
todo_recv = 1;
|
||||
|
|
@ -149,7 +150,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (argv[optind]) {
|
||||
if (strcmp("-", argv[optind]))
|
||||
if (strcmp("-", argv[optind]) != 0)
|
||||
libj1939_parse_canaddr(argv[optind], &sockname);
|
||||
++optind;
|
||||
}
|
||||
|
|
@ -158,7 +159,7 @@ int main(int argc, char *argv[])
|
|||
sockname.can_addr.j1939.addr++;
|
||||
|
||||
if (argv[optind]) {
|
||||
if (strcmp("-", argv[optind])) {
|
||||
if (strcmp("-", argv[optind]) != 0) {
|
||||
libj1939_parse_canaddr(argv[optind], &peername);
|
||||
valid_peername = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue