forked from Archive/PX4-Autopilot
Merge branch 'getopt_fixes' into sdlog2_opt
This commit is contained in:
commit
544de3c9f0
|
@ -670,6 +670,10 @@ int sdlog2_thread_main(int argc, char *argv[])
|
||||||
argv += 2;
|
argv += 2;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
|
/* don't exit from getopt loop to leave getopt global variables in consistent state,
|
||||||
|
* set error flag instead */
|
||||||
|
bool err_flag = false;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "r:b:eat")) != EOF) {
|
while ((ch = getopt(argc, argv, "r:b:eat")) != EOF) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'r': {
|
case 'r': {
|
||||||
|
@ -716,13 +720,20 @@ int sdlog2_thread_main(int argc, char *argv[])
|
||||||
} else {
|
} else {
|
||||||
warnx("unknown option character `\\x%x'", optopt);
|
warnx("unknown option character `\\x%x'", optopt);
|
||||||
}
|
}
|
||||||
|
err_flag = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sdlog2_usage("unrecognized flag");
|
warnx("unrecognized flag");
|
||||||
errx(1, "exiting");
|
err_flag = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (err_flag) {
|
||||||
|
sdlog2_usage(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
gps_time = 0;
|
gps_time = 0;
|
||||||
|
|
||||||
/* create log root dir */
|
/* create log root dir */
|
||||||
|
|
Loading…
Reference in New Issue