chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tmpfiles: allow creation of named pipes with tmpfiles
[elogind.git]
/
src
/
cgls.c
diff --git
a/src/cgls.c
b/src/cgls.c
index 2bde743acf314420c9c9c2c3375facd452a172e2..20d6531123c8a69cc5293f8e72d996ebcbba0b03 100644
(file)
--- a/
src/cgls.c
+++ b/
src/cgls.c
@@
-30,20
+30,29
@@
#include "cgroup-util.h"
#include "log.h"
#include "util.h"
#include "cgroup-util.h"
#include "log.h"
#include "util.h"
+#include "pager.h"
+
+static bool arg_no_pager = false;
static void help(void) {
printf("%s [OPTIONS...] [CGROUP...]\n\n"
"Recursively show control group contents.\n\n"
static void help(void) {
printf("%s [OPTIONS...] [CGROUP...]\n\n"
"Recursively show control group contents.\n\n"
- " -h --help Show this help\n",
+ " -h --help Show this help\n"
+ " --no-pager Do not pipe output into a pager\n",
program_invocation_short_name);
}
static int parse_argv(int argc, char *argv[]) {
program_invocation_short_name);
}
static int parse_argv(int argc, char *argv[]) {
+ enum {
+ ARG_NO_PAGER = 0x100
+ };
+
static const struct option options[] = {
static const struct option options[] = {
- { "help", no_argument, NULL, 'h' },
- { NULL, 0, NULL, 0 }
+ { "help", no_argument, NULL, 'h' },
+ { "no-pager", no_argument, NULL, ARG_NO_PAGER },
+ { NULL, 0, NULL, 0 }
};
int c;
};
int c;
@@
-59,6
+68,10
@@
static int parse_argv(int argc, char *argv[]) {
help();
return 0;
help();
return 0;
+ case ARG_NO_PAGER:
+ arg_no_pager = true;
+ break;
+
case '?':
return -EINVAL;
case '?':
return -EINVAL;
@@
-84,6
+97,9
@@
int main(int argc, char *argv[]) {
goto finish;
}
goto finish;
}
+ if (!arg_no_pager)
+ pager_open();
+
if (optind < argc) {
unsigned i;
if (optind < argc) {
unsigned i;
@@
-132,6
+148,7
@@
int main(int argc, char *argv[]) {
retval = EXIT_SUCCESS;
finish:
retval = EXIT_SUCCESS;
finish:
+ pager_close();
return retval;
}
return retval;
}