X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Ftermcap.pl;h=f295a2d476b53b9b360abe329f4c5448d04a2434;hb=d1a8253e39cd846de74220a6e911461d2a431d3a;hp=aa221dfc3971e76988d9a6639e6d8d129a1654a6;hpb=7c0587c85ff56c1fa1d95bc5228a7aff2da43d6c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/termcap.pl b/lib/termcap.pl index aa221df..f295a2d 100644 --- a/lib/termcap.pl +++ b/lib/termcap.pl @@ -1,4 +1,13 @@ -;# $RCSfile: termcap.pl,v $$Revision: 4.0.1.1 $$Date: 92/06/08 13:49:17 $ +;# $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'; @@ -13,11 +22,12 @@ sub Tgetent { local($TERM) = @_; local($TERMCAP,$_,$entry,$loop,$field); - warn "Tgetent: no ospeed set" unless $ospeed; - foreach $key (keys(TC)) { + # warn "Tgetent: no ospeed set" unless $ospeed; + 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;