summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-11 12:56:29 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-14 16:25:11 +0100
commit0221d68a1317407960ea6f88bd4ebc1781999332 (patch)
treeaa6f7d5c2280c44df790b7c042756c8302a4e788 /src/login
parent8e143a123276a9636987b08f555603927ca9e186 (diff)
downloadsystemd-0221d68a1317407960ea6f88bd4ebc1781999332.tar.gz
systemd-0221d68a1317407960ea6f88bd4ebc1781999332.tar.bz2
systemd-0221d68a1317407960ea6f88bd4ebc1781999332.zip
basic/pager: convert the pager options to a flags argument
Pretty much everything uses just the first argument, and this doesn't make this common pattern more complicated, but makes it simpler to pass multiple options.
Diffstat (limited to 'src/login')
-rw-r--r--src/login/inhibit.c6
-rw-r--r--src/login/loginctl.c18
2 files changed, 12 insertions, 12 deletions
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 8fe64b9184..22fee49a2b 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -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:
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 2a3289951a..d6250253d6 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -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: