X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Ftermcap.pl;h=06da956666c9f4fe5a0dea1746945bfd5b309a88;hb=a85d93d9d5c06911d843f281439a8d3e65aeb165;hp=22c18179d8bb4758cc18698e56ed748d983d8339;hpb=ed6116ce9b9d13712ea252ee248b0400653db7f9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/termcap.pl b/lib/termcap.pl index 22c1817..06da956 100644 --- a/lib/termcap.pl +++ b/lib/termcap.pl @@ -1,4 +1,13 @@ ;# $RCSfile: termcap.pl,v $$Revision: 4.1 $$Date: 92/08/07 18:24:16 $ +# +# This library is no longer being maintained, and is included for backward +# compatibility with Perl 4 programs which may require it. +# +# In particular, this should not be used as an example of modern Perl +# programming techniques. +# +# Suggested alternative: Term::Cap +# ;# ;# Usage: ;# require 'ioctl.pl'; @@ -14,10 +23,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 +43,7 @@ sub Tgetent { while () { next if /^#/; next if /^\t/; - if (/(^|\\|)$TERM\[:\\|]/) { + if (/(^|\\|)${TERM}[:\\|]/) { chop; while (chop eq '\\\\') { \$_ .= ; @@ -62,6 +72,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;