This file is indexed.

/usr/games/polyrun is in polygen-data 1.0.6.ds2-13.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
 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
#!/usr/bin/perl -w

use strict;
use warnings;
use File::Find;
use File::Basename;


my $GRMDIR='/usr/share/polygen';

my %langmap = (
	it => "ita",
	en => "eng",
	fr => "fra"
);

# Get the preferred polygen language directory from the current locale
sub getlang ()
{
	my $lang = $ENV{LC_MESSAGES};
	$lang = $ENV{LANG} if not $lang;
	$lang =~ s/_.+$//;
	return "eng" if not exists $langmap{$lang};
	return $langmap{$lang};
}

# Looks for the best absolute path for the given grammar
sub grmfind ($)
{
	my $name = shift;
	my @cand = ( $name, "$name.grm" );
	my $l = getlang();
	if (defined $l)
	{
		push @cand, "$GRMDIR/$l/$name";
		push @cand, "$GRMDIR/$l/$name.grm";
	}

	# First try the parameter by itself
	for my $pn (@cand)
	{
		return $pn if -e $pn;
	}

	my @dirs;
	find({wanted => sub {
			push @dirs, $File::Find::name if -d $File::Find::name;
		},
		no_chdir => 1,
	}, '/usr/share/polygen');

	for my $d (@dirs)
	{
		return "$d/$name" if -e "$d/$name";
		return "$d/$name.grm" if -e "$d/$name.grm";
	}
	return undef;
}

# Compute grammar tab completions
sub grmcomplete ($)
{
	my $start = shift || "";
	my %dirs;

	# Scan all files, grouping them by grammar name
	find({wanted => sub {
			my $basename = $_;
			$basename =~ s/.+\///;
			push @{$dirs{$basename}}, $File::Find::name if (/\.grm$/);
		},
		no_chdir => 1,
	}, '/usr/share/polygen');

	# Build the unambiguous list
	my @res;

	for my $name (keys %dirs)
	{
		push @res, $name;
		if (@{$dirs{$name}} > 1)
		{
			for my $pn (@{$dirs{$name}})
			{
				push @res, substr($pn, 19);
			}
		}
	}

	@res = sort @res;

	for my $line (@res)
	{
		print $line, "\n" if (substr($line, 0, length($start)) eq $start);
	}
}

if (@ARGV && $ARGV[0] eq '--complete')
{
	grmcomplete($ARGV[1]);
	exit 0;
}

my $scriptname = basename($0);

if ($scriptname eq 'polyfind')
{
	if (@ARGV) {
		print grmfind($ARGV[0]), "\n";
	} else {
		print STDERR "Usage: $scriptname grammar\n";
	}
}
else
{
	if (@ARGV) {
		my $grm = grmfind($ARGV[$#ARGV]);
		if (not defined $grm)
		{
			print STDERR $ARGV[$#ARGV], ": grammar not found\n";
			exit 1;
		}
		exec 'polygen', $grm

	} else {
		exec 'polygen';
	}
}

exit 0;