/usr/share/konwert/devel/hex-trs is in konwert-dev 1.8-13.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #!/usr/bin/perl -n
sub bajt ($)
{
my ($a) = @_;
$a < 040 || $a == 0177 ?
sprintf "\\%o", $a
:
$a == ord "\\" || $a == ord "#" ?
"\\" . chr ($a)
:
chr ($a);
}
sub utf8 ($)
{
my ($b) = @_;
$b < 0x20 || $b == 0x7F ?
sprintf "\\x%02X", $b
:
$b == ord "\\" || $b == ord "#" ?
"\\" . chr ($b)
:
$b < 0x80 ?
chr ($b)
:
$b < 0x800 ?
chr (0xC0 | $b >> 6 & 0x1F) .
chr (0x80 | $b & 0x3F)
:
chr (0xE0 | $b >> 12 & 0x0F) .
chr (0x80 | $b >> 6 & 0x3F) .
chr (0x80 | $b & 0x3F),
}
if (/^\s*0x([0-9A-Fa-f]{2})\s+0x([0-9A-Fa-f]{4})/)
{
print "\t", bajt hex $1, "\t", utf8 hex $2, "\n"
unless hex $1 == hex $2 && hex $1 < 0x80;
}
elsif (/^\s*0x([0-9A-Fa-f]{2})\s+0x([0-9A-Fa-f]{2})\s+0x([0-9A-Fa-f]{4})/)
{
print "\t", bajt hex $1, bajt hex $2, "\t", utf8 hex $3, "\n";
}
elsif (/^\s*(\S+)\s+0x([0-9A-Fa-f]+)/)
{
print "\t$1\t", utf8 hex $2, "\n";
}
|