File: a2ps-lpr-wrapper

package info (click to toggle)
a2ps 1%3A4.14-4
  • links: PTS
  • area: main
  • in suites: buster
  • size: 13,328 kB
  • sloc: ansic: 26,966; sh: 11,844; lex: 2,286; perl: 1,156; yacc: 757; makefile: 609; lisp: 398; ada: 263; objc: 189; f90: 109; ml: 85; sql: 74; pascal: 57; modula3: 33; haskell: 32; sed: 30; java: 29; python: 24
file content (38 lines) | stat: -rw-r--r-- 1,159 bytes parent folder | download | duplicates (7)
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