1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-28 21:47:38 +03:00

portablectl: define main through macro

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-11-20 09:56:57 +01:00
parent 39daad0a81
commit c55a594ef2

View File

@ -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;
return r;
r = dispatch_verb(argc, argv, verbs, NULL);
finish:
pager_close();
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
return dispatch_verb(argc, argv, verbs, NULL);
}
DEFINE_MAIN_FUNCTION(run);