chiark / gitweb /
cgroup-show: unescape cgroups on presentation
[elogind.git] / src / shared / pager.c
index 13f03e798b2b83ec030941d1918ac3ab02e25a38..d6474030c444d312d366f8faef04c7100bfa44de 100644 (file)
 #include "macro.h"
 #include "terminal-util.h"
 #include "signal-util.h"
+#include "copy.h"
 
 static pid_t pager_pid = 0;
 
 noreturn static void pager_fallback(void) {
-        ssize_t n;
-
-        do {
-                n = splice(STDIN_FILENO, NULL, STDOUT_FILENO, NULL, 64*1024, 0);
-        } while (n > 0);
+        int r;
 
-        if (n < 0) {
-                log_error_errno(errno, "Internal pager failed: %m");
+        r = copy_bytes(STDIN_FILENO, STDOUT_FILENO, (off_t) -1, false);
+        if (r < 0) {
+                log_error_errno(r, "Internal pager failed: %m");
                 _exit(EXIT_FAILURE);
         }
 
@@ -152,6 +150,8 @@ bool pager_have(void) {
         return pager_pid > 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int show_man_page(const char *desc, bool null_stdio) {
         const char *args[4] = { "man", NULL, NULL, NULL };
         char *e = NULL;
@@ -206,3 +206,4 @@ int show_man_page(const char *desc, bool null_stdio) {
         log_debug("Exit code %i status %i", status.si_code, status.si_status);
         return status.si_status;
 }
+#endif // 0