|
Revision 1, 0.9 kB
(checked in by sven, 4 years ago)
|
|
Erstimport
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | my $handler = STDIN; |
|---|
| 14 | open($handler, '<', $ARGV[0]) if(@ARGV > 0); |
|---|
| 15 | |
|---|
| 16 | my $line=0; |
|---|
| 17 | my $hex,$dec; |
|---|
| 18 | while(<$handler>) { |
|---|
| 19 | $line++; |
|---|
| 20 | unless(/([0-9a-fA-F]{2})\s* |
|---|
| 21 | print STDERR "Zeile $line: Formatfehler! Überspringe Zeile $line...\n"; |
|---|
| 22 | next; |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | $hex=$1; $dec=$2; |
|---|
| 26 | if(hex $hex ne $dec) { |
|---|
| 27 | print STDERR "Zeile $line: Hex($hex)/Dez($dec)-Angabe stimmen nicht überein (hex entspricht ",hex $hex,").\n"; |
|---|
| 28 | print STDERR "Zeile $line: Nutze Dezimal-Angabe fuer Streifen\n"; |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | print pack("C", $dec); |
|---|
| 32 | |
|---|
| 33 | } |
|---|