mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-08 21:17:47 +03:00
Merge pull request #10753 from keszybz/pager-no-interrupt
Add mode in journalctl where ^C is handled by the pager
This commit is contained in:
commit
042cad5737
@ -291,8 +291,9 @@
|
||||
<listitem><para>Dump messages being exchanged. If
|
||||
<replaceable>SERVICE</replaceable> is specified, show messages
|
||||
to or from this peer, identified by its well-known or unique
|
||||
name. Otherwise, show all messages on the bus. Use Ctrl-C to
|
||||
terminate the dump.</para></listitem>
|
||||
name. Otherwise, show all messages on the bus. Use
|
||||
<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo>
|
||||
to terminate the dump.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
@ -26,7 +26,13 @@
|
||||
<term><varname>$SYSTEMD_LESS</varname></term>
|
||||
|
||||
<listitem><para>Override the options passed to <command>less</command> (by default
|
||||
<literal>FRSXMK</literal>).</para></listitem>
|
||||
<literal>FRSXMK</literal>).</para>
|
||||
|
||||
<para>If the value of <varname>$SYSTEMD_LESS</varname> does not include <literal>K</literal>,
|
||||
and the pager that is invoked is <command>less</command>,
|
||||
<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo> will be ignored by the
|
||||
executable. This allows <command>less</command> to handle
|
||||
<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo> itself.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id='lesscharset'>
|
||||
|
@ -580,16 +580,15 @@
|
||||
<varlistentry>
|
||||
<term><constant>SIGINT</constant></term>
|
||||
|
||||
<listitem><para>Upon receiving this signal the systemd system
|
||||
manager will start the
|
||||
<filename>ctrl-alt-del.target</filename> unit. This is mostly
|
||||
equivalent to <command>systemctl start ctrl-alt-del.target
|
||||
--job-mode=replace-irreversible</command>. If this signal is
|
||||
received more than 7 times per 2s, an immediate reboot is
|
||||
triggered. Note that pressing Ctrl-Alt-Del on the console
|
||||
will trigger this signal. Hence, if a reboot is hanging,
|
||||
pressing Ctrl-Alt-Del more than 7 times in 2s is a relatively
|
||||
safe way to trigger an immediate reboot.</para>
|
||||
<listitem><para>Upon receiving this signal the systemd system manager will start the
|
||||
<filename>ctrl-alt-del.target</filename> unit. This is mostly equivalent to
|
||||
<command>systemctl start ctrl-alt-del.target --job-mode=replace-irreversible</command>. If
|
||||
this signal is received more than 7 times per 2s, an immediate reboot is triggered. Note
|
||||
that pressing
|
||||
<keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Del</keycap></keycombo> on the
|
||||
console will trigger this signal. Hence, if a reboot is hanging, pressing
|
||||
<keycombo><keycap>Ctrl</keycap><keycap>Alt</keycap><keycap>Del</keycap></keycombo> more than
|
||||
7 times in 2 seconds is a relatively safe way to trigger an immediate reboot.</para>
|
||||
|
||||
<para>systemd user managers treat this signal the same way as
|
||||
<constant>SIGTERM</constant>.</para></listitem>
|
||||
|
@ -73,10 +73,11 @@
|
||||
<varlistentry>
|
||||
<term><option>--monitor</option></term>
|
||||
|
||||
<listitem><para>If <command>timesync-status</command> is invoked and this option is passed,
|
||||
then <command>timedatectl</command> monitors the status of
|
||||
<listitem><para>If <command>timesync-status</command> is invoked and this option is passed, then
|
||||
<command>timedatectl</command> monitors the status of
|
||||
<citerefentry><refentrytitle>systemd-timesyncd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
and updates the outputs. Use Ctrl-C to terminate the monitoring.</para></listitem>
|
||||
and updates the outputs. Use <keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo> to terminate the
|
||||
monitoring.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
@ -66,7 +66,7 @@ static enum dot {
|
||||
static char** arg_dot_from_patterns = NULL;
|
||||
static char** arg_dot_to_patterns = NULL;
|
||||
static usec_t arg_fuzz = 0;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
|
||||
static const char *arg_host = NULL;
|
||||
static UnitFileScope arg_scope = UNIT_FILE_SYSTEM;
|
||||
@ -1023,7 +1023,7 @@ static int analyze_critical_chain(int argc, char *argv[], void *userdata) {
|
||||
}
|
||||
unit_times_hashmap = h;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
puts("The time after the unit is active or started is printed after the \"@\" character.\n"
|
||||
"The time the unit takes to start is printed after the \"+\" character.\n");
|
||||
@ -1055,7 +1055,7 @@ static int analyze_blame(int argc, char *argv[], void *userdata) {
|
||||
|
||||
typesafe_qsort(times, n, compare_unit_time);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
for (u = times; u->has_data; u++) {
|
||||
char ts[FORMAT_TIMESPAN_MAX];
|
||||
@ -1303,7 +1303,7 @@ static int dump(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create bus connection: %m");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (!sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD))
|
||||
return dump_fallback(bus);
|
||||
@ -1337,7 +1337,7 @@ static int cat_config(int argc, char *argv[], void *userdata) {
|
||||
char **arg;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
STRV_FOREACH(arg, argv + 1) {
|
||||
const char *t = NULL;
|
||||
@ -1509,7 +1509,7 @@ static void dump_syscall_filter(const SyscallFilterSet *set) {
|
||||
static int dump_syscall_filters(int argc, char *argv[], void *userdata) {
|
||||
bool first = true;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (strv_isempty(strv_skip(argv, 1))) {
|
||||
int i;
|
||||
@ -1696,7 +1696,7 @@ static int help(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = terminal_urlify_man("systemd-analyze", "1", &link);
|
||||
if (r < 0)
|
||||
@ -1841,7 +1841,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "sd-device.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "device-util.h"
|
||||
#include "escape.h"
|
||||
#include "fileio.h"
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "def.h"
|
||||
#include "hashmap.h"
|
||||
#include "macro.h"
|
||||
#include "set.h"
|
||||
|
||||
#define SYSTEMD_CGROUP_CONTROLLER_LEGACY "name=systemd"
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "clock-util.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "macro.h"
|
||||
|
@ -74,6 +74,4 @@
|
||||
"/usr/lib/" n \
|
||||
_CONF_PATHS_SPLIT_USR(n))
|
||||
|
||||
#define LONG_LINE_MAX (1U*1024U*1024U)
|
||||
|
||||
#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "conf-files.h"
|
||||
#include "def.h"
|
||||
#include "env-util.h"
|
||||
#include "exec-util.h"
|
||||
#include "fd-util.h"
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "ctype.h"
|
||||
#include "def.h"
|
||||
#include "env-util.h"
|
||||
#include "escape.h"
|
||||
#include "fd-util.h"
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "macro.h"
|
||||
#include "time-util.h"
|
||||
|
||||
#define LONG_LINE_MAX (1U*1024U*1024U)
|
||||
|
||||
typedef enum {
|
||||
WRITE_STRING_FILE_CREATE = 1 << 0,
|
||||
WRITE_STRING_FILE_ATOMIC = 1 << 1,
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "hostname-util.h"
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <libmount.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "escape.h"
|
||||
#include "extract-word.h"
|
||||
#include "fd-util.h"
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#include "copy.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "io-util.h"
|
||||
#include "locale-util.h"
|
||||
#include "log.h"
|
||||
#include "macro.h"
|
||||
@ -41,13 +43,50 @@ _noreturn_ static void pager_fallback(void) {
|
||||
_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
int pager_open(bool no_pager, bool jump_to_end) {
|
||||
_cleanup_close_pair_ int fd[2] = { -1, -1 };
|
||||
_cleanup_strv_free_ char **pager_args = NULL;
|
||||
const char *pager;
|
||||
static int no_quit_on_interrupt(int exe_name_fd, const char *less_opts) {
|
||||
_cleanup_fclose_ FILE *file = NULL;
|
||||
_cleanup_free_ char *line = NULL;
|
||||
int r;
|
||||
|
||||
if (no_pager)
|
||||
assert(exe_name_fd >= 0);
|
||||
assert(less_opts);
|
||||
|
||||
/* This takes ownership of exe_name_fd */
|
||||
file = fdopen(exe_name_fd, "r");
|
||||
if (!file) {
|
||||
safe_close(exe_name_fd);
|
||||
return log_debug_errno(errno, "Failed to create FILE object: %m");
|
||||
}
|
||||
|
||||
/* Find the last line */
|
||||
for (;;) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
r = read_line(file, LONG_LINE_MAX, &t);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
free_and_replace(line, t);
|
||||
}
|
||||
|
||||
/* We only treat "less" specially.
|
||||
* Return true whenever option K is *not* set. */
|
||||
r = streq_ptr(line, "less") && !strchr(less_opts, 'K');
|
||||
|
||||
log_debug("Pager executable is \"%s\", options \"%s\", quit_on_interrupt: %s",
|
||||
strnull(line), less_opts, yes_no(!r));
|
||||
return r;
|
||||
}
|
||||
|
||||
int pager_open(PagerFlags flags) {
|
||||
_cleanup_close_pair_ int fd[2] = { -1, -1 }, exe_name_pipe[2] = { -1, -1 };
|
||||
_cleanup_strv_free_ char **pager_args = NULL;
|
||||
const char *pager, *less_opts;
|
||||
int r;
|
||||
|
||||
if (flags & PAGER_DISABLE)
|
||||
return 0;
|
||||
|
||||
if (pager_pid > 0)
|
||||
@ -81,23 +120,28 @@ int pager_open(bool no_pager, bool jump_to_end) {
|
||||
if (pipe2(fd, O_CLOEXEC) < 0)
|
||||
return log_error_errno(errno, "Failed to create pager pipe: %m");
|
||||
|
||||
/* This is a pipe to feed the name of the executed pager binary into the parent */
|
||||
if (pipe2(exe_name_pipe, O_CLOEXEC) < 0)
|
||||
return log_error_errno(errno, "Failed to create exe_name pipe: %m");
|
||||
|
||||
/* Initialize a good set of less options */
|
||||
less_opts = getenv("SYSTEMD_LESS");
|
||||
if (!less_opts)
|
||||
less_opts = "FRSXMK";
|
||||
if (flags & PAGER_JUMP_TO_END)
|
||||
less_opts = strjoina(less_opts, " +G");
|
||||
|
||||
r = safe_fork("(pager)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pager_pid);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0) {
|
||||
const char* less_opts, *less_charset;
|
||||
const char *less_charset, *exe;
|
||||
|
||||
/* In the child start the pager */
|
||||
|
||||
(void) dup2(fd[0], STDIN_FILENO);
|
||||
safe_close_pair(fd);
|
||||
|
||||
/* Initialize a good set of less options */
|
||||
less_opts = getenv("SYSTEMD_LESS");
|
||||
if (!less_opts)
|
||||
less_opts = "FRSXMK";
|
||||
if (jump_to_end)
|
||||
less_opts = strjoina(less_opts, " +G");
|
||||
if (setenv("LESS", less_opts, 1) < 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
@ -111,8 +155,12 @@ int pager_open(bool no_pager, bool jump_to_end) {
|
||||
setenv("LESSCHARSET", less_charset, 1) < 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
if (pager_args)
|
||||
if (pager_args) {
|
||||
if (loop_write(exe_name_pipe[1], pager_args[0], strlen(pager_args[0]) + 1, false) < 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
|
||||
execvp(pager_args[0], pager_args);
|
||||
}
|
||||
|
||||
/* Debian's alternatives command for pagers is
|
||||
* called 'pager'. Note that we do not call
|
||||
@ -120,11 +168,14 @@ int pager_open(bool no_pager, bool jump_to_end) {
|
||||
* shell script that implements a logic that
|
||||
* is similar to this one anyway, but is
|
||||
* Debian-specific. */
|
||||
execlp("pager", "pager", NULL);
|
||||
|
||||
execlp("less", "less", NULL);
|
||||
execlp("more", "more", NULL);
|
||||
FOREACH_STRING(exe, "pager", "less", "more") {
|
||||
if (loop_write(exe_name_pipe[1], exe, strlen(exe) + 1, false) < 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
execlp(exe, exe, NULL);
|
||||
}
|
||||
|
||||
if (loop_write(exe_name_pipe[1], "(built-in)", strlen("(built-in") + 1, false) < 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
pager_fallback();
|
||||
/* not reached */
|
||||
}
|
||||
@ -144,6 +195,14 @@ int pager_open(bool no_pager, bool jump_to_end) {
|
||||
}
|
||||
stderr_redirected = true;
|
||||
|
||||
exe_name_pipe[1] = safe_close(exe_name_pipe[1]);
|
||||
|
||||
r = no_quit_on_interrupt(TAKE_FD(exe_name_pipe[0]), less_opts);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r > 0)
|
||||
(void) ignore_signals(SIGINT, -1);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,12 @@
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
int pager_open(bool no_pager, bool jump_to_end);
|
||||
typedef enum PagerFlags {
|
||||
PAGER_DISABLE = 1 << 0,
|
||||
PAGER_JUMP_TO_END = 1 << 1,
|
||||
} PagerFlags;
|
||||
|
||||
int pager_open(PagerFlags flags);
|
||||
void pager_close(void);
|
||||
bool pager_have(void) _pure_;
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "architecture.h"
|
||||
#include "def.h"
|
||||
#include "escape.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "dirent-util.h"
|
||||
#include "def.h"
|
||||
#include "env-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "util.h"
|
||||
|
||||
static bool arg_cat_config = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
|
||||
static int delete_rule(const char *rule) {
|
||||
_cleanup_free_ char *x = NULL, *fn = NULL;
|
||||
@ -160,7 +160,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
@ -212,7 +212,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (arg_cat_config) {
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = cat_files(NULL, files, 0);
|
||||
goto finish;
|
||||
|
@ -45,7 +45,7 @@
|
||||
static char *arg_path = NULL;
|
||||
static bool arg_print_path = false;
|
||||
static bool arg_touch_variables = true;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
|
||||
static int acquire_esp(
|
||||
bool unprivileged_mode,
|
||||
@ -923,7 +923,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
@ -965,7 +965,7 @@ static int verb_status(int argc, char *argv[], void *userdata) {
|
||||
r = 0; /* If we couldn't determine the path, then don't consider that a problem from here on, just show what we
|
||||
* can show */
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (is_efi_boot()) {
|
||||
_cleanup_free_ char *fw_type = NULL, *fw_info = NULL, *loader = NULL, *loader_path = NULL, *stub = NULL;
|
||||
@ -1054,7 +1054,7 @@ static int verb_list(int argc, char *argv[], void *userdata) {
|
||||
else {
|
||||
size_t n;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
printf("Boot Loader Entries:\n");
|
||||
|
||||
|
@ -33,7 +33,7 @@ static enum {
|
||||
JSON_SHORT,
|
||||
JSON_PRETTY,
|
||||
} arg_json = JSON_OFF;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_legend = true;
|
||||
static const char *arg_address = NULL;
|
||||
static bool arg_unique = false;
|
||||
@ -155,7 +155,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to list names: %m");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
names = hashmap_new(&string_hash_ops);
|
||||
if (!names)
|
||||
@ -470,7 +470,7 @@ static int tree_one(sd_bus *bus, const char *service, const char *prefix, bool m
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
l = set_get_strv(done);
|
||||
if (!l)
|
||||
@ -504,7 +504,7 @@ static int tree(int argc, char **argv, void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get name list: %m");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
STRV_FOREACH(i, names) {
|
||||
int q;
|
||||
@ -534,7 +534,7 @@ static int tree(int argc, char **argv, void *userdata) {
|
||||
printf("\n");
|
||||
|
||||
if (argv[2]) {
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_normal());
|
||||
}
|
||||
|
||||
@ -1033,7 +1033,7 @@ static int introspect(int argc, char **argv, void *userdata) {
|
||||
return bus_log_parse_error(r);
|
||||
}
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
name_width = STRLEN("NAME");
|
||||
type_width = STRLEN("TYPE");
|
||||
@ -1967,7 +1967,7 @@ static int call(int argc, char **argv, void *userdata) {
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
|
||||
if (arg_json != JSON_SHORT)
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = json_transform_message(reply, &v);
|
||||
if (r < 0)
|
||||
@ -1976,7 +1976,7 @@ static int call(int argc, char **argv, void *userdata) {
|
||||
json_dump_with_flags(v, stdout);
|
||||
|
||||
} else if (arg_verbose) {
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = bus_message_dump(reply, stdout, 0);
|
||||
if (r < 0)
|
||||
@ -2028,7 +2028,7 @@ static int get_property(int argc, char **argv, void *userdata) {
|
||||
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
|
||||
|
||||
if (arg_json != JSON_SHORT)
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = json_transform_variant(reply, contents, &v);
|
||||
if (r < 0)
|
||||
@ -2037,7 +2037,7 @@ static int get_property(int argc, char **argv, void *userdata) {
|
||||
json_dump_with_flags(v, stdout);
|
||||
|
||||
} else if (arg_verbose) {
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = bus_message_dump(reply, stdout, BUS_MESSAGE_DUMP_SUBTREE_ONLY);
|
||||
if (r < 0)
|
||||
@ -2240,7 +2240,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return version();
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_LEGEND:
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "unit-name.h"
|
||||
#include "util.h"
|
||||
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_kernel_threads = false;
|
||||
static bool arg_all = false;
|
||||
|
||||
@ -99,7 +99,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return version();
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
@ -170,7 +170,7 @@ int main(int argc, char *argv[]) {
|
||||
if (r <= 0)
|
||||
goto finish;
|
||||
|
||||
r = pager_open(arg_no_pager, false);
|
||||
r = pager_open(arg_pager_flags);
|
||||
if (r > 0 && arg_full < 0)
|
||||
arg_full = true;
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "ima-setup.h"
|
||||
|
@ -98,7 +98,7 @@ static bool arg_crash_reboot = false;
|
||||
static char *arg_confirm_spawn = NULL;
|
||||
static ShowStatus arg_show_status = _SHOW_STATUS_INVALID;
|
||||
static bool arg_switched_root = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_service_watchdogs = true;
|
||||
static char ***arg_join_controllers = NULL;
|
||||
static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL;
|
||||
@ -922,7 +922,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_VERSION:
|
||||
@ -2448,7 +2448,7 @@ int main(int argc, char *argv[]) {
|
||||
goto finish;
|
||||
|
||||
if (IN_SET(arg_action, ACTION_TEST, ACTION_HELP, ACTION_DUMP_CONFIGURATION_ITEMS, ACTION_DUMP_BUS_PROPERTIES))
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (arg_action != ACTION_RUN)
|
||||
skip_setup = true;
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "dirent-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
|
@ -43,7 +43,7 @@ static usec_t arg_since = USEC_INFINITY, arg_until = USEC_INFINITY;
|
||||
static const char* arg_field = NULL;
|
||||
static const char *arg_debugger = NULL;
|
||||
static const char *arg_directory = NULL;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static int arg_no_legend = false;
|
||||
static int arg_one = false;
|
||||
static FILE* arg_output = NULL;
|
||||
@ -211,7 +211,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return version();
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_LEGEND:
|
||||
@ -659,7 +659,7 @@ static int dump_list(int argc, char **argv, void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
/* The coredumps are likely to compressed, and for just
|
||||
* listing them we don't need to decompress them, so let's
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <stdio_ext.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "dropin.h"
|
||||
#include "escape.h"
|
||||
#include "fd-util.h"
|
||||
|
@ -52,7 +52,7 @@ static const char have_dropins[] =
|
||||
"systemd/system\0"
|
||||
"systemd/user\0";
|
||||
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static int arg_diff = -1;
|
||||
|
||||
static enum {
|
||||
@ -596,7 +596,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return version();
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case 't': {
|
||||
@ -654,7 +654,7 @@ int main(int argc, char *argv[]) {
|
||||
else if (arg_diff)
|
||||
arg_flags |= SHOW_OVERRIDDEN;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (optind < argc) {
|
||||
int i;
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "alloc-util.h"
|
||||
#include "catalog.h"
|
||||
#include "conf-files.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "hashmap.h"
|
||||
|
@ -104,11 +104,10 @@ enum {
|
||||
|
||||
static OutputMode arg_output = OUTPUT_SHORT;
|
||||
static bool arg_utc = false;
|
||||
static bool arg_pager_end = false;
|
||||
static bool arg_follow = false;
|
||||
static bool arg_full = true;
|
||||
static bool arg_all = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static int arg_lines = ARG_LINES_DEFAULT;
|
||||
static bool arg_no_tail = false;
|
||||
static bool arg_quiet = false;
|
||||
@ -298,7 +297,7 @@ static int help(void) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, arg_pager_end);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = terminal_urlify_man("journalctl", "1", &link);
|
||||
if (r < 0)
|
||||
@ -492,11 +491,11 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return version();
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
arg_pager_end = true;
|
||||
arg_pager_flags |= PAGER_JUMP_TO_END;
|
||||
|
||||
if (arg_lines == ARG_LINES_DEFAULT)
|
||||
arg_lines = 1000;
|
||||
@ -1326,7 +1325,7 @@ static int list_boots(sd_journal *j) {
|
||||
if (count == 0)
|
||||
return count;
|
||||
|
||||
(void) pager_open(arg_no_pager, arg_pager_end);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
/* numbers are one less, but we need an extra char for the sign */
|
||||
w = DECIMAL_STR_WIDTH(count - 1) + 1;
|
||||
@ -2127,7 +2126,7 @@ int main(int argc, char *argv[]) {
|
||||
} else {
|
||||
bool oneline = arg_action == ACTION_LIST_CATALOG;
|
||||
|
||||
(void) pager_open(arg_no_pager, arg_pager_end);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (optind < argc)
|
||||
r = catalog_list_items(stdout, database, oneline, argv + optind);
|
||||
@ -2495,7 +2494,7 @@ int main(int argc, char *argv[]) {
|
||||
need_seek = true;
|
||||
|
||||
if (!arg_follow)
|
||||
(void) pager_open(arg_no_pager, arg_pager_end);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (!arg_quiet && (arg_lines != 0 || arg_follow)) {
|
||||
usec_t start, end;
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "conf-files.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "architecture.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "verbs.h"
|
||||
#include "virt.h"
|
||||
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_ask_password = true;
|
||||
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
|
||||
static char *arg_host = NULL;
|
||||
@ -199,7 +199,7 @@ static int list_locales(int argc, char **argv, void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to read list of locales: %m");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
strv_print(l);
|
||||
|
||||
return 0;
|
||||
@ -241,7 +241,7 @@ static int list_vconsole_keymaps(int argc, char **argv, void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to read list of keymaps: %m");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
strv_print(l);
|
||||
|
||||
@ -373,7 +373,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) {
|
||||
strv_sort(list);
|
||||
strv_uniq(list);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
strv_print(list);
|
||||
return 0;
|
||||
@ -461,7 +461,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_ASK_PASSWORD:
|
||||
|
@ -26,7 +26,7 @@ static const char* arg_what = "idle:sleep:shutdown";
|
||||
static const char* arg_who = NULL;
|
||||
static const char* arg_why = "Unknown reason";
|
||||
static const char* arg_mode = NULL;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_legend = true;
|
||||
|
||||
static enum {
|
||||
@ -68,7 +68,7 @@ static int print_inhibitors(sd_bus *bus) {
|
||||
_cleanup_(table_unrefp) Table *table = NULL;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
@ -241,7 +241,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_LEGEND:
|
||||
|
@ -38,7 +38,7 @@ static char **arg_property = NULL;
|
||||
static bool arg_all = false;
|
||||
static bool arg_value = false;
|
||||
static bool arg_full = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_legend = true;
|
||||
static const char *arg_kill_who = NULL;
|
||||
static int arg_signal = SIGTERM;
|
||||
@ -122,7 +122,7 @@ static int list_sessions(int argc, char *argv[], void *userdata) {
|
||||
assert(bus);
|
||||
assert(argv);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
@ -203,7 +203,7 @@ static int list_users(int argc, char *argv[], void *userdata) {
|
||||
assert(bus);
|
||||
assert(argv);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
@ -260,7 +260,7 @@ static int list_seats(int argc, char *argv[], void *userdata) {
|
||||
assert(bus);
|
||||
assert(argv);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(
|
||||
bus,
|
||||
@ -836,7 +836,7 @@ static int show_session(int argc, char *argv[], void *userdata) {
|
||||
|
||||
properties = !strstr(argv[0], "status");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (argc <= 1) {
|
||||
const char *session, *p = "/org/freedesktop/login1/session/self";
|
||||
@ -885,7 +885,7 @@ static int show_user(int argc, char *argv[], void *userdata) {
|
||||
|
||||
properties = !strstr(argv[0], "status");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (argc <= 1) {
|
||||
/* If not argument is specified inspect the manager
|
||||
@ -943,7 +943,7 @@ static int show_seat(int argc, char *argv[], void *userdata) {
|
||||
|
||||
properties = !strstr(argv[0], "status");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (argc <= 1) {
|
||||
/* If not argument is specified inspect the manager
|
||||
@ -1284,7 +1284,7 @@ static int help(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = terminal_urlify_man("loginctl", "1", &link);
|
||||
if (r < 0)
|
||||
@ -1435,7 +1435,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_LEGEND:
|
||||
|
@ -57,7 +57,7 @@ static char **arg_property = NULL;
|
||||
static bool arg_all = false;
|
||||
static bool arg_value = false;
|
||||
static bool arg_full = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_legend = true;
|
||||
static const char *arg_kill_who = NULL;
|
||||
static int arg_signal = SIGTERM;
|
||||
@ -278,7 +278,7 @@ static int list_machines(int argc, char *argv[], void *userdata) {
|
||||
|
||||
assert(bus);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(bus,
|
||||
"org.freedesktop.machine1",
|
||||
@ -358,7 +358,7 @@ static int list_images(int argc, char *argv[], void *userdata) {
|
||||
|
||||
assert(bus);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(bus,
|
||||
"org.freedesktop.machine1",
|
||||
@ -753,7 +753,7 @@ static int show_machine(int argc, char *argv[], void *userdata) {
|
||||
|
||||
properties = !strstr(argv[0], "status");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (properties && argc <= 1) {
|
||||
|
||||
@ -1091,7 +1091,7 @@ static int show_image(int argc, char *argv[], void *userdata) {
|
||||
|
||||
properties = !strstr(argv[0], "status");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (argc <= 1) {
|
||||
|
||||
@ -2396,7 +2396,7 @@ static int list_transfers(int argc, char *argv[], void *userdata) {
|
||||
double progress;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_call_method(bus,
|
||||
"org.freedesktop.import1",
|
||||
@ -2612,7 +2612,7 @@ static int help(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = terminal_urlify_man("machinectl", "1", &link);
|
||||
if (r < 0)
|
||||
@ -2852,7 +2852,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_LEGEND:
|
||||
|
@ -36,7 +36,7 @@ enum {
|
||||
} arg_action = ACTION_DEFAULT;
|
||||
|
||||
static bool arg_no_block = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_ask_password = true;
|
||||
static bool arg_quiet = false;
|
||||
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
|
||||
@ -177,7 +177,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_ASK_PASSWORD:
|
||||
@ -1485,7 +1485,7 @@ static int list_devices(void) {
|
||||
|
||||
typesafe_qsort(items, n, compare_item);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
fputs(ansi_underline(), stdout);
|
||||
for (c = 0; c < _COLUMN_MAX; c++) {
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_legend = true;
|
||||
static bool arg_all = false;
|
||||
|
||||
@ -248,7 +248,7 @@ static int list_links(int argc, char *argv[], void *userdata) {
|
||||
if (c < 0)
|
||||
return c;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (arg_legend)
|
||||
printf("%3s %-16s %-18s %-11s %-10s\n",
|
||||
@ -874,7 +874,7 @@ static int link_status(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_free_ LinkInfo *links = NULL;
|
||||
int r, c, i;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_netlink_open(&rtnl);
|
||||
if (r < 0)
|
||||
@ -970,7 +970,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
|
||||
if (c < 0)
|
||||
return c;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (arg_legend)
|
||||
printf("%-16s %-17s %-16s %-11s %-17s %-16s\n",
|
||||
@ -1121,7 +1121,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return version();
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_LEGEND:
|
||||
|
@ -207,7 +207,7 @@ static int help(void) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
(void) pager_open(false, false);
|
||||
(void) pager_open(false);
|
||||
|
||||
r = terminal_urlify_man("systemd-nspawn", "1", &link);
|
||||
if (r < 0)
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "terminal-util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_legend = true;
|
||||
static bool arg_ask_password = true;
|
||||
static bool arg_quiet = false;
|
||||
@ -263,7 +263,7 @@ static int inspect_image(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (arg_cat) {
|
||||
printf("%s-- OS Release: --%s\n", ansi_highlight(), ansi_normal());
|
||||
@ -776,7 +776,7 @@ static int help(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = terminal_urlify_man("portablectl", "1", &link);
|
||||
if (r < 0)
|
||||
@ -866,7 +866,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return version();
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_LEGEND:
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <sys/un.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "log.h"
|
||||
|
@ -34,7 +34,7 @@ static uint16_t arg_type = 0;
|
||||
static uint16_t arg_class = 0;
|
||||
static bool arg_legend = true;
|
||||
static uint64_t arg_flags = 0;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
bool arg_ifindex_permissive = false; /* If true, don't generate an error if the specified interface index doesn't exist */
|
||||
static const char *arg_service_family = NULL;
|
||||
|
||||
@ -1438,7 +1438,7 @@ static int status_ifindex(sd_bus *bus, int ifindex, const char *name, StatusMode
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get link data for %i: %s", ifindex, bus_error_message(&error, r));
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (mode == STATUS_DNS)
|
||||
return status_print_strv_ifindex(ifindex, name, link_info.dns);
|
||||
@ -1684,7 +1684,7 @@ static int status_global(sd_bus *bus, StatusMode mode, bool *empty_line) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get global data: %s", bus_error_message(&error, r));
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
if (mode == STATUS_DNS)
|
||||
return status_print_strv_global(global_info.dns);
|
||||
@ -2657,7 +2657,7 @@ static int compat_parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_SET_DNS:
|
||||
@ -2917,7 +2917,7 @@ static int native_parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include "def.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "hostname-util.h"
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <stdio_ext.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "dns-domain.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio-label.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "clean-ipc.h"
|
||||
#include "def.h"
|
||||
#include "dirent-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "alloc-util.h"
|
||||
#include "conf-files.h"
|
||||
#include "conf-parser.h"
|
||||
#include "def.h"
|
||||
#include "dirent-util.h"
|
||||
#include "extract-word.h"
|
||||
#include "fd-util.h"
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "env-util.h"
|
||||
#include "escape.h"
|
||||
#include "fileio.h"
|
||||
#include "parse-util.h"
|
||||
#include "serialize.h"
|
||||
#include "strv.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
static char **arg_prefixes = NULL;
|
||||
static bool arg_cat_config = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
|
||||
static int apply_all(OrderedHashmap *sysctl_options) {
|
||||
char *property, *value;
|
||||
@ -243,7 +243,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
@ -302,7 +302,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (arg_cat_config) {
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = cat_files(NULL, files, 0);
|
||||
goto finish;
|
||||
|
@ -113,7 +113,7 @@ static UnitFileScope arg_scope = UNIT_FILE_SYSTEM;
|
||||
static bool arg_wait = false;
|
||||
static bool arg_no_block = false;
|
||||
static bool arg_no_legend = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_no_wtmp = false;
|
||||
static bool arg_no_sync = false;
|
||||
static bool arg_no_wall = false;
|
||||
@ -391,6 +391,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
|
||||
const UnitInfo *u;
|
||||
unsigned n_shown = 0;
|
||||
int job_count = 0;
|
||||
bool full = arg_full || FLAGS_SET(arg_pager_flags, PAGER_DISABLE);
|
||||
|
||||
max_id_len = STRLEN("UNIT");
|
||||
load_len = STRLEN("LOAD");
|
||||
@ -476,7 +477,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
|
||||
|
||||
printf("%-*.*s%s\n",
|
||||
desc_len,
|
||||
!arg_full && arg_no_pager ? (int) desc_len : -1,
|
||||
full ? -1 : (int) desc_len,
|
||||
"DESCRIPTION",
|
||||
ansi_normal());
|
||||
}
|
||||
@ -534,7 +535,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
|
||||
|
||||
printf("%-*.*s%s\n",
|
||||
desc_len,
|
||||
!arg_full && arg_no_pager ? (int) desc_len : -1,
|
||||
full ? -1 : (int) desc_len,
|
||||
u->description,
|
||||
off_underline);
|
||||
}
|
||||
@ -749,7 +750,7 @@ static int list_units(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = get_unit_list_recursive(bus, strv_skip(argv, 1), &unit_infos, &replies, &machines);
|
||||
if (r < 0)
|
||||
@ -961,7 +962,7 @@ static int list_sockets(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
n = get_unit_list_recursive(bus, strv_skip(argv, 1), &unit_infos, &replies, &machines);
|
||||
if (n < 0)
|
||||
@ -1266,7 +1267,7 @@ static int list_timers(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
n = get_unit_list_recursive(bus, strv_skip(argv, 1), &unit_infos, &replies, &machines);
|
||||
if (n < 0)
|
||||
@ -1551,7 +1552,7 @@ static int list_unit_files(int argc, char *argv[], void *userdata) {
|
||||
return bus_log_parse_error(r);
|
||||
}
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
typesafe_qsort(units, c, compare_unit_file_list);
|
||||
output_unit_file_list(units, c);
|
||||
@ -1785,7 +1786,7 @@ static int list_dependencies(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
puts(u);
|
||||
|
||||
@ -2025,7 +2026,7 @@ static int list_machines(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
typesafe_qsort(machine_infos, r, compare_machine_info);
|
||||
output_machines_list(machine_infos, r);
|
||||
@ -2197,7 +2198,7 @@ static void output_jobs_list(sd_bus *bus, const struct job_info* jobs, unsigned
|
||||
return;
|
||||
}
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
id_len = STRLEN("JOB");
|
||||
unit_len = STRLEN("UNIT");
|
||||
@ -2312,7 +2313,7 @@ static int list_jobs(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
output_jobs_list(bus, jobs, c, skipped);
|
||||
return 0;
|
||||
@ -5150,7 +5151,7 @@ static int show_all(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
c = (unsigned) r;
|
||||
|
||||
@ -5262,7 +5263,7 @@ static int show(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
/* If no argument is specified inspect the manager itself */
|
||||
if (show_mode == SYSTEMCTL_SHOW_PROPERTIES && argc <= 1)
|
||||
@ -5367,7 +5368,7 @@ static int cat(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to expand names: %m");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
STRV_FOREACH(name, names) {
|
||||
_cleanup_free_ char *fragment_path = NULL;
|
||||
@ -5644,7 +5645,7 @@ static int show_environment(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = sd_bus_get_property(
|
||||
bus,
|
||||
@ -7095,7 +7096,7 @@ static int systemctl_help(void) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = terminal_urlify_man("systemctl", "1", &link);
|
||||
if (r < 0)
|
||||
@ -7656,7 +7657,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_NO_WALL:
|
||||
|
@ -62,7 +62,7 @@ static char *arg_root = NULL;
|
||||
static bool arg_cat_config = false;
|
||||
static const char *arg_replace = NULL;
|
||||
static bool arg_inline = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
|
||||
static OrderedHashmap *users = NULL, *groups = NULL;
|
||||
static OrderedHashmap *todo_uids = NULL, *todo_gids = NULL;
|
||||
@ -1760,7 +1760,7 @@ static int cat_config(void) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
return cat_files(NULL, files, 0);
|
||||
}
|
||||
@ -1852,7 +1852,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "def.h"
|
||||
#include "dirent-util.h"
|
||||
#include "exit-status.h"
|
||||
#include "fd-util.h"
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "def.h"
|
||||
#include "env-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include "def.h"
|
||||
#include "escape.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_ask_password = true;
|
||||
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
|
||||
static char *arg_host = NULL;
|
||||
@ -288,7 +288,7 @@ static int list_timezones(int argc, char **argv, void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to read list of time zones: %m");
|
||||
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
strv_print(zones);
|
||||
|
||||
return 0;
|
||||
@ -791,7 +791,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_MONITOR:
|
||||
|
@ -153,7 +153,7 @@ static bool arg_create = false;
|
||||
static bool arg_clean = false;
|
||||
static bool arg_remove = false;
|
||||
static bool arg_boot = false;
|
||||
static bool arg_no_pager = false;
|
||||
static PagerFlags arg_pager_flags = 0;
|
||||
|
||||
static char **arg_include_prefixes = NULL;
|
||||
static char **arg_exclude_prefixes = NULL;
|
||||
@ -2949,7 +2949,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_no_pager = true;
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
@ -3147,7 +3147,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (arg_cat_config) {
|
||||
(void) pager_open(arg_no_pager, false);
|
||||
(void) pager_open(arg_pager_flags);
|
||||
|
||||
r = cat_config(config_dirs, argv + optind);
|
||||
goto finish;
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "conf-files.h"
|
||||
#include "def.h"
|
||||
#include "device-private.h"
|
||||
#include "device-util.h"
|
||||
#include "dirent-util.h"
|
||||
|
Loading…
Reference in New Issue
Block a user