libarchive: Add an archive.3 MLINK.
[dragonfly.git] / usr.sbin / lpr / lp / lp.sh
blob2109ba276d2fc9d97521ab4458843b26eb97a1ab
1 #!/bin/sh
4 # Copyright (c) 1995 Joerg Wunsch
6 # All rights reserved.
8 # This program is free software.
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
12 # are met:
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
18 # 3. All advertising materials mentioning features or use of this software
19 # must display the following acknowledgement:
20 # This product includes software developed by Joerg Wunsch
21 # 4. The name of the developer may not be used to endorse or promote
22 # products derived from this software without specific prior written
23 # permission.
25 # THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
26 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 # IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 # Posix 1003.2 compliant print spooler interface.
39 # $FreeBSD: src/usr.sbin/lpr/lp/lp.sh,v 1.7 2000/03/08 10:02:11 sheldonh Exp $
40 # $DragonFly: src/usr.sbin/lpr/lp/lp.sh,v 1.2 2003/06/17 04:29:56 dillon Exp $
43 ncopies=""
44 symlink="-s"
46 # Posix says LPDEST gets precedence over PRINTER
47 dest=${LPDEST:-${PRINTER:-lp}}
50 # XXX We include the -o flag as a dummy. Posix 1003.2 does not require
51 # it, but the rationale mentions it as a possible future extension.
52 # XXX We include the -s flag as a dummy. SUSv2 requires it,
53 # although we do not yet emit the affected messages.
55 while getopts "cd:n:o:s" option
57 case $option in
59 c) # copy files before printing
60 symlink="";;
61 d) # destination
62 dest="${OPTARG}";;
63 n) # number of copies
64 ncopies="-#${OPTARG}";;
65 o) # (printer option)
66 : ;;
67 s) # (silent option)
68 : ;;
69 *) # (error msg printed by getopts)
70 exit 2;;
71 esac
72 done
74 shift $(($OPTIND - 1))
76 exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} "$@"