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>
This commit is contained in:
Yasushi SHOJI
2023-06-02 20:59:39 +09:00
parent b8e26388f8
commit 1d43b3c6f3
+1
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;
}