Changeset ac7d970 for app/src/tok
- Timestamp:
- 04/08/08 13:53:51 (17 years ago)
- Branches:
- master, help
- Children:
- 0214596
- Parents:
- 317d53b
- git-author:
- pawelk <pawelk@…> (04/08/08 13:53:51)
- git-committer:
- pawelk <pawelk@…> (04/08/08 13:53:51)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/src/tok/tok
r20b4e44 rac7d970 11 11 use File::HomeDir; 12 12 13 my $max_form_length = 50; 14 13 15 my $interactive=0; 14 16 my $help; … … 21 23 my $file; 22 24 foreach $file ($systemconfigfile, $userconfigfile){ 23 if(open(CONFIG, $ configfile1)){25 if(open(CONFIG, $file)){ 24 26 while (<CONFIG>) { 25 27 chomp; … … 75 77 # | [^[:print:]] (?{seg("B",$&)}) 76 78 79 sub min { 80 my ($val1, $val2) = @_; 81 if($val1 < $val2) { 82 return $val1; 83 } 84 else { 85 return $val2; 86 } 87 } 88 77 89 78 90 sub seg 79 91 { 80 92 my ($tag,$match) = @_; 81 my $len=length $match; 82 printf "%04d %02d %s ", $offset, $len, $tag; 93 my $length = length $match; 94 my $idx = 0; 95 while($idx < $length) { 96 my $l = min $max_form_length, $length - $idx; 97 my $m = substr $match, $idx, $l; 98 99 printf "%04d %02d %s ", $offset + $idx, $l, $tag; 83 100 if($tag eq 'S') 84 101 { 85 for(my $i=0; $i<$l en; ++$i)102 for(my $i=0; $i<$l; ++$i) 86 103 { 87 my $c = substr $m atch, $i, 1;104 my $c = substr $m, $i, 1; 88 105 print '_' if $c eq ' '; 89 106 print '\n' if $c eq "\n"; … … 95 112 elsif($tag eq 'B') 96 113 { 97 printf "\\x%02X", ord($m atch);114 printf "\\x%02X", ord($m); 98 115 } 99 116 else 100 117 { 101 print $m atch;118 print $m; 102 119 } 103 120 print "\n"; 104 $offset += $len; 105 } 121 $idx += $l; 122 } # while($idx < $length) 123 $offset += $length; 124 } #sub seg 125
Note: See TracChangeset
for help on using the changeset viewer.