4 # SPDX-License-Identifier: BSD-4-Clause
6 # Copyright (c) 1995 Joerg Wunsch
10 # This program is free software.
12 # Redistribution and use in source and binary forms, with or without
13 # modification, are permitted provided that the following conditions
15 # 1. Redistributions of source code must retain the above copyright
16 # notice, this list of conditions and the following disclaimer.
17 # 2. Redistributions in binary form must reproduce the above copyright
18 # notice, this list of conditions and the following disclaimer in the
19 # documentation and/or other materials provided with the distribution.
20 # 3. All advertising materials mentioning features or use of this software
21 # must display the following acknowledgement:
22 # This product includes software developed by Joerg Wunsch
23 # 4. The name of the developer may not be used to endorse or promote
24 # products derived from this software without specific prior written
27 # THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
28 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 # IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 # Posix 1003.2 compliant print spooler interface.
49 # Posix says LPDEST gets precedence over PRINTER
50 dest=${LPDEST:-${PRINTER:-lp}}
53 # XXX We include the -o flag as a dummy. Posix 1003.2 does not require
54 # it, but the rationale mentions it as a possible future extension.
55 # XXX We include the -s flag as a dummy. SUSv2 requires it,
56 # although we do not yet emit the affected messages.
58 while getopts "cd:mn:o:st:" option
62 c) # copy files before printing
69 ncopies="-#${OPTARG}";;
74 t) # title for banner page
76 *) # (error msg printed by getopts)
81 shift $(($OPTIND - 1))
83 exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} ${title:+-J"${title}"} "$@"