+
+ # If needsterminal then redirect stdin to the tty which is
+ # on stdout, rather than leaving it as the input data stream
+ # which has now been read through to EOF.
+ #
+ # Some programs such as "more" and "less" already use
+ # /dev/tty rather than stdin. But "vim" on non-tty stdin
+ # gives a warning message and then leaves the tty in raw
+ # mode on exit. Or "nvi" refuses to run at all unless both
+ # stdin and stdout are the tty.
+ #
+ # RFC 1524 is silent on exactly what a program with
+ # "needsterminal" should expect, but it seems sensible to
+ # arrange that both stdin and stdout are the terminal for
+ # "needsterminal" with "%s".
+ #
+ if ($needsterminal) {
+ $comm .= ' <&1';
+ }