This file is indexed.

/usr/bin/konwert is in konwert 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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/perl

use File::Temp qw(tempfile);

######## STA£E ################################################################

$wersja = "1.8";
@filters = ("$ENV{HOME}/.konwert/filters", "/usr/share/konwert/filters");

######## INICJALIZACJA ########################################################

($ja = $0) =~ s|^.*/(.*?)$|$1|;

######## OPIS U¯YCIA ##########################################################

sub uzycie
{
    print { $_[0] ? STDERR : STDOUT } <<EOF;
Usage: $ja FILTER [FILE]... [-o DEST | -O]
This is an interface for conversion between various character encodings.

$ja allows filtering multiple files through multiple filters.
It filters the specified FILEs, or stdin if none are given.

  -o DEST     output goes to this file/directory instead of stdout
  -O          every input file is replaced with its translation
  --help      display this help and exit
  --version   output version information and exit

Simple FILTER is the name of an executable file from one of the
following directories:
  @filters
which itself filters stdin to stdout.

The filtering rule can be more complex:

`$ja FILTER1+FILTER2' means `$ja FILTER1 |$ja FILTER2'.

`$ja FORMAT1-FORMAT2', unless such filter exists, tries to find
a common FORMAT3, such that both filters FORMAT1-FORMAT3 and
FORMAT3-FORMAT1 do exist.

`$ja FILTER/ARG/...' passes arguments to the filter. Arguments can
also be specified here: FORMAT1/ARGS-FORMAT2.

`$ja '(COMMAND ARGS...)'' executes this arbitrary shell command.
EOF
    exit $_[0]
}

######## ANALIZA ARGUMENTÓW WYWO£ANIA #########################################

# Nie u¿ywam ¿adnych modu³ów getopt itd., bo s± zbyt wolne.

$wy = "-";   # Domy¶lnie wynik pójdzie na stdout
if (@ARGV == 1)
{
    if ($ARGV[0] eq "--help") { uzycie }
    if ($ARGV[0] eq "--version") { print "konwert, version $wersja\n"; exit; }
}
while (@ARGV)
{
    if ($ARGV[0] =~ /^-(.+)$/)   # Jaka¶ opcja
    {
	shift @ARGV;
	&{${
	{
	    "-" => sub
	    {
		push @we, @ARGV;
		return;
	    },
	    "o" => sub
	    {
		@ARGV or die "$ja: option requires an argument -- $1\n";
		$wy = shift @ARGV;
	    },
	    "O" => sub
	    {
		$wy = "=";
	    }
	}}{$1} or sub { die "$ja: illegal option -- $1\n" } };
    }
    else { push @we, shift @ARGV }
}
@we or uzycie 1;

######## ANALIZA Z£O¯ONEGO FILTRU #############################################

sub jest
{
    foreach (@filters)
    {
	if (-x "$_/$_[0]" && !-d _)
	{
	    $_[0] = "$_/$_[0]";
	    return 1;
	}
    }
    0;
}

$filtr = join "|", map
{
    s/^\+//;
    if (/^\(.*\)$/) { $_ }
    else
    {
	my @formaty = split /-/;
	$arg = join "", map { s|^(.*?)(/.*)|$1| and $2 } @formaty;
	$arg =~ s|^/||;
	$arg =~ s|/| |g;
	$_ = join "-", @formaty;
	if (jest $_) { @formaty = $_ }
	else
	{
	    if (@formaty >= 2)
	    {
		my @uni1 = ();
		my @uni2 = ();
		foreach (@filters)
		{
		    opendir DIR, $_ or next;
		    foreach (readdir DIR)
		    {
			/^\Q$formaty[0]\E-(.*)$/ and push @uni1, $1;
			/^(.*)-\Q$formaty[$#formaty]\E$/ and push @uni2, $1;
			    # Nie wiedzieæ czemu perl ¼le rozumie
			    # $formaty[-1] w wyra¿eniu regularnym
		    }
		    closedir DIR;
		}
		my $uni = (sort grep { $f = $_; grep { $_ eq $f } @uni2 } @uni1)[0];
		defined $uni or die "$ja: unknown filter -- $formaty[0]-$formaty[-1]\n";
		$formaty[0]  = "$formaty[0]-$uni";
		$formaty[-1] = "$uni-$formaty[-1]";
	    }
	    foreach (@formaty) { jest $_ or die "$ja: unknown filter -- $_\n" }
	}
        $arg =~ s/(?=\W)/\\/g;
	foreach (@formaty) { $_ = "ARG=$arg $_" }
	join "|", @formaty;
    }
} ("+" . shift @we) =~ /\+(?:\(.*?\)|.*?)(?:$|(?=\+))/g;
@we or @we = "-";

######## W£A¦CIWA KONWERSJA ###################################################

if ($wy ne "=" && !-d $wy) { open STDOUT, ">$wy" or die "$ja: $wy: $!\n" }
foreach (@we)
{
    open STDIN, "<$_" or die "$ja: $_: $!\n";
    if ($_ ne "-")
    {
	if ($wy eq "=")
	{
	    ($fh, $temp) = tempfile();
	    close $fh;
	    open STDOUT, ">$temp" or die "$ja: $temp: $!\n"
	}
	elsif (-d _)
	{
	    (my $we = $_) =~ s|^.*/||;
	    open STDOUT, ">$wy/$we" or die "$ja: $wy/$we: $!\n"
	}
    }
    system $filtr and die "$ja: error executing filter\n";
    if ($_ ne "-" && $wy eq "=")
    {
	open STDIN, "<$temp" or die "$ja: $temp: $!\n";
	open STDOUT, ">$_" or die "$ja: $_: $!\n";
	unlink $temp;
	print while (<STDIN>);
    }
}

###############################################################################