virtual int fd () const
{ return -1; }
+ /* Return true if this object supports paging, false otherwise. */
+ virtual bool can_page () const
+ {
+ /* Almost no file supports paging, which is why this is the
+ default. */
+ return false;
+ }
+
/* Indicate that if the next sequence of characters overflows the
line, a newline should be inserted here rather than when it hits
the end. If INDENT is non-zero, it is a number of spaces to be
int fd () const override
{ return m_fd; }
+ bool can_page () const override
+ {
+ return m_file == stdout;
+ }
+
private:
/* Sets the internal stream to FILE, and saves the FILE's file
descriptor in M_FD. */
void write_async_safe (const char *buf, long length_buf) override
{ return m_stream->write_async_safe (buf, length_buf); }
+ bool can_page () const override
+ {
+ return m_stream->can_page ();
+ }
+
protected:
explicit wrapped_file (T stream)
this loop, so we must continue to check it here. */
if (pagination_enabled
&& !pagination_disabled_for_command
- && lines_printed >= lines_allowed)
+ && lines_printed >= lines_allowed
+ && m_stream->can_page ())
{
prompt_for_continue ();
did_paginate = true;
it here. */
if (pagination_enabled
&& !pagination_disabled_for_command
- && lines_printed >= lines_allowed)
+ && lines_printed >= lines_allowed
+ && m_stream->can_page ())
prompt_for_continue ();
while (*linebuffer != '\0' && *linebuffer != '\n')