#include "json.h"
#include "locale-util.h"
#include "log.h"
+#include "main-func.h"
#include "pager.h"
#include "parse-util.h"
#include "path-util.h"
static bool arg_watch_bind = false;
static usec_t arg_timeout = 0;
+STATIC_DESTRUCTOR_REGISTER(arg_matches, strv_freep);
+
#define NAME_IS_ACQUIRED INT_TO_PTR(1)
#define NAME_IS_ACTIVATABLE INT_TO_PTR(2)
return dispatch_verb(argc, argv, verbs, NULL);
}
-int main(int argc, char *argv[]) {
+static int run(int argc, char *argv[]) {
int r;
log_parse_environment();
r = parse_argv(argc, argv);
if (r <= 0)
- goto finish;
-
- r = busctl_main(argc, argv);
-
-finish:
- /* make sure we terminate the bus connection first, and then close the
- * pager, see issue #3543 for the details. */
- pager_close();
-
- arg_matches = strv_free(arg_matches);
+ return r;
- return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+ return busctl_main(argc, argv);
}
+
+DEFINE_MAIN_FUNCTION(run);