X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Ftermcap.pl;h=37313432fdee55a7ca938a5b29df92aa68dc8940;hb=d6a06c6b3ce238e0862e09fdca0c17e9d40e9b2c;hp=5b48d71720d9936a509b9d12b081d9adc11fe992;hpb=79072805bf63abe5b5978b5928ab00d360ea3e7f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/termcap.pl b/lib/termcap.pl index 5b48d71..3731343 100644 --- a/lib/termcap.pl +++ b/lib/termcap.pl @@ -14,10 +14,11 @@ sub Tgetent { local($TERMCAP,$_,$entry,$loop,$field); warn "Tgetent: no ospeed set" unless $ospeed; - foreach $key (keys(TC)) { + foreach $key (keys %TC) { delete $TC{$key}; } $TERM = $ENV{'TERM'} unless $TERM; + $TERM =~ s/(\W)/\\$1/g; $TERMCAP = $ENV{'TERMCAP'}; $TERMCAP = '/etc/termcap' unless $TERMCAP; if ($TERMCAP !~ m:^/:) { @@ -33,7 +34,7 @@ sub Tgetent { while () { next if /^#/; next if /^\t/; - if (/(^|\\|)$TERM[:\\|]/) { + if (/(^|\\|)${TERM}[:\\|]/) { chop; while (chop eq '\\\\') { \$_ .= ; @@ -62,6 +63,9 @@ sub Tgetent { $entry = $1; $_ = $2; s/\\E/\033/g; + s/\\(200)/pack('c',0)/eg; # NUL character + s/\\(0\d\d)/pack('c',oct($1))/eg; # octal + s/\\(0x[0-9A-Fa-f][0-9A-Fa-f])/pack('c',hex($1))/eg; # hex s/\\(\d\d\d)/pack('c',$1 & 0177)/eg; s/\\n/\n/g; s/\\r/\r/g;