cansequence: sort options more alphabetically

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
pull/254/head^2
Marc Kleine-Budde 2015-09-17 14:36:34 +02:00
parent 0bcb5d9c2c
commit ac9124c776
1 changed files with 29 additions and 29 deletions

View File

@ -58,14 +58,14 @@ static void print_usage(char *prg)
"The main purpose of this program is to test the reliability of CAN links.\n" "The main purpose of this program is to test the reliability of CAN links.\n"
"\n" "\n"
"Options:\n" "Options:\n"
" -e --extended send extended frame\n" " -e, --extended send extended frame\n"
" -i, --identifier=ID CAN Identifier (default = %u)\n" " -i, --identifier=ID CAN Identifier (default = %u)\n"
" -r, --receive work as receiver\n"
" --loop=COUNT send message COUNT times\n" " --loop=COUNT send message COUNT times\n"
" -p --poll use poll(2) to wait for buffer space while sending\n" " -p, --poll use poll(2) to wait for buffer space while sending\n"
" -q --quit <num> quit if <num> wrong sequences are encountered\n" " -q, --quit <num> quit if <num> wrong sequences are encountered\n"
" -r, --receive work as receiver\n"
" -v, --verbose be verbose (twice to be even more verbose\n" " -v, --verbose be verbose (twice to be even more verbose\n"
" -h --help this help\n" " -h, --help this help\n"
" --version print version information and exit\n", " --version print version information and exit\n",
prg, CAN_ID_DEFAULT); prg, CAN_ID_DEFAULT);
} }
@ -220,26 +220,38 @@ int main(int argc, char **argv)
struct option long_options[] = { struct option long_options[] = {
{ "extended", no_argument, 0, 'e' }, { "extended", no_argument, 0, 'e' },
{ "help", no_argument, 0, 'h' }, { "identifier", required_argument, 0, 'i' },
{ "loop", required_argument, 0, 'l' },
{ "poll", no_argument, 0, 'p' }, { "poll", no_argument, 0, 'p' },
{ "quit", optional_argument, 0, 'q' }, { "quit", optional_argument, 0, 'q' },
{ "receive", no_argument, 0, 'r' }, { "receive", no_argument, 0, 'r' },
{ "verbose", no_argument, 0, 'v' }, { "verbose", no_argument, 0, 'v' },
{ "version", no_argument, 0, VERSION_OPTION}, { "version", no_argument, 0, VERSION_OPTION},
{ "identifier", required_argument, 0, 'i' }, { "help", no_argument, 0, 'h' },
{ "loop", required_argument, 0, 'l' },
{ 0, 0, 0, 0}, { 0, 0, 0, 0},
}; };
while ((opt = getopt_long(argc, argv, "ehpq:rvi:l:", long_options, NULL)) != -1) { while ((opt = getopt_long(argc, argv, "ei:pq::rvh", long_options, NULL)) != -1) {
switch (opt) { switch (opt) {
case 'e': case 'e':
extended = true; extended = true;
break; break;
case 'h': case 'i':
print_usage(basename(argv[0])); filter->can_id = strtoul(optarg, NULL, 0);
exit(EXIT_SUCCESS); break;
case 'r':
receive = true;
break;
case 'l':
if (optarg) {
loopcount = strtoul(optarg, NULL, 0);
infinite = false;
} else {
infinite = true;
}
break; break;
case 'p': case 'p':
@ -253,32 +265,20 @@ int main(int argc, char **argv)
drop_until_quit = 1; drop_until_quit = 1;
break; break;
case 'r':
receive = true;
break;
case 'v': case 'v':
verbose++; verbose++;
break; break;
case 'h':
print_usage(basename(argv[0]));
exit(EXIT_SUCCESS);
break;
case VERSION_OPTION: case VERSION_OPTION:
printf("cansequence %s\n", VERSION); printf("cansequence %s\n", VERSION);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
case 'l':
if (optarg) {
loopcount = strtoul(optarg, NULL, 0);
infinite = false;
} else {
infinite = true;
}
break;
case 'i':
filter->can_id = strtoul(optarg, NULL, 0);
break;
default: default:
fprintf(stderr, "Unknown option %c\n", opt); fprintf(stderr, "Unknown option %c\n", opt);
break; break;