Patch with v2023.03 changes for obsolete cast and signum handling

pull/494/head
David Shepherd 2024-02-02 00:49:15 -05:00
parent cb1a73b795
commit 5eddba68ac
1 changed files with 12 additions and 6 deletions

View File

@ -79,6 +79,7 @@
#define BUF_LEN (MAX_PDU_LENGTH + 1) #define BUF_LEN (MAX_PDU_LENGTH + 1)
static volatile int running = 1; static volatile int running = 1;
static volatile sig_atomic_t signal_num;
static void fake_syslog(int priority, const char *format, ...) static void fake_syslog(int priority, const char *format, ...)
{ {
@ -130,6 +131,7 @@ void print_usage(char *prg)
void sigterm(int signo) void sigterm(int signo)
{ {
running = 0; running = 0;
signal_num = signo;
} }
int main(int argc, char **argv) int main(int argc, char **argv)
@ -154,13 +156,13 @@ int main(int argc, char **argv)
while ((opt = getopt(argc, argv, "s:d:n:x:p:P:t:b:m:whL:vD?")) != -1) { while ((opt = getopt(argc, argv, "s:d:n:x:p:P:t:b:m:whL:vD?")) != -1) {
switch (opt) { switch (opt) {
case 's': case 's':
addr.can_addr.tp.tx_id = strtoul(optarg, (char **)NULL, 16); addr.can_addr.tp.tx_id = strtoul(optarg, NULL, 16);
if (strlen(optarg) > 7) if (strlen(optarg) > 7)
addr.can_addr.tp.tx_id |= CAN_EFF_FLAG; addr.can_addr.tp.tx_id |= CAN_EFF_FLAG;
break; break;
case 'd': case 'd':
addr.can_addr.tp.rx_id = strtoul(optarg, (char **)NULL, 16); addr.can_addr.tp.rx_id = strtoul(optarg, NULL, 16);
if (strlen(optarg) > 7) if (strlen(optarg) > 7)
addr.can_addr.tp.rx_id |= CAN_EFF_FLAG; addr.can_addr.tp.rx_id |= CAN_EFF_FLAG;
break; break;
@ -228,19 +230,19 @@ int main(int argc, char **argv)
break; break;
case 't': case 't':
opts.frame_txtime = strtoul(optarg, (char **)NULL, 10); opts.frame_txtime = strtoul(optarg, NULL, 10);
break; break;
case 'b': case 'b':
fcopts.bs = strtoul(optarg, (char **)NULL, 16) & 0xFF; fcopts.bs = strtoul(optarg, NULL, 16) & 0xFF;
break; break;
case 'm': case 'm':
fcopts.stmin = strtoul(optarg, (char **)NULL, 16) & 0xFF; fcopts.stmin = strtoul(optarg, NULL, 16) & 0xFF;
break; break;
case 'w': case 'w':
fcopts.wftmax = strtoul(optarg, (char **)NULL, 16) & 0xFF; fcopts.wftmax = strtoul(optarg, NULL, 16) & 0xFF;
break; break;
case 'h': case 'h':
@ -436,5 +438,9 @@ int main(int argc, char **argv)
close(s); close(s);
close(t); close(t);
if (signal_num)
return 128 + signal_num;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }