diff options
author | B. Watson <urchlay@slackware.uk> | 2024-04-23 22:28:28 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-04-23 22:28:28 -0400 |
commit | 140ced429cba74084d65942840b1f97fc77d8d9b (patch) | |
tree | 94c26f67f46d4cffe6c3265dde192cfd7fc9ccba /a8utf8 | |
parent | 046326dc430a15b675eff425ddd31d1ceb0fe916 (diff) | |
download | bw-atari8-tools-140ced429cba74084d65942840b1f97fc77d8d9b.tar.gz |
a8utf8: add -r (reverse) option.
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]; |