/usr/bin/xcfview is in xcftools 1.0.7-4ubuntu1.
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 | #! /usr/bin/perl
#
# xcfview: a wrapper script that uses xcftools and an external viewer
# to display XCF images. The external viewer is found through the
# mailcap(5) database (q.v.) by using xdg-utils.
#
# Written by Henning Makholm <henning@makholm.net>
# Derived from the run-mailcap script by Brian White <bcwhite@pobox.com>
#
# In 2009 almost entirely rewritten by Jan Hauke Rahm <info@jhr-online.de>
# to make use of xdg-utils instead of parsing /etc/mailcap on its own
# That makes handling of dependencies *way* easier in Debian
#
# This script has been placed in the public domain (by both authors)
use strict ;
use warnings ;
use File::Temp qw/ tempfile /;
my $debug=0;
my $png_prog = `xdg-mime query default image/png`;
my $pnm_prog = `xdg-mime query default image/x-portable-pixmap`;
my (@converter, $usecomm);
if ($png_prog) {
@converter = ("xcf2png");
$usecomm = $png_prog;
} elsif ($pnm_prog) {
@converter = ("xcf2pnm","-c","'-#'");
$usecomm = $pnm_prog;
} else {
print STDERR "$0: No appropriate way to display PPM or PNG images in mailcap\n" ;
exit 1 ;
}
$usecomm =~ s/\.desktop$//;
$usecomm =~ s/\n$//;
# quote arguments for converter
for( @ARGV ) {
next if m{^[-a-z0-9,.:/@%^+=_]+$}i ;
s/'/\\'/ ;
$_ = "'$_'" ;
}
my ($fh, $tempfile) = tempfile(UNLINK => 1);
my $retcode = 0 ;
for my $comm ( join(" ",@converter,"-o",$tempfile,@ARGV),
join(" ",$usecomm,$tempfile) ) {
print STDERR " - executing: $comm\n" if $debug ;
my $res = system $comm;
$res = int($res/256);
if ($res != 0) {
print STDERR "Warning: program returned non-zero exit code \#$res\n";
$retcode = $res;
last ;
}
}
exit $retcode ;
|