1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <stdbool.h>
5
6 #include "bus-print-properties.h"
7 #include "bus-util.h"
8 #include "install.h"
9 #include "output-mode.h"
10 #include "pager.h"
11
12 enum action {
13 ACTION_SYSTEMCTL,
14 ACTION_HALT,
15 ACTION_POWEROFF,
16 ACTION_REBOOT,
17 ACTION_KEXEC,
18 ACTION_EXIT,
19 ACTION_SUSPEND,
20 ACTION_HIBERNATE,
21 ACTION_HYBRID_SLEEP,
22 ACTION_SUSPEND_THEN_HIBERNATE,
23 ACTION_RUNLEVEL2,
24 ACTION_RUNLEVEL3,
25 ACTION_RUNLEVEL4,
26 ACTION_RUNLEVEL5,
27 ACTION_RESCUE,
28 ACTION_EMERGENCY,
29 ACTION_DEFAULT,
30 ACTION_RELOAD,
31 ACTION_REEXEC,
32 ACTION_RUNLEVEL,
33 ACTION_TELINIT,
34 ACTION_CANCEL_SHUTDOWN,
35 ACTION_SHOW_SHUTDOWN,
36 _ACTION_MAX,
37 _ACTION_INVALID = -EINVAL,
38 };
39
40 enum dependency {
41 DEPENDENCY_FORWARD,
42 DEPENDENCY_REVERSE,
43 DEPENDENCY_AFTER,
44 DEPENDENCY_BEFORE,
45 _DEPENDENCY_MAX
46 };
47
48 extern char **arg_types;
49 extern char **arg_states;
50 extern char **arg_properties;
51 extern bool arg_all;
52 extern enum dependency arg_dependency;
53 extern const char *_arg_job_mode;
54 extern LookupScope arg_scope;
55 extern bool arg_wait;
56 extern bool arg_no_block;
57 extern int arg_legend;
58 extern PagerFlags arg_pager_flags;
59 extern bool arg_no_wtmp;
60 extern bool arg_no_sync;
61 extern bool arg_no_wall;
62 extern bool arg_no_reload;
63 extern BusPrintPropertyFlags arg_print_flags;
64 extern bool arg_show_types;
65 extern int arg_check_inhibitors;
66 extern bool arg_dry_run;
67 extern bool arg_quiet;
68 extern bool arg_full;
69 extern bool arg_recursive;
70 extern bool arg_with_dependencies;
71 extern bool arg_show_transaction;
72 extern int arg_force;
73 extern bool arg_ask_password;
74 extern bool arg_runtime;
75 extern UnitFilePresetMode arg_preset_mode;
76 extern char **arg_wall;
77 extern const char *arg_kill_who;
78 extern int arg_signal;
79 extern char *arg_root;
80 extern usec_t arg_when;
81 extern const char *arg_reboot_argument;
82 extern enum action arg_action;
83 extern BusTransport arg_transport;
84 extern const char *arg_host;
85 extern unsigned arg_lines;
86 extern OutputMode arg_output;
87 extern bool arg_plain;
88 extern bool arg_firmware_setup;
89 extern usec_t arg_boot_loader_menu;
90 extern const char *arg_boot_loader_entry;
91 extern bool arg_now;
92 extern bool arg_jobs_before;
93 extern bool arg_jobs_after;
94 extern char **arg_clean_what;
95 extern TimestampStyle arg_timestamp_style;
96 extern bool arg_read_only;
97 extern bool arg_mkdir;
98 extern bool arg_marked;
99
arg_job_mode(void)100 static inline const char* arg_job_mode(void) {
101 return _arg_job_mode ?: "replace";
102 }
103
104 int systemctl_dispatch_parse_argv(int argc, char *argv[]);
105