#!/bin/sh1# Copyright (c) 2001 Alcove (Yann Dirson <[email protected]>) - http://www.alcove.com/2# Copyright (C) 2011 Michael Gilbert <[email protected]>3# Copyright (C) 2011 Osamu Aoki <[email protected]>4# Copyright (C) 2013 Jörg-Volker Peetz <[email protected]>5#6# This program is free software: you can redistribute it and/or modify7# it under the terms of the GNU General Public License as published by8# the Free Software Foundation, either version 2 of the License, or9# (at your option) any later version.10#11# This program is distributed in the hope that it will be useful,12# but WITHOUT ANY WARRANTY; without even the implied warranty of13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# GNU General Public License for more details.15#16# You should have received a copy of the GNU General Public License17# along with this program. If not, see <http://www.gnu.org/licenses/>.1819set -e2021file=""22cmd="/usr/lib/mupdf/mupdf-x11"23while [ "$#" -gt "0" ]; do24case "$1" in25-p|-r|-b)26cmd="$cmd $1 "$2"" && shift ;;27*)28test -f "$1" && file="$1" && break ||29( echo "error: \"$1\" file not found" && false ) ;;30esac31shift32done3334tmp=$(tempfile -s .pdf)35case "$file" in36*.gz|*.Z) zcat "$file" > "$tmp" && exec 3< "$tmp" && file="/dev/fd/3";;37*.xz) xzcat "$file" > "$tmp" && exec 3< "$tmp" && file="/dev/fd/3";;38*.bz2) bzcat "$file" > "$tmp" && exec 3< "$tmp" && file="/dev/fd/3";;39esac40rm -f "$tmp"4142if [ "$file" = "" ]; then43exec $cmd || true44else45exec $cmd "$file" || true46fi474849