#include "process-util.h"
#include "signal-util.h"
#include "string-util.h"
+#include "strv.h"
#include "terminal-util.h"
static pid_t pager_pid = 0;
if (pager_pid > 0)
return 1;
- if (!on_tty())
+ if (terminal_is_dumb())
return 0;
pager = getenv("SYSTEMD_PAGER");
pager = getenv("PAGER");
/* If the pager is explicitly turned off, honour it */
- if (pager && (pager[0] == 0 || streq(pager, "cat")))
+ if (pager && STR_IN_SET(pager, "", "cat"))
return 0;
/* Determine and cache number of columns before we spawn the
return;
/* Inform pager that we are done */
+#ifdef __GLIBC__
stdout = safe_fclose(stdout);
stderr = safe_fclose(stderr);
+#else
+ safe_fclose(stdout);
+ safe_fclose(stderr);
+#endif // __GLIBC__
(void) kill(pager_pid, SIGCONT);
(void) wait_for_terminate(pager_pid, NULL);