summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-20 09:56:57 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-20 16:48:21 +0100
commitc55a594ef21618d2384fb7c053c6eaa6f48604eb (patch)
tree3257add66835cd8c6dc1079dbdab3a05cb8a400e
parent39daad0a8134e9c7584b717fc9e13f0da70a7aed (diff)
downloadsystemd-c55a594ef21618d2384fb7c053c6eaa6f48604eb.tar.gz
portablectl: define main through macro
-rw-r--r--src/portable/portablectl.c15
1 files changed, 6 insertions, 9 deletions
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);