From: Zbigniew Jędrzejewski-Szmek Date: Tue, 20 Nov 2018 08:56:57 +0000 (+0100) Subject: portablectl: define main through macro X-Git-Tag: v240~258^2~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c55a594ef21618d2384fb7c053c6eaa6f48604eb;p=thirdparty%2Fsystemd.git portablectl: define main through macro --- diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 341fd14dc24..af2f84a84cc 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);