diff options
Diffstat (limited to 'a8utf8')
-rwxr-xr-x | a8utf8 | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -121,6 +121,7 @@ while(@ARGV && $ARGV[0] =~ /^-/) { for($ARGV[0]) { /^-i$/ && do { $table = \%xl_intl_table; next; }; /^-t$/ && do { $print_table = 1; next; }; + /^-r$/ && do { $reverse = 1; next; }; /^--?h/ && do { usage(0) }; warn "$SELF: unknown option: $_\n"; usage(1); @@ -128,6 +129,14 @@ while(@ARGV && $ARGV[0] =~ /^-/) { shift @ARGV; } +if($reverse) { + binmode(STDOUT, ":bytes"); + for(keys %$table) { + $revtable{ord($table->{$_})} = chr($_); + } + $table = \%revtable; +} + if($print_table) { for(sort { $a <=> $b } keys %$table) { my $chr = translate(chr $_); @@ -156,7 +165,7 @@ sub translate { sub usage { print <<EOF; -Usage: $SELF [--help] | [-t [-i]] | [-i] infile [infile ...] +Usage: $SELF [--help] | [-t [-r] [-i]] | [-r] [-i] infile [infile ...] See man page for details. EOF exit $_[0]; |