blob: 8c71379010e5eab19d640dcbe3cfbc67767d87fb (
plain)
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
|
#!/bin/bash
#
# a2ps-lpr-wrapper - lp/lpr wrapper script for GNU a2ps on Debian
#
TEMP=`getopt -o d: -n 'a2ps-lpr-wrapper' -- "$@"`
a2ps_printer=""
if [ $? != 0 ]; then echo "Terminating..." >&2; exit 1; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true ; do
case "$1" in
-d) a2ps_printer=$2; shift 2 ;;
--) shift; break ;;
*) echo "usage: a2ps-lpr-wrapper -d [printer] [files]"; exit 1 ;;
esac
done
# If /usr/bin/lp (from cupsys-client) exists, just use it.
if [ -x /usr/bin/lp ]; then
if [ "x$a2ps_printer" != "x" ]; then d="-d $a2ps_printer"; else d=""; fi
/usr/bin/lp $d "$@"
elif [ -x /usr/bin/lpr ]; then
# In case /usr/bin/lp is not available, then fall back /usr/bin/lpr.
if [ "x$a2ps_printer" != "x" ]; then P="-P $a2ps_printer"; else P=""; fi
/usr/bin/lpr $P "$@"
elif [ -x /usr/bin/rlpr ]; then
# In case /usr/bin/lpr is not available, then fall back /usr/bin/rlpr.
if [ "x$a2ps_printer" != "x" ]; then P="-P $a2ps_printer"; else P=""; fi
/usr/bin/rlpr $P "$@"
else
# If any of lp, lpr and rlpr is not available, then fail
echo "$0: lp/lpr/rlpr missing!"
exit 1
fi
|