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 '?':
exit_status = EXIT_FAILURE;
return false;
return true;
}
}
@ -687,7 +687,7 @@ options_parsed:
if (argc < 2) {
interactive_mode = true;
return true;
return false;
}
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 exit_status;
bool interactive;
bool all_done;
if (!l_main_init())
return EXIT_FAILURE;
l_log_set_stderr();
interactive = command_init(argv, argc);
exit_status = command_get_exit_status();
if (exit_status)
all_done = command_init(argv, argc);
if (all_done)
goto done;
if (interactive)
if (command_is_interactive_mode())
display_init();
dbus_proxy_init();
@ -68,11 +66,12 @@ int main(int argc, char *argv[])
dbus_proxy_exit();
if (interactive)
if (command_is_interactive_mode())
display_exit();
exit_status = command_get_exit_status();
done:
exit_status = command_get_exit_status();
command_exit();
l_main_exit();