Skip to content

Commit

Permalink
rpl_udp: optimize error handling for set command
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Nov 2, 2014
1 parent 38fab9d commit a8e83d8
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions examples/rpl_udp/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,28 @@ void rpl_udp_ignore(int argc, char **argv)
{
uint16_t a;

if (argc < 2) {
printf("Usage: %s <addr>\n", argv[0]);
return;
}

if (transceiver_pid == KERNEL_PID_UNDEF) {
puts("Transceiver not runnning.");
return;
}

/* cppcheck: a is actually read via tcmd.data */
/* cppcheck-suppress unreadVariable */
a = atoi(argv[1]);

msg_t mesg;
mesg.type = DBG_IGN;
mesg.content.ptr = (char *) &tcmd;

tcmd.transceivers = TRANSCEIVER_CC1100;
tcmd.data = &a;

if (argc == 2) {
/* cppcheck: a is actually read via tcmd.data */
/* cppcheck-suppress unreadVariable */
a = atoi(argv[1]);
printf("sending to transceiver (%" PRIkernel_pid "): %u\n", transceiver_pid, (*(uint8_t *)tcmd.data));
msg_send(&mesg, transceiver_pid);
}
else {
printf("Usage: %s <addr>\n", argv[0]);
}
printf("sending to transceiver (%" PRIkernel_pid "): %u\n", transceiver_pid,
(*(uint8_t *)tcmd.data));
msg_send(&mesg, transceiver_pid);
}

0 comments on commit a8e83d8

Please sign in to comment.