]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
analyze: split out "unit-paths" verb
authorLennart Poettering <lennart@poettering.net>
Mon, 21 Feb 2022 12:47:38 +0000 (13:47 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 21 Feb 2022 16:22:23 +0000 (17:22 +0100)
src/analyze/analyze-unit-paths.c [new file with mode: 0644]
src/analyze/analyze-unit-paths.h [new file with mode: 0644]
src/analyze/analyze.c
src/analyze/meson.build

diff --git a/src/analyze/analyze-unit-paths.c b/src/analyze/analyze-unit-paths.c
new file mode 100644 (file)
index 0000000..f18a10e
--- /dev/null
@@ -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;
+}
diff --git a/src/analyze/analyze-unit-paths.h b/src/analyze/analyze-unit-paths.h
new file mode 100644 (file)
index 0000000..c3c5156
--- /dev/null
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+int dump_unit_paths(int argc, char *argv[], void *userdata);
index b1eb51ce7d32a111affabd2034b5fbbe8078a113..3f48b06037b20e8439b784041b2ead3e52391d31 100644 (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. "
index 022b0749b7cc20a8a81c10ef7c87995be94451c5..a2bbf5cbfdbbcfb80be0416427d7f1eed05fe496 100644 (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