<refsect1><title>Options</title>
<variablelist>
<xi:include href="standard-options.xml" xpointer="cat-config" />
+ <xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="cat-config" />
+ <xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</varlistentry>
<xi:include href="standard-options.xml" xpointer="cat-config" />
+ <xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="cat-config" />
+ <xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
+#include "pager.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "util.h"
static bool arg_cat_config = false;
+static bool arg_no_pager = false;
static int delete_rule(const char *rule) {
_cleanup_free_ char *x = NULL, *fn = NULL;
" -h --help Show this help\n"
" --version Show package version\n"
" --cat-config Show configuration files\n"
+ " --no-pager Do not pipe output into a pager\n"
, program_invocation_short_name);
}
enum {
ARG_VERSION = 0x100,
ARG_CAT_CONFIG,
+ ARG_NO_PAGER,
};
static const struct option options[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, ARG_VERSION },
- { "cat-config", no_argument, NULL, ARG_CAT_CONFIG },
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, ARG_VERSION },
+ { "cat-config", no_argument, NULL, ARG_CAT_CONFIG },
+ { "no-pager", no_argument, NULL, ARG_NO_PAGER },
{}
};
arg_cat_config = true;
break;
+ case ARG_NO_PAGER:
+ arg_no_pager = true;
+ break;
+
case '?':
return -EINVAL;
}
if (arg_cat_config) {
+ (void) pager_open(arg_no_pager, false);
+
r = cat_files(NULL, files, 0);
goto finish;
}
}
finish:
+ pager_close();
+
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
#include "fileio.h"
#include "hashmap.h"
#include "log.h"
+#include "pager.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
static char **arg_prefixes = NULL;
static bool arg_cat_config = false;
+static bool arg_no_pager = false;
static int apply_all(OrderedHashmap *sysctl_options) {
char *property, *value;
" --version Show package version\n"
" --cat-config Show configuration files\n"
" --prefix=PATH Only apply rules with the specified prefix\n"
+ " --no-pager Do not pipe output into a pager\n"
, program_invocation_short_name);
}
ARG_VERSION = 0x100,
ARG_CAT_CONFIG,
ARG_PREFIX,
+ ARG_NO_PAGER,
};
static const struct option options[] = {
{ "version", no_argument, NULL, ARG_VERSION },
{ "cat-config", no_argument, NULL, ARG_CAT_CONFIG },
{ "prefix", required_argument, NULL, ARG_PREFIX },
+ { "no-pager", no_argument, NULL, ARG_NO_PAGER },
{}
};
break;
}
+ case ARG_NO_PAGER:
+ arg_no_pager = true;
+ break;
+
case '?':
return -EINVAL;
}
if (arg_cat_config) {
+ (void) pager_open(arg_no_pager, false);
+
r = cat_files(NULL, files, 0);
goto finish;
}
r = k;
finish:
+ pager_close();
+
ordered_hashmap_free_free_free(sysctl_options);
strv_free(arg_prefixes);
#include "copy.h"
#include "def.h"
#include "fd-util.h"
-#include "fs-util.h"
#include "fileio-label.h"
#include "format-util.h"
+#include "fs-util.h"
#include "hashmap.h"
+#include "pager.h"
#include "path-util.h"
#include "selinux-util.h"
#include "smack-util.h"
ADD_MEMBER = 'm',
ADD_RANGE = 'r',
} ItemType;
+
typedef struct Item {
ItemType type;
static bool arg_cat_config = false;
static const char *arg_replace = NULL;
static bool arg_inline = false;
+static bool arg_no_pager = false;
static OrderedHashmap *users = NULL, *groups = NULL;
static OrderedHashmap *todo_uids = NULL, *todo_gids = NULL;
if (r < 0)
return r;
+ (void) pager_open(arg_no_pager, false);
+
return cat_files(NULL, files, 0);
}
" --root=PATH Operate on an alternate filesystem root\n"
" --replace=PATH Treat arguments as replacement for PATH\n"
" --inline Treat arguments as configuration lines\n"
+ " --no-pager Do not pipe output into a pager\n"
, program_invocation_short_name);
}
ARG_ROOT,
ARG_REPLACE,
ARG_INLINE,
+ ARG_NO_PAGER,
};
static const struct option options[] = {
{ "root", required_argument, NULL, ARG_ROOT },
{ "replace", required_argument, NULL, ARG_REPLACE },
{ "inline", no_argument, NULL, ARG_INLINE },
+ { "no-pager", no_argument, NULL, ARG_NO_PAGER },
{}
};
arg_inline = true;
break;
+ case ARG_NO_PAGER:
+ arg_no_pager = true;
+ break;
+
case '?':
return -EINVAL;
log_error_errno(r, "Failed to write files: %m");
finish:
+ pager_close();
+
ordered_hashmap_free_with_destructor(groups, item_free);
ordered_hashmap_free_with_destructor(users, item_free);
#include "missing.h"
#include "mkdir.h"
#include "mount-util.h"
+#include "pager.h"
#include "parse-util.h"
#include "path-lookup.h"
#include "path-util.h"
static bool arg_clean = false;
static bool arg_remove = false;
static bool arg_boot = false;
+static bool arg_no_pager = false;
static char **arg_include_prefixes = NULL;
static char **arg_exclude_prefixes = NULL;
" --exclude-prefix=PATH Ignore rules with the specified prefix\n"
" --root=PATH Operate on an alternate filesystem root\n"
" --replace=PATH Treat arguments as replacement for PATH\n"
+ " --no-pager Do not pipe output into a pager\n"
, program_invocation_short_name);
}
ARG_EXCLUDE_PREFIX,
ARG_ROOT,
ARG_REPLACE,
+ ARG_NO_PAGER,
};
static const struct option options[] = {
{ "exclude-prefix", required_argument, NULL, ARG_EXCLUDE_PREFIX },
{ "root", required_argument, NULL, ARG_ROOT },
{ "replace", required_argument, NULL, ARG_REPLACE },
+ { "no-pager", no_argument, NULL, ARG_NO_PAGER },
{}
};
arg_replace = optarg;
break;
+ case ARG_NO_PAGER:
+ arg_no_pager = true;
+ break;
+
case '?':
return -EINVAL;
}
if (arg_cat_config) {
+ (void) pager_open(arg_no_pager, false);
+
r = cat_config(config_dirs, argv + optind);
goto finish;
}
}
finish:
+ pager_close();
+
ordered_hashmap_free_with_destructor(items, item_array_free);
ordered_hashmap_free_with_destructor(globs, item_array_free);