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

Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0005-canfdtest.c-Reformat-help-usage-output-to-be-compati.patch
pull/69/head
Alexander Gerasiov 2018-02-11 19:03:05 +03:00 committed by Alexander Gerasiov
parent 6db632531d
commit c56259ab33
1 changed files with 11 additions and 6 deletions

View File

@ -52,9 +52,11 @@ static int exit_sig;
static void print_usage(char *prg) static void print_usage(char *prg)
{ {
fprintf(stderr, fprintf(stderr,
"%s - Full-duplex test program (DUT and host part).\n"
"Usage: %s [options] <can-interface>\n" "Usage: %s [options] <can-interface>\n"
"\n" "\n"
"Options: -v (low verbosity)\n" "Options:\n"
" -v (low verbosity)\n"
" -vv (high verbosity)\n" " -vv (high verbosity)\n"
" -g (generate messages)\n" " -g (generate messages)\n"
" -l COUNT (test loop count)\n" " -l COUNT (test loop count)\n"
@ -64,10 +66,12 @@ static void print_usage(char *prg)
"<can-interface> are sent back incrementing the CAN id and\n" "<can-interface> are sent back incrementing the CAN id and\n"
"all data bytes. The program can be aborted with ^C.\n" "all data bytes. The program can be aborted with ^C.\n"
"\n" "\n"
"Example:\n" "Examples:\n"
"\ton DUT : %s -v can0\n" "\ton DUT:\n"
"\ton Host: %s -g -v can2\n", "%s -v can0\n"
prg, prg, prg); "\ton Host:\n"
"%s -g -v can2\n",
prg, prg, prg, prg);
exit(1); exit(1);
} }
@ -320,7 +324,7 @@ int main(int argc, char *argv[])
signal(SIGHUP, signal_handler); signal(SIGHUP, signal_handler);
signal(SIGINT, signal_handler); signal(SIGINT, signal_handler);
while ((opt = getopt(argc, argv, "gl:v")) != -1) { while ((opt = getopt(argc, argv, "gl:v?")) != -1) {
switch (opt) { switch (opt) {
case 'v': case 'v':
verbose++; verbose++;
@ -334,6 +338,7 @@ int main(int argc, char *argv[])
echo_gen = 1; echo_gen = 1;
break; break;
case '?':
default: default:
print_usage(basename(argv[0])); print_usage(basename(argv[0]));
break; break;