This file is indexed.

/usr/bin/mgpembed is in mgp 1.13a+upstream20090219-6.

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
#! /usr/bin/perl
#
# generate "embedded" mgp file:
#     o image/bimage filenames are replaced and corresponding uuencoded
#	(gzipped if applicable) files are concatenated in %embed/%endembed
#     o resolve %include directives
#     - each image should be searched in the paths specified in ~/.xloadimagerc
#	and app-defaults/Xloadimage
#     - do we need work for .mgprc ?
#     - scramble file names when desired

$cat = "/bin/cat";
$gzip = "/bin/gzip";
$uuencode = "/usr/bin/uuencode";
if (! -x $gzip || ! -x $uuencode) {
	die "external program not found. manual configuration required.\n"
}

require 'getopts.pl';

# specify suffixes we should gzip files before uuencoding
@gzipsuffix = (".ps", ".xbm");

do Getopts('o:');

if ($#ARGV != 0) {
	do usage();
	# NOTREACHED
}

$infname = $ARGV[0];

undef %files;

if (defined($opt_o)) {
	$outfname = $opt_o;
	die "$outfname already exists\n" if -f $outfname;
	die "$outfname is specified for both input/output\n"
		if ($outfname eq $infname);
	open(OUT, "> $outfname") || die "Can not open $outfname: $!";
} else {
	open(OUT, ">& STDOUT");
}

# read the file, process %include directives

do readfile($infname, 'INPUT000');

# append embedded files using %embed/%endembed directives

foreach $efile (keys %files) {
	# check if gzipped first
	$docompress = 0;
	foreach $suffix (@gzipsuffix) {
		if ($efile =~ /$suffix$/) {
			$docompress = 1;
			last;
		}
	}
	if ($docompress) {
		$target = "$efile.gz";
		$compress = "$gzip -c $files{$efile}";
	} else {
		$target = "$efile";
		$compress = "$cat $files{$efile}";
	}
	print OUT "\n\%embed \"$target\"\n";
	open(PIPE, "$compress | $uuencode $target |") ||
		die "Can not execute uuencode on $target";
	while (<PIPE>) {
		next if (/^begin/ || /^end/);
		print OUT;
	}
	print OUT "%endembed\n";
}
close(OUT);

sub readfile {
	local($filename, $input) = @_;
	local($fname, $fname0);
	$input++;
	open($input, $filename) || die "Can not open $filename: $!\n";
	while (<$input>) {
		if (/^%%/) {
			print OUT;
			next;
		}
		if (/^%(.*)image\s+/i) {
			$prefix = $1; $postfix = $';
			if ($postfix =~ /\"([^"]*)\"/) { 
                # "]*)\"/) { # (workaround for bug in Emacs Perl-syntax)
				$fname = $1;
			} elsif ($b =~ /^(\S+)/) {
				$fname = $1;
			}
			$base = $fname;
			$base =~ s/^.+\///;
			#
			# check $base uniqueness here
			#
			$orgbase = $base;
			$index = 0;
			while (defined($files{$base})) {
				$base = $orgbase . "-" . "$index";
				$index++;
			}
			$files{$base} = $fname;
			$embfn = "EMBEDDIR/" . $base;
			$postfix =~ s/\"$fname\"/\"$embfn\"/;
			print OUT '%';
			print OUT "$prefix";
			print OUT "image $postfix";
		} elsif (/^%(.*)include\s+(\S+)(.*)$/i) {
			$incfname = $2;
			if ($incfname =~ /^\"(.+)\"$/) {
				$incfname = $1;
			}
			print OUT "\%\%\%\%\%\%\%\%\%\%INCLUDE $incfname\n";
			do readfile($incfname, $input);
			print OUT "\%\%\%\%\%\%\%\%\%\%INCLUDE-END $incfname\n";
		} else {
			print OUT;
			next;
		}
	}
	close($input);
}

sub usage {
	print STDERR "usage: mgpembed [-o outfile ] mgpfile\n";
	exit -1;
}