Do not pause after any line containing a *^L* (form feed).
*-e*, *--exit-on-eof*::
-Exit on End-Of-File.
+Exit on End-Of-File, enabled by default if not executed on terminal.
*-f*, *--no-pause*::
Count logical lines, rather than screen lines (i.e., long lines are not folded).
no_scroll:1, /* do not scroll, clear the screen and then display text */
no_tty_in:1, /* is input in interactive mode */
no_tty_out:1, /* is output in interactive mode */
+ no_tty_err:1, /* is stderr terminal */
print_banner:1, /* print file name banner */
reading_num:1, /* are we reading leading_number */
report_errors:1, /* is an error reported */
ctl->no_tty_out = tcgetattr(STDOUT_FILENO, &ctl->output_tty);
#endif
ctl->no_tty_in = tcgetattr(STDIN_FILENO, &ctl->output_tty);
- tcgetattr(STDERR_FILENO, &ctl->output_tty);
+ ctl->no_tty_err = tcgetattr(STDERR_FILENO, &ctl->output_tty);
ctl->original_tty = ctl->output_tty;
+
ctl->hard_tabs = (ctl->output_tty.c_oflag & TABDLY) != TAB3;
if (ctl->no_tty_out)
return;
initterm(&ctl);
+ if (ctl.no_tty_err)
+ /* exit when we cannot read user's input */
+ ctl.exit_on_eof = 1;
+
#ifdef HAVE_MAGIC
ctl.magic = magic_open(MAGIC_MIME_ENCODING | MAGIC_SYMLINK);
magic_load(ctl.magic, NULL);