/usr/share/doc/mgetty/contrib/lp-fax is in mgetty-docs 1.1.36-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | :
# @(#) FaxPrinter 1.0
#
# modelled to resemble the SCO printer drivers as closely
# as possible
#
# install this as /usr/spool/lp/model/fax, then add a printer
# (via sysadmsh) with printer interface "fax" (name it what you
# want, e.g. "fax"). Then send faxes from your applications with
#
# lp -d <fax-name> -o to=<fax-number> <files>"
# e.g.:
# lp -dfax -oto=0893243328 /tmp/fax1.ps
#
# works only if "faxspool" can be found in the command path
PATH=/usr/local/bin:$PATH
export PATH
# return everything to the right of the first "="
parse () {
echo "`expr \"$1\" : \"^[^=]*=\(.*\)\"`"
}
# general error handling
LP_ERR_LABEL="UX:lp"
errmsg () {
case $1 in
ERROR )
sev=" ERROR";
;;
WARNING )
sev="WARNING";
;;
esac
echo "${LP_ERR_LABEL}: ${sev}: $2
TO FIX: $3" >&2
}
printer=`basename $0`
request=$1
name=$2
title=$3
copies=$4
options=$5
shift; shift; shift; shift; shift
# resolution
normal_res=no
# fax number
fax_no=""
for i in $options
do
case $i in
n|normal|low)
normal_res=yes
;;
to=*)
fax_no=`parse ${i}`
;;
esac
done
# user = fifth field of /etc/passwd
user=`sed -n "s/^$name:.*:.*:.*:\(.*\):.*:.*$/\1/p" /etc/passwd`
if [ -z "$fax_no" ]
then
errmsg ERROR "no fax telephone number given" \
"set option \"-o to=<fax_number>\""
exit 1
fi
# for the sake of faxq
umask 022
# send the file(s) to the standard out $copies times
while [ "$copies" -gt 0 ]
do
/usr/local/bin/faxspool -u $name -f "$name ($user)" $fax_no $*
# for file
# do
# 0<${file} eval ${FILTER} 2>&1
# echo "\033E\c"
# done
copies=`expr $copies - 1`
done
exit 0
|