xref: /freebsd/contrib/smbfs/examples/print/lj6l (revision cc68614da8232d8baaca0ae0d0dd8f890f06623e)
1#!/bin/sh
2
3# Sample input filter to print on HP Laser Jet printers
4# Installed in /usr/local/libexec/hp6l
5
6DEVICE="ljet3"
7PAPERSIZE="a4"
8
9printf "\033&k2G" || exit 2
10
11read first_line
12first_two_chars=`expr "$first_line" : '\(..\)'`
13
14if [ "$first_two_chars" = "%!" ]; then
15        exec 3>&1 1>&2
16        /usr/local/bin/gs -sPAPERSIZE=${PAPERSIZE} -dSAFER -dNOPAUSE -q -sDEVICE=${DEVICE} \
17            -sOutputFile=/dev/fd/3 -  && exit 0
18else
19        echo $first_line && cat && printf "\033&l0H" && exit 0
20fi
21
22exit 2
23