analyze: split out "unit-paths" verb

This commit is contained in:
Lennart Poettering
2022-02-21 17:22:23 +01:00
parent faaa6ea076
commit 36258fbe74
4 changed files with 28 additions and 15 deletions
+21
View File
@@ -0,0 +1,21 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "analyze.h"
#include "analyze-unit-paths.h"
#include "path-lookup.h"
#include "strv.h"
int dump_unit_paths(int argc, char *argv[], void *userdata) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
int r;
char **p;
r = lookup_paths_init(&paths, arg_scope, 0, NULL);
if (r < 0)
return log_error_errno(r, "lookup_paths_init() failed: %m");
STRV_FOREACH(p, paths.search_path)
puts(*p);
return 0;
}
+4
View File
@@ -0,0 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
int dump_unit_paths(int argc, char *argv[], void *userdata);
+1 -15
View File
@@ -31,6 +31,7 @@
#include "analyze-time-data.h"
#include "analyze-timespan.h"
#include "analyze-timestamp.h"
#include "analyze-unit-paths.h"
#include "analyze-verify.h"
#include "bus-error.h"
#include "bus-locator.h"
@@ -482,21 +483,6 @@ static int do_unit_files(int argc, char *argv[], void *userdata) {
return 0;
}
static int dump_unit_paths(int argc, char *argv[], void *userdata) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
int r;
char **p;
r = lookup_paths_init(&paths, arg_scope, 0, NULL);
if (r < 0)
return log_error_errno(r, "lookup_paths_init() failed: %m");
STRV_FOREACH(p, paths.search_path)
puts(*p);
return 0;
}
void time_parsing_hint(const char *p, bool calendar, bool timestamp, bool timespan) {
if (calendar && calendar_spec_from_string(p, NULL) >= 0)
log_notice("Hint: this expression is a valid calendar specification. "
+2
View File
@@ -37,6 +37,8 @@ systemd_analyze_sources = files('''
analyze-timespan.h
analyze-timestamp.c
analyze-timestamp.h
analyze-unit-paths.c
analyze-unit-paths.h
analyze-verify.c
analyze-verify.h
analyze.c