mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 10:26:52 +08:00
fixedwing_control: avoid using exit()
This commit is contained in:
@@ -450,7 +450,6 @@ usage(const char *reason)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "usage: ex_fixedwing_control {start|stop|status}\n\n");
|
fprintf(stderr, "usage: ex_fixedwing_control {start|stop|status}\n\n");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -465,6 +464,7 @@ int ex_fixedwing_control_main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
usage("missing command");
|
usage("missing command");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(argv[1], "start")) {
|
if (!strcmp(argv[1], "start")) {
|
||||||
@@ -472,7 +472,7 @@ int ex_fixedwing_control_main(int argc, char *argv[])
|
|||||||
if (thread_running) {
|
if (thread_running) {
|
||||||
printf("ex_fixedwing_control already running\n");
|
printf("ex_fixedwing_control already running\n");
|
||||||
/* this is not an error */
|
/* this is not an error */
|
||||||
exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_should_exit = false;
|
thread_should_exit = false;
|
||||||
@@ -483,12 +483,12 @@ int ex_fixedwing_control_main(int argc, char *argv[])
|
|||||||
fixedwing_control_thread_main,
|
fixedwing_control_thread_main,
|
||||||
(argv) ? (char *const *)&argv[2] : (char *const *)nullptr);
|
(argv) ? (char *const *)&argv[2] : (char *const *)nullptr);
|
||||||
thread_running = true;
|
thread_running = true;
|
||||||
exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(argv[1], "stop")) {
|
if (!strcmp(argv[1], "stop")) {
|
||||||
thread_should_exit = true;
|
thread_should_exit = true;
|
||||||
exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(argv[1], "status")) {
|
if (!strcmp(argv[1], "status")) {
|
||||||
@@ -499,9 +499,9 @@ int ex_fixedwing_control_main(int argc, char *argv[])
|
|||||||
printf("\tex_fixedwing_control not started\n");
|
printf("\tex_fixedwing_control not started\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
usage("unrecognized command");
|
usage("unrecognized command");
|
||||||
exit(1);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user