Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
7638 views
1
#!/bin/sh
2
# Copyright (c) 2001 Alcove (Yann Dirson <[email protected]>) - http://www.alcove.com/
3
# Copyright (C) 2011 Michael Gilbert <[email protected]>
4
# Copyright (C) 2011 Osamu Aoki <[email protected]>
5
# Copyright (C) 2013 Jörg-Volker Peetz <[email protected]>
6
#
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 2 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20
set -e
21
22
file=""
23
cmd="/usr/lib/mupdf/mupdf-x11"
24
while [ "$#" -gt "0" ]; do
25
case "$1" in
26
-p|-r|-b)
27
cmd="$cmd $1 "$2"" && shift ;;
28
*)
29
test -f "$1" && file="$1" && break ||
30
( echo "error: \"$1\" file not found" && false ) ;;
31
esac
32
shift
33
done
34
35
tmp=$(tempfile -s .pdf)
36
case "$file" in
37
*.gz|*.Z) zcat "$file" > "$tmp" && exec 3< "$tmp" && file="/dev/fd/3";;
38
*.xz) xzcat "$file" > "$tmp" && exec 3< "$tmp" && file="/dev/fd/3";;
39
*.bz2) bzcat "$file" > "$tmp" && exec 3< "$tmp" && file="/dev/fd/3";;
40
esac
41
rm -f "$tmp"
42
43
if [ "$file" = "" ]; then
44
exec $cmd || true
45
else
46
exec $cmd "$file" || true
47
fi
48
49