develooper Front page | perl.perl5.porters | Postings from October 2007

patch for lib/Term/Cap.pm for EBCDIC platform

Thread Next
From:
Chun Bing Ge
Date:
October 24, 2007 22:46
Subject:
patch for lib/Term/Cap.pm for EBCDIC platform
Message ID:
OFC7075E4B.24A418E5-ON4825737F.001F1756-4825737F.001F7F3D@IBMCN
Hi,

Here is the patch below. Any question, pls let me know, thanks.

--- /home/spring/perl/perl-current/lib/Term/Cap.pm      2006-06-14 
03:29:18.000000000 +0800
+++ /home/spring/patch/chgfile/lib-Term-Cap.pm  2007-09-10 
14:08:42.000000000 +0800
@@ -339,18 +339,34 @@
            # print STDERR "DEBUG: string $1 = $2\n";
            next if defined $self->{'_' . ($cap = $1)};
            $_ = $2;
-           s/\\E/\033/g;
-           s/\\(\d\d\d)/pack('c',oct($1) & 0177)/eg;
-           s/\\n/\n/g;
-           s/\\r/\r/g;
-           s/\\t/\t/g;
-           s/\\b/\b/g;
-           s/\\f/\f/g;
-           s/\\\^/\377/g;
-           s/\^\?/\177/g;
-           s/\^(.)/pack('c',ord($1) & 31)/eg;
-           s/\\(.)/$1/g;
-           s/\377/^/g;
+      if (ord("A") == 193) {
+               s/\\E/\047/g;
+               s/\\(\d\d\d)/pack('c',oct($1) & 0177)/eg;
+               s/\\n/\n/g;
+               s/\\r/\r/g;
+               s/\\t/\t/g;
+               s/\\b/\b/g;
+               s/\\f/\f/g;
+               s/\\\^/\337/g;
+               s/\^\?/\007/g;
+               s/\^(.)/pack('c',ord($1) & 31)/eg;
+               s/\\(.)/$1/g;
+               s/\337/^/g;
+      }
+      else {
+               s/\\E/\033/g;
+               s/\\(\d\d\d)/pack('c',oct($1) & 0177)/eg;
+               s/\\n/\n/g;
+               s/\\r/\r/g;
+               s/\\t/\t/g;
+               s/\\b/\b/g;
+               s/\\f/\f/g;
+               s/\\\^/\377/g;
+               s/\^\?/\177/g;
+               s/\^(.)/pack('c',ord($1) & 31)/eg;
+               s/\\(.)/$1/g;
+               s/\377/^/g;
+      }
            $self->{'_' . $cap} = $_;
        }
        # else { carp "junk in $term ignored: $field"; }




Ge, Chun Bing
空山新雨后,天气晚来秋

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About