#!/bin/sh
#
# Author Douglas R. Probst
# lpit version 2.0 11/08/95
# THE USUAL DISCLAIMERS APPLY!
usage()
{
echo " usage: $0 [-c] [-d dest] [-f name] [-H action] [-i IDs] [-m] "
echo " [-n number] [-o options] [-P list] [-q n] [-r] [-s]"
echo " [-S name] [-t title] [-T content] [-w] [-y mode] [filename] "
exit 1
}
LP=/bin/lp
set -- `getopt cd:f:H:i:lmn:o:P:q:rsS:t:T:wy: $@ 2>/dev/null`
if [ $? != 0 ]; then
usage
fi
for i in $@
do
case $i in
-c) C="-c"
shift 1;;
-d) D="-d$2"
shift 2;;
-f) F="-f$2"
shift 2;;
-H) H="-H$2"
shift 2;;
-i) i="-i$2"
shift 2;;
-m) M="-m"
shift 1;;
-n) N="-n$2"
shift 2;;
-o) O="-o$2"
shift 2;;
-P) P="-P$2"
shift 2;;
-q) Q="-q$2"
shift 2;;
-r) R="-r"
shift 1;;
-s) S="-s"
shift 1;;
-S) S2="-S$2"
shift 2;;
-t) T="-t$2"
shift 2;;
-T) T2="-T$2"
shift 2;;
-w) W="-w"
shift 1;;
-y) Y="-y$2"
shift 2;;
--) shift
break;;
esac
done
if [ $# -ge 1 ]; then
for i in $@
do
TYPE=`file $i | awk '{print $2, $3, $4, $5}'`
echo "${TYPE}" | egrep -i '(text|/bin/sh)' > /dev/null 2>&1
case $? in
0) echo "${TYPE}" | egrep -i '(postscript)' > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "$i, is of the type, <${TYPE}>, and can not be printed!!"
else
$LP $C $D $F $H $I $M $N $O $P $Q $R $S $S2 $T $T2 $W $Y $i
if [ $? = 0 ]; then
echo "$i is printing!"
else
echo "The print command has failed! " 2>&1
fi
fi
;;
[1]*)echo "$i, is of the type, <${TYPE}>, and can not be printed!!";;
esac
done
else
$LP $C $D $F $H $I $M $N $O $P $Q $R $S $S2 $T $T2 $W $Y
fi
Back to COMMENTED lpit
Back to Unix page