/usr/bin/vcsaview is in hxtools 20170430-1.
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 | #!/usr/bin/perl
#
# vcsaview - show Linux vt contents
# written by Jan Engelhardt, 2004-2007
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the WTF Public License version 2 or
# (at your option) any later version.
#
use strict;
undef $/;
my $data = join("", <>);
my $height = ord(substr($data, 0, 1));
my $width = ord(substr($data, 1, 1));
for (my $y = 0; $y < $height; ++$y) {
for (my $x = 0; $x < $width; ++$x) {
my $p = 4 + 2 * ($y * $width + $x);
print &attr2color(substr($data, $p+1, 1)),
substr($data, $p, 1);
}
print "\n";
}
sub asc2ans ()
{
my $i = shift @_;
return ($i &~ 5) | (($i & 1) ? 4 : 0) | (($i & 4) ? 1 : 0);
}
sub attr2color ()
{
my $char = ord shift @_;
print "\e[0;";
if ($char & 0x08) {
print "1;";
}
print "4", &asc2ans(($char & 0x70) >> 4), ";";
print "3", &asc2ans(($char & 0x07)), "m";
return;
}
|