summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/dist/Term-ReadLine/lib
diff options
context:
space:
mode:
authorafresh1 <afresh1@openbsd.org>2019-02-13 21:15:00 +0000
committerafresh1 <afresh1@openbsd.org>2019-02-13 21:15:00 +0000
commit9f11ffb7133c203312a01e4b986886bc88c7d74b (patch)
tree6618511204c614b20256e4ef9dea39a7b311d638 /gnu/usr.bin/perl/dist/Term-ReadLine/lib
parentImport perl-5.28.1 (diff)
downloadwireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.tar.xz
wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.zip
Fix merge issues, remove excess files - match perl-5.28.1 dist
looking good sthen@, Great! bluhm@
Diffstat (limited to 'gnu/usr.bin/perl/dist/Term-ReadLine/lib')
-rw-r--r--gnu/usr.bin/perl/dist/Term-ReadLine/lib/Term/ReadLine.pm20
1 files changed, 13 insertions, 7 deletions
diff --git a/gnu/usr.bin/perl/dist/Term-ReadLine/lib/Term/ReadLine.pm b/gnu/usr.bin/perl/dist/Term-ReadLine/lib/Term/ReadLine.pm
index db08947972d..78c1ebf5b63 100644
--- a/gnu/usr.bin/perl/dist/Term-ReadLine/lib/Term/ReadLine.pm
+++ b/gnu/usr.bin/perl/dist/Term-ReadLine/lib/Term/ReadLine.pm
@@ -75,6 +75,8 @@ history. Returns the old value.
returns an array with two strings that give most appropriate names for
files for input and output using conventions C<"E<lt>$in">, C<"E<gt>out">.
+The strings returned may not be useful for 3-argument open().
+
=item Attribs
returns a reference to a hash which describes internal configuration
@@ -229,12 +231,17 @@ sub readline {
}
sub addhistory {}
+# used for testing purpose
+sub devtty { return '/dev/tty' }
+
sub findConsole {
my $console;
my $consoleOUT;
- if ($^O ne 'MSWin32' and -e "/dev/tty") {
- $console = "/dev/tty";
+ my $devtty = devtty();
+
+ if ($^O ne 'MSWin32' and -e $devtty) {
+ $console = $devtty;
} elsif ($^O eq 'MSWin32' or $^O eq 'msys' or -e "con") {
$console = 'CONIN$';
$consoleOUT = 'CONOUT$';
@@ -248,7 +255,7 @@ sub findConsole {
$consoleOUT = $console unless defined $consoleOUT;
$console = "&STDIN" unless defined $console;
- if ($console eq "/dev/tty" && !open(my $fh, "<", $console)) {
+ if ($console eq $devtty && !open(my $fh, "<", $console)) {
$console = "&STDIN";
undef($consoleOUT);
}
@@ -266,11 +273,10 @@ sub new {
if (@_==2) {
my($console, $consoleOUT) = $_[0]->findConsole;
-
# the Windows CONIN$ needs GENERIC_WRITE mode to allow
# a SetConsoleMode() if we end up using Term::ReadKey
- open FIN, ( $^O eq 'MSWin32' && $console eq 'CONIN$' ) ? "+<$console" :
- "<$console";
+ open FIN, (( $^O eq 'MSWin32' && $console eq 'CONIN$' ) ? '+<' : '<' ), $console;
+ # RT #132008: Still need 2-arg open here
open FOUT,">$consoleOUT";
#OUT->autoflush(1); # Conflicts with debugger?
@@ -320,7 +326,7 @@ sub Features { \%features }
package Term::ReadLine; # So late to allow the above code be defined?
-our $VERSION = '1.15';
+our $VERSION = '1.17';
my ($which) = exists $ENV{PERL_RL} ? split /\s+/, $ENV{PERL_RL} : undef;
if ($which) {