Skip to content
Snippets Groups Projects
Commit 50cdb011 authored by Beat Küng's avatar Beat Küng
Browse files

rover_steering_control: avoid using exit()

parent 258f7a7f
No related branches found
No related tags found
No related merge requests found
......@@ -395,7 +395,6 @@ usage(const char *reason)
}
fprintf(stderr, "usage: rover_steering_control {start|stop|status}\n\n");
exit(1);
}
/**
......@@ -410,6 +409,7 @@ int rover_steering_control_main(int argc, char *argv[])
{
if (argc < 2) {
usage("missing command");
return 1;
}
if (!strcmp(argv[1], "start")) {
......@@ -417,7 +417,7 @@ int rover_steering_control_main(int argc, char *argv[])
if (thread_running) {
warnx("running");
/* this is not an error */
exit(0);
return 0;
}
thread_should_exit = false;
......@@ -428,12 +428,12 @@ int rover_steering_control_main(int argc, char *argv[])
rover_steering_control_thread_main,
(argv) ? (char *const *)&argv[2] : (char *const *)nullptr);
thread_running = true;
exit(0);
return 0;
}
if (!strcmp(argv[1], "stop")) {
thread_should_exit = true;
exit(0);
return 0;
}
if (!strcmp(argv[1], "status")) {
......@@ -444,11 +444,11 @@ int rover_steering_control_main(int argc, char *argv[])
warnx("not started");
}
exit(0);
return 0;
}
usage("unrecognized command");
exit(1);
return 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment