From c55a594ef21618d2384fb7c053c6eaa6f48604eb Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Tue, 20 Nov 2018 09:56:57 +0100 Subject: portablectl: define main through macro --- src/portable/portablectl.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/portable/portablectl.c') diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 341fd14dc2..af2f84a84c 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -16,6 +16,7 @@ #include "fs-util.h" #include "locale-util.h" #include "machine-image.h" +#include "main-func.h" #include "pager.h" #include "parse-util.h" #include "path-util.h" @@ -942,8 +943,7 @@ static int parse_argv(int argc, char *argv[]) { return 1; } -int main(int argc, char *argv[]) { - +static int run(int argc, char *argv[]) { static const Verb verbs[] = { { "help", VERB_ANY, VERB_ANY, 0, help }, { "list", VERB_ANY, 1, VERB_DEFAULT, list_images }, @@ -964,12 +964,9 @@ int main(int argc, char *argv[]) { r = parse_argv(argc, argv); if (r <= 0) - goto finish; - - r = dispatch_verb(argc, argv, verbs, NULL); - -finish: - pager_close(); + return r; - return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + return dispatch_verb(argc, argv, verbs, NULL); } + +DEFINE_MAIN_FUNCTION(run); -- cgit v1.2.3