3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

client: Change semantics of return value from command_init

Instead of returning the mode of execution, command_init now
returns whether we are done and need to exit.

Thereafter, the mode of execution is now obtain though the command
module’s API.
This commit is contained in:
Tim Kourt 2019-09-17 14:09:11 -07:00 committed by Denis Kenzior
parent 0d900cf250
commit 8be98d6149
2 changed files with 9 additions and 10 deletions

View File

@ -677,7 +677,7 @@ bool command_init(char **argv, int argc)
case '?': case '?':
exit_status = EXIT_FAILURE; exit_status = EXIT_FAILURE;
return false; return true;
} }
} }
@ -687,7 +687,7 @@ options_parsed:
if (argc < 2) { if (argc < 2) {
interactive_mode = true; interactive_mode = true;
return true; return false;
} }
command_noninteractive.argv = argv; command_noninteractive.argv = argv;

View File

@ -46,20 +46,18 @@ static void signal_handler(uint32_t signo, void *user_data)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int exit_status; int exit_status;
bool interactive; bool all_done;
if (!l_main_init()) if (!l_main_init())
return EXIT_FAILURE; return EXIT_FAILURE;
l_log_set_stderr(); l_log_set_stderr();
interactive = command_init(argv, argc); all_done = command_init(argv, argc);
if (all_done)
exit_status = command_get_exit_status();
if (exit_status)
goto done; goto done;
if (interactive) if (command_is_interactive_mode())
display_init(); display_init();
dbus_proxy_init(); dbus_proxy_init();
@ -68,11 +66,12 @@ int main(int argc, char *argv[])
dbus_proxy_exit(); dbus_proxy_exit();
if (interactive) if (command_is_interactive_mode())
display_exit(); display_exit();
exit_status = command_get_exit_status();
done: done:
exit_status = command_get_exit_status();
command_exit(); command_exit();
l_main_exit(); l_main_exit();