canbusload: Enhance error message for missing bitrate

When canbusload is executed without bit rate, it exits with an exit
code of 1 and prints help, but without explaining why.  Users cannot
know what was wrong.  When other errors occur, though, canbusload
prints an error message along with the help.

Print an error message when bit rate is not given or "@" is not found.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
pull/424/head
Yasushi SHOJI 2023-04-06 16:24:01 +09:00
parent b8e26388f8
commit 1d43b3c6f3
1 changed files with 1 additions and 0 deletions

View File

@ -325,6 +325,7 @@ int main(int argc, char **argv)
nptr = strchr(ptr, '@');
if (!nptr) {
fprintf(stderr, "Specify CAN interfaces in the form <CAN interface>@<bitrate>, e.g. can0@500000\n");
print_usage(prg);
return 1;
}