candump.c: Reformat help/usage output to be compatible with help2man.

Gbp-Pq: Name 0004-candump.c-Reformat-help-usage-output-to-be-compatibl.patch
pull/69/head
Alexander GQ Gerasiov 2020-04-11 13:46:56 +03:00 committed by Alexander Gerasiov
parent f4a9e5b57d
commit 6db632531d
1 changed files with 15 additions and 12 deletions

View File

@ -116,9 +116,11 @@ static volatile int running = 1;
void print_usage(char *prg) void print_usage(char *prg)
{ {
fprintf(stderr, "%s - dump CAN bus traffic.\n", prg);
fprintf(stderr, "\nUsage: %s [options] <CAN interface>+\n", prg); fprintf(stderr, "\nUsage: %s [options] <CAN interface>+\n", prg);
fprintf(stderr, " (use CTRL-C to terminate %s)\n\n", prg); fprintf(stderr, " (use CTRL-C to terminate %s)\n\n", prg);
fprintf(stderr, "Options: -t <type> (timestamp: (a)bsolute/(d)elta/(z)ero/(A)bsolute w date)\n"); fprintf(stderr, "Options:\n");
fprintf(stderr, " -t <type> (timestamp: (a)bsolute/(d)elta/(z)ero/(A)bsolute w date)\n");
fprintf(stderr, " -H (read hardware timestamps instead of system timestamps)\n"); fprintf(stderr, " -H (read hardware timestamps instead of system timestamps)\n");
fprintf(stderr, " -c (increment color mode level)\n"); fprintf(stderr, " -c (increment color mode level)\n");
fprintf(stderr, " -i (binary output - may exceed 80 chars/line)\n"); fprintf(stderr, " -i (binary output - may exceed 80 chars/line)\n");
@ -137,22 +139,23 @@ void print_usage(char *prg)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK); fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n"); fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
fprintf(stderr, "\nComma separated filters can be specified for each given CAN interface:\n"); fprintf(stderr, "\nFilters:\n");
fprintf(stderr, " <can_id>:<can_mask> (matches when <received_can_id> & mask == can_id & mask)\n"); fprintf(stderr, " Comma separated filters can be specified for each given CAN interface:\n");
fprintf(stderr, " <can_id>~<can_mask> (matches when <received_can_id> & mask != can_id & mask)\n"); fprintf(stderr, "<can_id>:<can_mask>\n\t(matches when <received_can_id> & mask == can_id & mask)\n");
fprintf(stderr, " #<error_mask> (set error frame filter, see include/linux/can/error.h)\n"); fprintf(stderr, "<can_id>~<can_mask>\n\t(matches when <received_can_id> & mask != can_id & mask)\n");
fprintf(stderr, " [j|J] (join the given CAN filters - logical AND semantic)\n"); fprintf(stderr, "#<error_mask>\n\t(set error frame filter, see include/linux/can/error.h)\n");
fprintf(stderr, "[j|J]\n\t(join the given CAN filters - logical AND semantic)\n");
fprintf(stderr, "\nCAN IDs, masks and data content are given and expected in hexadecimal values.\n"); fprintf(stderr, "\nCAN IDs, masks and data content are given and expected in hexadecimal values.\n");
fprintf(stderr, "When the can_id is 8 digits long the CAN_EFF_FLAG is set for 29 bit EFF format.\n"); fprintf(stderr, "When the can_id is 8 digits long the CAN_EFF_FLAG is set for 29 bit EFF format.\n");
fprintf(stderr, "Without any given filter all data frames are received ('0:0' default filter).\n"); fprintf(stderr, "Without any given filter all data frames are received ('0:0' default filter).\n");
fprintf(stderr, "\nUse interface name '%s' to receive from all CAN interfaces.\n", ANYDEV); fprintf(stderr, "\nUse interface name '%s' to receive from all CAN interfaces.\n", ANYDEV);
fprintf(stderr, "\nExamples:\n"); fprintf(stderr, "\nExamples:\n");
fprintf(stderr, "%s -c -c -ta can0,123:7FF,400:700,#000000FF can2,400~7F0 can3 can8\n", prg); fprintf(stderr, "%s -c -c -ta can0,123:7FF,400:700,#000000FF can2,400~7F0 can3 can8\n\n", prg);
fprintf(stderr, "%s -l any,0~0,#FFFFFFFF (log only error frames but no(!) data frames)\n", prg); fprintf(stderr, "%s -l any,0~0,#FFFFFFFF\n\t(log only error frames but no(!) data frames)\n", prg);
fprintf(stderr, "%s -l any,0:0,#FFFFFFFF (log error frames and also all data frames)\n", prg); fprintf(stderr, "%s -l any,0:0,#FFFFFFFF\n\t(log error frames and also all data frames)\n", prg);
fprintf(stderr, "%s vcan2,12345678:DFFFFFFF (match only for extended CAN ID 12345678)\n", prg); fprintf(stderr, "%s vcan2,12345678:DFFFFFFF\n\t(match only for extended CAN ID 12345678)\n", prg);
fprintf(stderr, "%s vcan2,123:7FF (matches CAN ID 123 - including EFF and RTR frames)\n", prg); fprintf(stderr, "%s vcan2,123:7FF\n\t(matches CAN ID 123 - including EFF and RTR frames)\n", prg);
fprintf(stderr, "%s vcan2,123:C00007FF (matches CAN ID 123 - only SFF and non-RTR frames)\n", prg); fprintf(stderr, "%s vcan2,123:C00007FF\n\t(matches CAN ID 123 - only SFF and non-RTR frames)\n", prg);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }